2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "test_set_nogc.h"
33 #include <cds/container/lazy_list_nogc.h>
34 #include <cds/container/split_list_set_nogc.h>
35 #include <cds/intrusive/free_list.h>
38 namespace cc = cds::container;
39 typedef cds::gc::nogc gc_type;
41 class SplitListLazySet_NoGC : public cds_test::container_set_nogc
44 typedef cds_test::container_set_nogc base_class;
53 TEST_F( SplitListLazySet_NoGC, compare )
55 typedef cc::SplitListSet< gc_type, int_item,
56 typename cc::split_list::make_traits<
57 cc::split_list::ordered_list< cc::lazy_list_tag >
58 , cds::opt::hash< hash_int >
59 , cc::split_list::ordered_list_traits<
60 typename cc::lazy_list::make_traits<
61 cds::opt::compare< cmp >
67 set_type s( kSize, 2 );
71 TEST_F( SplitListLazySet_NoGC, less )
73 typedef cc::SplitListSet< gc_type, int_item,
74 typename cc::split_list::make_traits<
75 cc::split_list::ordered_list< cc::lazy_list_tag >
76 , cds::opt::hash< hash_int >
77 , cc::split_list::ordered_list_traits<
78 typename cc::lazy_list::make_traits<
79 cds::opt::less< less >
85 set_type s( kSize, 2 );
89 TEST_F( SplitListLazySet_NoGC, cmpmix )
91 typedef cc::SplitListSet< gc_type, int_item,
92 typename cc::split_list::make_traits<
93 cc::split_list::ordered_list< cc::lazy_list_tag >
94 , cds::opt::hash< hash_int >
95 , cc::split_list::ordered_list_traits<
96 typename cc::lazy_list::make_traits<
97 cds::opt::less< less >
98 , cds::opt::compare< cmp >
104 set_type s( kSize, 1 );
108 TEST_F( SplitListLazySet_NoGC, item_counting )
110 struct set_traits: public cc::split_list::traits
112 typedef cc::lazy_list_tag ordered_list;
113 typedef hash_int hash;
114 typedef cds::atomicity::item_counter item_counter;
116 struct ordered_list_traits: public cc::lazy_list::traits
119 typedef base_class::less less;
120 typedef cds::backoff::empty back_off;
123 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
125 set_type s( kSize, 3 );
129 TEST_F( SplitListLazySet_NoGC, stat )
131 struct set_traits: public cc::split_list::traits
133 typedef cc::lazy_list_tag ordered_list;
134 typedef hash_int hash;
135 typedef cds::atomicity::item_counter item_counter;
136 typedef cc::split_list::stat<> stat;
138 struct ordered_list_traits: public cc::lazy_list::traits
140 typedef base_class::less less;
141 typedef cds::opt::v::sequential_consistent memory_model;
144 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
146 set_type s( kSize, 4 );
150 TEST_F( SplitListLazySet_NoGC, back_off )
152 struct set_traits: public cc::split_list::traits
154 typedef cc::lazy_list_tag ordered_list;
155 typedef hash_int hash;
156 typedef cds::atomicity::item_counter item_counter;
157 typedef cds::backoff::yield back_off;
158 typedef cds::opt::v::sequential_consistent memory_model;
160 struct ordered_list_traits: public cc::lazy_list::traits
163 typedef cds::backoff::empty back_off;
166 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
168 set_type s( kSize, 2 );
172 TEST_F( SplitListLazySet_NoGC, mutex )
174 struct set_traits: public cc::split_list::traits
176 typedef cc::lazy_list_tag ordered_list;
177 typedef hash_int hash;
178 typedef cds::atomicity::item_counter item_counter;
179 typedef cds::backoff::yield back_off;
180 typedef cds::opt::v::sequential_consistent memory_model;
182 struct ordered_list_traits: public cc::lazy_list::traits
185 typedef cds::backoff::pause back_off;
186 typedef std::mutex lock_type;
189 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
191 set_type s( kSize, 3 );
195 struct set_static_traits: public cc::split_list::traits
197 static bool const dynamic_bucket_table = false;
200 TEST_F( SplitListLazySet_NoGC, static_bucket_table )
202 struct set_traits: public set_static_traits
204 typedef cc::lazy_list_tag ordered_list;
205 typedef hash_int hash;
206 typedef cds::atomicity::item_counter item_counter;
208 struct ordered_list_traits: public cc::lazy_list::traits
211 typedef cds::backoff::pause back_off;
214 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
216 set_type s( kSize, 4 );
220 TEST_F( SplitListLazySet_NoGC, static_bucket_table_free_list )
222 struct set_traits: public set_static_traits
224 typedef cc::lazy_list_tag ordered_list;
225 typedef hash_int hash;
226 typedef cds::atomicity::item_counter item_counter;
227 typedef cds::intrusive::FreeList free_list;
229 struct ordered_list_traits: public cc::lazy_list::traits
232 typedef cds::backoff::pause back_off;
235 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
237 set_type s( kSize, 4 );
241 TEST_F( SplitListLazySet_NoGC, free_list )
243 struct set_traits: public cc::split_list::traits
245 typedef cc::lazy_list_tag ordered_list;
246 typedef hash_int hash;
247 typedef cds::atomicity::item_counter item_counter;
248 typedef cds::intrusive::FreeList free_list;
250 struct ordered_list_traits: public cc::lazy_list::traits
253 typedef cds::backoff::empty back_off;
256 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
258 set_type s( kSize, 2 );