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_intrusive_set_nogc.h"
33 #include <cds/intrusive/skip_list_nogc.h>
36 namespace ci = cds::intrusive;
37 typedef cds::gc::nogc gc_type;
39 class IntrusiveSkipListSet_NoGC : public cds_test::intrusive_set_nogc
42 typedef cds_test::intrusive_set_nogc base_class;
45 typedef typename base_class::base_int_item< ci::skip_list::node< gc_type>> base_item_type;
46 typedef typename base_class::member_int_item< ci::skip_list::node< gc_type>> member_item_type;
56 TEST_F( IntrusiveSkipListSet_NoGC, base_cmp )
58 struct traits : public ci::skip_list::traits
60 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
61 typedef mock_disposer disposer;
62 typedef cmp<base_item_type> compare;
65 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
71 TEST_F( IntrusiveSkipListSet_NoGC, base_less )
73 struct traits : public ci::skip_list::traits
75 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
76 typedef mock_disposer disposer;
77 typedef base_class::less<base_item_type> less;
78 typedef cds::atomicity::item_counter item_counter;
81 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
87 TEST_F( IntrusiveSkipListSet_NoGC, base_cmpmix )
89 struct traits : public ci::skip_list::traits
91 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
92 typedef mock_disposer disposer;
93 typedef cmp<base_item_type> compare;
94 typedef base_class::less<base_item_type> less;
95 typedef ci::skip_list::stat<> stat;
98 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
104 TEST_F( IntrusiveSkipListSet_NoGC, base_xorshift32 )
106 struct traits : public ci::skip_list::traits
108 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
109 typedef mock_disposer disposer;
110 typedef cmp<base_item_type> compare;
111 typedef ci::skip_list::xorshift32 random_level_generator;
114 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
120 TEST_F( IntrusiveSkipListSet_NoGC, base_xorshift24 )
122 struct traits: public ci::skip_list::traits
124 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
125 typedef mock_disposer disposer;
126 typedef cmp<base_item_type> compare;
127 typedef ci::skip_list::xorshift24 random_level_generator;
130 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
136 TEST_F( IntrusiveSkipListSet_NoGC, base_xorshift16 )
138 struct traits: public ci::skip_list::traits
140 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
141 typedef mock_disposer disposer;
142 typedef cmp<base_item_type> compare;
143 typedef ci::skip_list::xorshift16 random_level_generator;
146 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
152 TEST_F( IntrusiveSkipListSet_NoGC, base_turbo32 )
154 struct traits: public ci::skip_list::traits
156 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
157 typedef mock_disposer disposer;
158 typedef cmp<base_item_type> compare;
159 typedef ci::skip_list::turbo32 random_level_generator;
162 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
168 TEST_F( IntrusiveSkipListSet_NoGC, base_turbo24 )
170 struct traits: public ci::skip_list::traits
172 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
173 typedef mock_disposer disposer;
174 typedef cmp<base_item_type> compare;
175 typedef ci::skip_list::turbo24 random_level_generator;
178 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
184 TEST_F( IntrusiveSkipListSet_NoGC, base_turbo16 )
186 struct traits: public ci::skip_list::traits
188 typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
189 typedef mock_disposer disposer;
190 typedef cmp<base_item_type> compare;
191 typedef ci::skip_list::turbo16 random_level_generator;
194 typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
200 TEST_F( IntrusiveSkipListSet_NoGC, member_cmp )
202 struct traits : public ci::skip_list::traits
204 typedef ci::skip_list::member_hook< offsetof(member_item_type, hMember), ci::opt::gc< gc_type >> hook;
205 typedef mock_disposer disposer;
206 typedef cmp<member_item_type> compare;
209 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
215 TEST_F( IntrusiveSkipListSet_NoGC, member_less )
217 struct traits : public ci::skip_list::traits
219 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
220 typedef mock_disposer disposer;
221 typedef base_class::less<member_item_type> less;
222 typedef cds::atomicity::item_counter item_counter;
223 typedef ci::opt::v::sequential_consistent memory_model;
226 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
232 TEST_F( IntrusiveSkipListSet_NoGC, member_cmpmix )
234 struct traits : public ci::skip_list::traits
236 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
237 typedef mock_disposer disposer;
238 typedef cmp<member_item_type> compare;
239 typedef base_class::less<member_item_type> less;
240 typedef ci::skip_list::stat<> stat;
243 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
249 TEST_F( IntrusiveSkipListSet_NoGC, member_xorshift32 )
251 struct traits : public ci::skip_list::traits
253 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
254 typedef mock_disposer disposer;
255 typedef cmp<member_item_type> compare;
256 typedef ci::skip_list::xorshift32 random_level_generator;
259 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
265 TEST_F( IntrusiveSkipListSet_NoGC, member_xorshift24 )
267 struct traits: public ci::skip_list::traits
269 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
270 typedef mock_disposer disposer;
271 typedef cmp<member_item_type> compare;
272 typedef ci::skip_list::xorshift24 random_level_generator;
275 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
281 TEST_F( IntrusiveSkipListSet_NoGC, member_xorshift16 )
283 struct traits: public ci::skip_list::traits
285 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
286 typedef mock_disposer disposer;
287 typedef cmp<member_item_type> compare;
288 typedef ci::skip_list::xorshift16 random_level_generator;
291 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
297 TEST_F( IntrusiveSkipListSet_NoGC, member_turbo32 )
299 struct traits: public ci::skip_list::traits
301 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
302 typedef mock_disposer disposer;
303 typedef cmp<member_item_type> compare;
304 typedef ci::skip_list::turbo32 random_level_generator;
307 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
313 TEST_F( IntrusiveSkipListSet_NoGC, member_turbo24 )
315 struct traits: public ci::skip_list::traits
317 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
318 typedef mock_disposer disposer;
319 typedef cmp<member_item_type> compare;
320 typedef ci::skip_list::turbo24 random_level_generator;
323 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
329 TEST_F( IntrusiveSkipListSet_NoGC, member_turbo16 )
331 struct traits: public ci::skip_list::traits
333 typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
334 typedef mock_disposer disposer;
335 typedef cmp<member_item_type> compare;
336 typedef ci::skip_list::turbo16 random_level_generator;
339 typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;