bugfix in cds::gc::HP::guarded_ptr
[libcds.git] / tests / test-hdr / set / hdr_intrusive_splitlist_set_nogc.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_set.h"
4 #include <cds/intrusive/michael_list_nogc.h>
5 #include <cds/intrusive/split_list_nogc.h>
6
7 namespace set {
8
9     void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmp()
10     {
11         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
12         typedef ci::MichaelList< cds::gc::nogc
13             ,item
14             ,ci::michael_list::make_traits<
15                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
16                 ,co::compare< cmp<item> >
17                 ,ci::opt::disposer< faked_disposer >
18             >::type
19         >    bucket_type;
20
21         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
22             ci::split_list::make_traits<
23                 co::hash< hash_int >
24                 ,ci::split_list::dynamic_bucket_table<true>
25                 ,co::memory_model<co::v::relaxed_ordering>
26             >::type
27         > set;
28
29         test_int_nogc<set>();
30     }
31
32     void IntrusiveHashSetHdrTest::split_dyn_nogc_base_less()
33     {
34         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
35         typedef ci::MichaelList< cds::gc::nogc
36             ,item
37             ,ci::michael_list::make_traits<
38                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
39                 ,co::less< less<item> >
40                 ,ci::opt::disposer< faked_disposer >
41             >::type
42         >    bucket_type;
43
44         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
45             ci::split_list::make_traits<
46                 co::hash< hash_int >
47                 ,ci::split_list::dynamic_bucket_table<true>
48                 ,co::memory_model<co::v::sequential_consistent>
49             >::type
50         > set;
51
52         test_int_nogc<set>();
53     }
54
55     void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmpmix()
56     {
57         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
58         typedef ci::MichaelList< cds::gc::nogc
59             ,item
60             ,ci::michael_list::make_traits<
61                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
62                 ,co::less< less<item> >
63                 ,co::compare< cmp<item> >
64                 ,ci::opt::disposer< faked_disposer >
65             >::type
66         >    bucket_type;
67
68         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
69             ci::split_list::make_traits<
70                 co::hash< hash_int >
71                 ,co::item_counter< simple_item_counter >
72                 ,ci::split_list::dynamic_bucket_table<true>
73             >::type
74         > set;
75
76         test_int_nogc<set>();
77     }
78
79     void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmpmix_stat()
80     {
81         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
82         struct list_traits : public ci::michael_list::traits
83         {
84             typedef ci::michael_list::base_hook< co::gc<cds::gc::nogc> > hook;
85             typedef cmp<item> compare;
86             typedef IntrusiveHashSetHdrTest::less<item> less;
87             typedef faked_disposer disposer;
88         };
89         typedef ci::MichaelList< cds::gc::nogc, item, list_traits > bucket_type;
90
91         struct set_traits : public ci::split_list::make_traits< ci::split_list::dynamic_bucket_table<true> >::type
92         {
93             typedef hash_int hash;
94             typedef simple_item_counter item_counter;
95             typedef ci::split_list::stat<> stat;
96         };
97         typedef ci::SplitListSet< cds::gc::nogc, bucket_type, set_traits > set;
98
99         test_int_nogc<set>();
100     }
101
102     void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmp()
103     {
104         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
105         typedef ci::MichaelList< cds::gc::nogc
106             ,item
107             ,ci::michael_list::make_traits<
108                 ci::opt::hook< ci::michael_list::member_hook<
109                     offsetof( item, hMember ),
110                     co::gc<cds::gc::nogc>
111                 > >
112                 ,co::compare< cmp<item> >
113                 ,ci::opt::disposer< faked_disposer >
114             >::type
115         >    bucket_type;
116
117         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
118             ci::split_list::make_traits<
119                 co::hash< hash_int >
120                 ,ci::split_list::dynamic_bucket_table<true>
121                 ,co::memory_model<co::v::relaxed_ordering>
122             >::type
123         > set;
124
125         test_int_nogc<set>();
126     }
127
128     void IntrusiveHashSetHdrTest::split_dyn_nogc_member_less()
129     {
130         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
131         typedef ci::MichaelList< cds::gc::nogc
132             ,item
133             ,ci::michael_list::make_traits<
134                 ci::opt::hook< ci::michael_list::member_hook<
135                     offsetof( item, hMember ),
136                     co::gc<cds::gc::nogc>
137                 > >
138                 ,co::less< less<item> >
139                 ,ci::opt::disposer< faked_disposer >
140             >::type
141         >    bucket_type;
142
143         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
144             ci::split_list::make_traits<
145                 co::hash< hash_int >
146                 ,ci::split_list::dynamic_bucket_table<true>
147                 ,co::memory_model<co::v::sequential_consistent>
148             >::type
149         > set;
150
151         test_int_nogc<set>();
152     }
153
154     void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmpmix()
155     {
156         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
157         typedef ci::MichaelList< cds::gc::nogc
158             ,item
159             ,ci::michael_list::make_traits<
160                 ci::opt::hook< ci::michael_list::member_hook<
161                     offsetof( item, hMember ),
162                     co::gc<cds::gc::nogc>
163                 > >
164                 ,co::compare< cmp<item> >
165                 ,co::less< less<item> >
166                 ,ci::opt::disposer< faked_disposer >
167             >::type
168         >    bucket_type;
169
170         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
171             ci::split_list::make_traits<
172                 co::hash< hash_int >
173                 ,co::item_counter< simple_item_counter >
174                 ,ci::split_list::dynamic_bucket_table<true>
175             >::type
176         > set;
177
178         test_int_nogc<set>();
179     }
180
181     void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmpmix_stat()
182     {
183         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
184         struct list_traits:
185             public ci::michael_list::make_traits<
186                 ci::opt::hook< ci::michael_list::member_hook<
187                     offsetof( item, hMember ),
188                     co::gc<cds::gc::nogc>
189                 > >
190                 ,co::compare< cmp<item> >
191                 ,co::less< less<item> >
192                 ,ci::opt::disposer< faked_disposer >
193             >::type
194         {};
195         typedef ci::MichaelList< cds::gc::nogc, item, list_traits >  bucket_type;
196
197         struct set_traits :
198             public ci::split_list::make_traits<
199                 co::hash< hash_int >
200                 ,co::item_counter< simple_item_counter >
201                 ,ci::split_list::dynamic_bucket_table<true>
202                 ,co::stat< ci::split_list::stat<> >
203             >::type
204         {};
205         typedef ci::SplitListSet< cds::gc::nogc, bucket_type, set_traits > set;
206
207         test_int_nogc<set>();
208     }
209
210     // Static bucket table
211     void IntrusiveHashSetHdrTest::split_st_nogc_base_cmp()
212     {
213         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
214         typedef ci::MichaelList< cds::gc::nogc
215             ,item
216             ,ci::michael_list::make_traits<
217                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
218                 ,co::compare< cmp<item> >
219                 ,ci::opt::disposer< faked_disposer >
220             >::type
221         >    bucket_type;
222
223         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
224             ci::split_list::make_traits<
225                 co::hash< hash_int >
226                 ,ci::split_list::dynamic_bucket_table<false>
227                 ,co::memory_model<co::v::relaxed_ordering>
228             >::type
229         > set;
230
231         test_int_nogc<set>();
232     }
233
234     void IntrusiveHashSetHdrTest::split_st_nogc_base_less()
235     {
236         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
237         typedef ci::MichaelList< cds::gc::nogc
238             ,item
239             ,ci::michael_list::make_traits<
240                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
241                 ,co::less< less<item> >
242                 ,ci::opt::disposer< faked_disposer >
243             >::type
244         >    bucket_type;
245
246         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
247             ci::split_list::make_traits<
248                 co::hash< hash_int >
249                 ,ci::split_list::dynamic_bucket_table<false>
250                 ,co::memory_model<co::v::sequential_consistent>
251             >::type
252         > set;
253
254         test_int_nogc<set>();
255     }
256
257     void IntrusiveHashSetHdrTest::split_st_nogc_base_cmpmix()
258     {
259         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
260         typedef ci::MichaelList< cds::gc::nogc
261             ,item
262             ,ci::michael_list::make_traits<
263                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
264                 ,co::less< less<item> >
265                 ,co::compare< cmp<item> >
266                 ,ci::opt::disposer< faked_disposer >
267             >::type
268         >    bucket_type;
269
270         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
271             ci::split_list::make_traits<
272                 co::hash< hash_int >
273                 ,co::item_counter< simple_item_counter >
274                 ,ci::split_list::dynamic_bucket_table<false>
275             >::type
276         > set;
277
278         test_int_nogc<set>();
279     }
280
281     void IntrusiveHashSetHdrTest::split_st_nogc_base_cmpmix_stat()
282     {
283         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
284         typedef ci::MichaelList< cds::gc::nogc
285             ,item
286             ,ci::michael_list::make_traits<
287                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
288                 ,co::less< less<item> >
289                 ,co::compare< cmp<item> >
290                 ,ci::opt::disposer< faked_disposer >
291             >::type
292         >    bucket_type;
293
294         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
295             ci::split_list::make_traits<
296                 co::hash< hash_int >
297                 ,co::item_counter< simple_item_counter >
298                 ,ci::split_list::dynamic_bucket_table<false>
299                 ,co::stat< ci::split_list::stat<> >
300             >::type
301         > set;
302
303         test_int_nogc<set>();
304     }
305
306     void IntrusiveHashSetHdrTest::split_st_nogc_member_cmp()
307     {
308         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
309         typedef ci::MichaelList< cds::gc::nogc
310             ,item
311             ,ci::michael_list::make_traits<
312                 ci::opt::hook< ci::michael_list::member_hook<
313                     offsetof( item, hMember ),
314                     co::gc<cds::gc::nogc>
315                 > >
316                 ,co::compare< cmp<item> >
317                 ,ci::opt::disposer< faked_disposer >
318             >::type
319         >    bucket_type;
320
321         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
322             ci::split_list::make_traits<
323                 co::hash< hash_int >
324                 ,ci::split_list::dynamic_bucket_table<false>
325                 ,co::memory_model<co::v::sequential_consistent>
326             >::type
327         > set;
328
329         test_int_nogc<set>();
330     }
331
332     void IntrusiveHashSetHdrTest::split_st_nogc_member_less()
333     {
334         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
335         typedef ci::MichaelList< cds::gc::nogc
336             ,item
337             ,ci::michael_list::make_traits<
338                 ci::opt::hook< ci::michael_list::member_hook<
339                     offsetof( item, hMember ),
340                     co::gc<cds::gc::nogc>
341                 > >
342                 ,co::less< less<item> >
343                 ,ci::opt::disposer< faked_disposer >
344             >::type
345         >    bucket_type;
346
347         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
348             ci::split_list::make_traits<
349                 co::hash< hash_int >
350                 ,ci::split_list::dynamic_bucket_table<false>
351                 ,co::memory_model<co::v::relaxed_ordering>
352             >::type
353         > set;
354
355         test_int_nogc<set>();
356     }
357
358     void IntrusiveHashSetHdrTest::split_st_nogc_member_cmpmix()
359     {
360         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
361         typedef ci::MichaelList< cds::gc::nogc
362             ,item
363             ,ci::michael_list::make_traits<
364                 ci::opt::hook< ci::michael_list::member_hook<
365                     offsetof( item, hMember ),
366                     co::gc<cds::gc::nogc>
367                 > >
368                 ,co::compare< cmp<item> >
369                 ,co::less< less<item> >
370                 ,ci::opt::disposer< faked_disposer >
371             >::type
372         >    bucket_type;
373
374         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
375             ci::split_list::make_traits<
376                 co::hash< hash_int >
377                 ,co::item_counter< simple_item_counter >
378                 ,ci::split_list::dynamic_bucket_table<false>
379             >::type
380         > set;
381
382         test_int_nogc<set>();
383     }
384
385     void IntrusiveHashSetHdrTest::split_st_nogc_member_cmpmix_stat()
386     {
387         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
388         typedef ci::MichaelList< cds::gc::nogc
389             ,item
390             ,ci::michael_list::make_traits<
391                 ci::opt::hook< ci::michael_list::member_hook<
392                     offsetof( item, hMember ),
393                     co::gc<cds::gc::nogc>
394                 > >
395                 ,co::compare< cmp<item> >
396                 ,co::less< less<item> >
397                 ,ci::opt::disposer< faked_disposer >
398             >::type
399         >    bucket_type;
400
401         typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
402             ci::split_list::make_traits<
403                 co::hash< hash_int >
404                 ,co::item_counter< simple_item_counter >
405                 ,ci::split_list::dynamic_bucket_table<false>
406                 ,co::stat< ci::split_list::stat<> >
407             >::type
408         > set;
409
410         test_int_nogc<set>();
411     }
412
413 } // namespace set