2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
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 "set/hdr_intrusive_set.h"
32 #include <cds/intrusive/lazy_list_nogc.h>
33 #include <cds/intrusive/split_list_nogc.h>
37 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmp_lazy()
39 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
40 typedef ci::LazyList< cds::gc::nogc
42 ,ci::lazy_list::make_traits<
43 ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
44 ,co::compare< cmp<item> >
45 ,ci::opt::disposer< faked_disposer >
46 ,ci::opt::back_off< cds::backoff::empty >
50 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
51 ci::split_list::make_traits<
53 ,ci::split_list::dynamic_bucket_table<true>
54 ,co::memory_model<co::v::relaxed_ordering>
61 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_less_lazy()
63 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
64 typedef ci::LazyList< cds::gc::nogc
66 ,ci::lazy_list::make_traits<
67 ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
68 ,co::less< less<item> >
69 ,ci::opt::disposer< faked_disposer >
73 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
74 ci::split_list::make_traits<
76 ,ci::split_list::dynamic_bucket_table<true>
77 ,co::memory_model<co::v::sequential_consistent>
84 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmpmix_lazy()
86 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
87 typedef ci::LazyList< cds::gc::nogc
89 ,ci::lazy_list::make_traits<
90 ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
91 ,co::less< less<item> >
92 ,co::compare< cmp<item> >
93 ,ci::opt::disposer< faked_disposer >
97 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
98 ci::split_list::make_traits<
100 ,co::item_counter< simple_item_counter >
101 ,ci::split_list::dynamic_bucket_table<true>
105 test_int_nogc<set>();
108 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmpmix_stat_lazy()
110 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
111 struct list_traits : public ci::lazy_list::traits
113 typedef ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > hook;
114 typedef IntrusiveHashSetHdrTest::less<item> less;
115 typedef cmp<item> compare;
116 typedef faked_disposer disposer;
118 typedef ci::LazyList< cds::gc::nogc, item, list_traits > bucket_type;
120 struct set_traits : public ci::split_list::make_traits<ci::split_list::dynamic_bucket_table<true>>::type
122 typedef hash_int hash;
123 typedef simple_item_counter item_counter;
124 typedef ci::split_list::stat<> stat;
126 typedef ci::SplitListSet< cds::gc::nogc, bucket_type, set_traits > set;
128 test_int_nogc<set>();
131 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmp_lazy()
133 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
134 typedef ci::LazyList< cds::gc::nogc
136 ,ci::lazy_list::make_traits<
137 ci::opt::hook< ci::lazy_list::member_hook<
138 offsetof( item, hMember ),
139 co::gc<cds::gc::nogc>
141 ,co::compare< cmp<item> >
142 ,ci::opt::disposer< faked_disposer >
146 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
147 ci::split_list::make_traits<
149 ,ci::split_list::dynamic_bucket_table<true>
150 ,co::memory_model<co::v::relaxed_ordering>
154 test_int_nogc<set>();
157 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_less_lazy()
159 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
160 typedef ci::LazyList< cds::gc::nogc
162 ,ci::lazy_list::make_traits<
163 ci::opt::hook< ci::lazy_list::member_hook<
164 offsetof( item, hMember ),
165 co::gc<cds::gc::nogc>
167 ,co::less< less<item> >
168 ,ci::opt::disposer< faked_disposer >
172 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
173 ci::split_list::make_traits<
175 ,ci::split_list::dynamic_bucket_table<true>
176 ,co::memory_model<co::v::sequential_consistent>
180 test_int_nogc<set>();
183 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmpmix_lazy()
185 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
186 typedef ci::LazyList< cds::gc::nogc
188 ,ci::lazy_list::make_traits<
189 ci::opt::hook< ci::lazy_list::member_hook<
190 offsetof( item, hMember ),
191 co::gc<cds::gc::nogc>
193 ,co::compare< cmp<item> >
194 ,co::less< less<item> >
195 ,ci::opt::disposer< faked_disposer >
199 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
200 ci::split_list::make_traits<
202 ,co::item_counter< simple_item_counter >
203 ,ci::split_list::dynamic_bucket_table<true>
207 test_int_nogc<set>();
210 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmpmix_stat_lazy()
212 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
214 public ci::lazy_list::make_traits<
215 ci::opt::hook< ci::lazy_list::member_hook<
216 offsetof( item, hMember ),
217 co::gc<cds::gc::nogc>
219 ,co::compare< cmp<item> >
220 ,co::less< less<item> >
221 ,ci::opt::disposer< faked_disposer >
224 typedef ci::LazyList< cds::gc::nogc, item, list_traits > bucket_type;
227 public ci::split_list::make_traits<
229 ,co::item_counter< simple_item_counter >
230 ,ci::split_list::dynamic_bucket_table<true>
231 ,co::stat< ci::split_list::stat<> >
234 typedef ci::SplitListSet< cds::gc::nogc, bucket_type, set_traits > set;
236 test_int_nogc<set>();
239 // Static bucket table
240 void IntrusiveHashSetHdrTest::split_st_nogc_base_cmp_lazy()
242 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
243 typedef ci::LazyList< cds::gc::nogc
245 ,ci::lazy_list::make_traits<
246 ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
247 ,co::compare< cmp<item> >
248 ,ci::opt::disposer< faked_disposer >
252 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
253 ci::split_list::make_traits<
255 ,ci::split_list::dynamic_bucket_table<false>
256 ,co::memory_model<co::v::relaxed_ordering>
260 test_int_nogc<set>();
263 void IntrusiveHashSetHdrTest::split_st_nogc_base_less_lazy()
265 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
266 typedef ci::LazyList< cds::gc::nogc
268 ,ci::lazy_list::make_traits<
269 ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
270 ,co::less< less<item> >
271 ,ci::opt::disposer< faked_disposer >
275 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
276 ci::split_list::make_traits<
278 ,ci::split_list::dynamic_bucket_table<false>
279 ,co::memory_model<co::v::sequential_consistent>
283 test_int_nogc<set>();
286 void IntrusiveHashSetHdrTest::split_st_nogc_base_cmpmix_lazy()
288 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
289 typedef ci::LazyList< cds::gc::nogc
291 ,ci::lazy_list::make_traits<
292 ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
293 ,co::less< less<item> >
294 ,co::compare< cmp<item> >
295 ,ci::opt::disposer< faked_disposer >
299 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
300 ci::split_list::make_traits<
302 ,co::item_counter< simple_item_counter >
303 ,ci::split_list::dynamic_bucket_table<false>
307 test_int_nogc<set>();
310 void IntrusiveHashSetHdrTest::split_st_nogc_base_cmpmix_stat_lazy()
312 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
313 typedef ci::LazyList< cds::gc::nogc
315 ,ci::lazy_list::make_traits<
316 ci::opt::hook< ci::lazy_list::base_hook< co::gc<cds::gc::nogc> > >
317 ,co::less< less<item> >
318 ,co::compare< cmp<item> >
319 ,ci::opt::disposer< faked_disposer >
323 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
324 ci::split_list::make_traits<
326 ,co::item_counter< simple_item_counter >
327 ,ci::split_list::dynamic_bucket_table<false>
328 ,co::stat< ci::split_list::stat<> >
332 test_int_nogc<set>();
335 void IntrusiveHashSetHdrTest::split_st_nogc_member_cmp_lazy()
337 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
338 typedef ci::LazyList< cds::gc::nogc
340 ,ci::lazy_list::make_traits<
341 ci::opt::hook< ci::lazy_list::member_hook<
342 offsetof( item, hMember ),
343 co::gc<cds::gc::nogc>
345 ,co::compare< cmp<item> >
346 ,ci::opt::disposer< faked_disposer >
350 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
351 ci::split_list::make_traits<
353 ,ci::split_list::dynamic_bucket_table<false>
354 ,co::memory_model<co::v::relaxed_ordering>
358 test_int_nogc<set>();
361 void IntrusiveHashSetHdrTest::split_st_nogc_member_less_lazy()
363 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
364 typedef ci::LazyList< cds::gc::nogc
366 ,ci::lazy_list::make_traits<
367 ci::opt::hook< ci::lazy_list::member_hook<
368 offsetof( item, hMember ),
369 co::gc<cds::gc::nogc>
371 ,co::less< less<item> >
372 ,ci::opt::disposer< faked_disposer >
376 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
377 ci::split_list::make_traits<
379 ,ci::split_list::dynamic_bucket_table<false>
380 ,co::memory_model<co::v::sequential_consistent>
384 test_int_nogc<set>();
387 void IntrusiveHashSetHdrTest::split_st_nogc_member_cmpmix_lazy()
389 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
390 typedef ci::LazyList< cds::gc::nogc
392 ,ci::lazy_list::make_traits<
393 ci::opt::hook< ci::lazy_list::member_hook<
394 offsetof( item, hMember ),
395 co::gc<cds::gc::nogc>
397 ,co::compare< cmp<item> >
398 ,co::less< less<item> >
399 ,ci::opt::disposer< faked_disposer >
403 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
404 ci::split_list::make_traits<
406 ,co::item_counter< simple_item_counter >
407 ,ci::split_list::dynamic_bucket_table<false>
411 test_int_nogc<set>();
414 void IntrusiveHashSetHdrTest::split_st_nogc_member_cmpmix_stat_lazy()
416 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<cds::gc::nogc> > > item;
417 typedef ci::LazyList< cds::gc::nogc
419 ,ci::lazy_list::make_traits<
420 ci::opt::hook< ci::lazy_list::member_hook<
421 offsetof( item, hMember ),
422 co::gc<cds::gc::nogc>
424 ,co::compare< cmp<item> >
425 ,co::less< less<item> >
426 ,ci::opt::disposer< faked_disposer >
430 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
431 ci::split_list::make_traits<
433 ,co::item_counter< simple_item_counter >
434 ,ci::split_list::dynamic_bucket_table<false>
435 ,co::stat< ci::split_list::stat<> >
439 test_int_nogc<set>();