rename michael_list_ptb.h to michael_list_dhp.h
[libcds.git] / tests / test-hdr / set / hdr_intrusive_splitlist_set_ptb.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_set.h"
4 #include <cds/intrusive/michael_list_dhp.h>
5 #include <cds/intrusive/split_list.h>
6
7 namespace set {
8
9     void IntrusiveHashSetHdrTest::split_dyn_PTB_base_cmp()
10     {
11         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
12         typedef ci::MichaelList< cds::gc::PTB
13             ,item
14             ,ci::michael_list::make_traits<
15                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::PTB> > >
16                 ,co::compare< cmp<item> >
17                 ,ci::opt::disposer< faked_disposer >
18             >::type
19         >    ord_list;
20
21         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
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         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
29
30         test_int<set>();
31     }
32
33     void IntrusiveHashSetHdrTest::split_dyn_PTB_base_less()
34     {
35         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
36         typedef ci::MichaelList< cds::gc::PTB
37             ,item
38             ,ci::michael_list::make_traits<
39                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::PTB> > >
40                 ,co::less< less<item> >
41                 ,ci::opt::disposer< faked_disposer >
42             >::type
43         >    ord_list;
44
45         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
46             ci::split_list::make_traits<
47                 co::hash< hash_int >
48                 ,co::memory_model<co::v::sequential_consistent>
49             >::type
50         > set;
51         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
52
53         test_int<set>();
54     }
55
56     void IntrusiveHashSetHdrTest::split_dyn_PTB_base_cmpmix()
57     {
58         typedef base_int_item< ci::split_list::node<ci::michael_list::node<cds::gc::PTB> > > item;
59         typedef ci::MichaelList< cds::gc::PTB
60             ,item
61             ,ci::michael_list::make_traits<
62                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::PTB> > >
63                 ,co::less< less<item> >
64                 ,co::compare< cmp<item> >
65                 ,ci::opt::disposer< faked_disposer >
66             >::type
67         >    ord_list;
68
69         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
70             ci::split_list::make_traits<
71                 co::hash< hash_int >
72                 ,co::item_counter< simple_item_counter >
73                 ,ci::split_list::dynamic_bucket_table<true>
74             >::type
75         > set;
76         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
77
78         test_int<set>();
79     }
80
81     void IntrusiveHashSetHdrTest::split_dyn_PTB_member_cmp()
82     {
83         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
84         typedef ci::MichaelList< cds::gc::PTB
85             ,item
86             ,ci::michael_list::make_traits<
87                 ci::opt::hook< ci::michael_list::member_hook<
88                     offsetof( item, hMember ),
89                     co::gc<cds::gc::PTB>
90                 > >
91                 ,co::compare< cmp<item> >
92                 ,ci::opt::disposer< faked_disposer >
93             >::type
94         >    ord_list;
95
96         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
97             ci::split_list::make_traits<
98                 co::hash< hash_int >
99             >::type
100         > set;
101         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
102
103         test_int<set>();
104     }
105
106     void IntrusiveHashSetHdrTest::split_dyn_PTB_member_less()
107     {
108         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
109         typedef ci::MichaelList< cds::gc::PTB
110             ,item
111             ,ci::michael_list::make_traits<
112                 ci::opt::hook< ci::michael_list::member_hook<
113                     offsetof( item, hMember ),
114                     co::gc<cds::gc::PTB>
115                 > >
116                 ,co::less< less<item> >
117                 ,ci::opt::disposer< faked_disposer >
118             >::type
119         >    ord_list;
120
121         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
122             ci::split_list::make_traits<
123                 co::hash< hash_int >
124                 ,co::memory_model<co::v::relaxed_ordering>
125             >::type
126         > set;
127         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
128
129         test_int<set>();
130     }
131
132     void IntrusiveHashSetHdrTest::split_dyn_PTB_member_cmpmix()
133     {
134         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
135         typedef ci::MichaelList< cds::gc::PTB
136             ,item
137             ,ci::michael_list::make_traits<
138                 ci::opt::hook< ci::michael_list::member_hook<
139                     offsetof( item, hMember ),
140                     co::gc<cds::gc::PTB>
141                 > >
142                 ,co::compare< cmp<item> >
143                 ,co::less< less<item> >
144                 ,ci::opt::disposer< faked_disposer >
145             >::type
146         >    ord_list;
147
148         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
149             ci::split_list::make_traits<
150                 co::hash< hash_int >
151                 ,co::item_counter< simple_item_counter >
152                 ,co::memory_model<co::v::sequential_consistent>
153             >::type
154         > set;
155         static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
156
157         test_int<set>();
158     }
159
160
161     // Static bucket table
162     void IntrusiveHashSetHdrTest::split_st_PTB_base_cmp()
163     {
164         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
165         typedef ci::MichaelList< cds::gc::PTB
166             ,item
167             ,ci::michael_list::make_traits<
168                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::PTB> > >
169                 ,co::compare< cmp<item> >
170                 ,ci::opt::disposer< faked_disposer >
171             >::type
172         >    ord_list;
173
174         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
175             ci::split_list::make_traits<
176                 co::hash< hash_int >
177                 ,ci::split_list::dynamic_bucket_table<false>
178                 ,co::memory_model<co::v::relaxed_ordering>
179             >::type
180         > set;
181         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
182
183         test_int<set>();
184     }
185
186     void IntrusiveHashSetHdrTest::split_st_PTB_base_less()
187     {
188         typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
189         typedef ci::MichaelList< cds::gc::PTB
190             ,item
191             ,ci::michael_list::make_traits<
192                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::PTB> > >
193                 ,co::less< less<item> >
194                 ,ci::opt::disposer< faked_disposer >
195             >::type
196         >    ord_list;
197
198         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
199             ci::split_list::make_traits<
200                 co::hash< hash_int >
201                 ,ci::split_list::dynamic_bucket_table<false>
202                 ,co::memory_model<co::v::sequential_consistent>
203             >::type
204         > set;
205         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
206
207         test_int<set>();
208     }
209
210     void IntrusiveHashSetHdrTest::split_st_PTB_base_cmpmix()
211     {
212         typedef base_int_item< ci::split_list::node<ci::michael_list::node<cds::gc::PTB> > > item;
213         typedef ci::MichaelList< cds::gc::PTB
214             ,item
215             ,ci::michael_list::make_traits<
216                 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::PTB> > >
217                 ,co::less< less<item> >
218                 ,co::compare< cmp<item> >
219                 ,ci::opt::disposer< faked_disposer >
220             >::type
221         >    ord_list;
222
223         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
224             ci::split_list::make_traits<
225                 co::hash< hash_int >
226                 ,co::item_counter< simple_item_counter >
227                 ,ci::split_list::dynamic_bucket_table<false>
228             >::type
229         > set;
230         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
231
232         test_int<set>();
233     }
234
235     void IntrusiveHashSetHdrTest::split_st_PTB_member_cmp()
236     {
237         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
238         typedef ci::MichaelList< cds::gc::PTB
239             ,item
240             ,ci::michael_list::make_traits<
241                 ci::opt::hook< ci::michael_list::member_hook<
242                     offsetof( item, hMember ),
243                     co::gc<cds::gc::PTB>
244                 > >
245                 ,co::compare< cmp<item> >
246                 ,ci::opt::disposer< faked_disposer >
247             >::type
248         >    ord_list;
249
250         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
251             ci::split_list::make_traits<
252                 co::hash< hash_int >
253                 ,ci::split_list::dynamic_bucket_table<false>
254                 ,co::memory_model<co::v::relaxed_ordering>
255             >::type
256         > set;
257         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
258
259         test_int<set>();
260     }
261
262     void IntrusiveHashSetHdrTest::split_st_PTB_member_less()
263     {
264         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
265         typedef ci::MichaelList< cds::gc::PTB
266             ,item
267             ,ci::michael_list::make_traits<
268                 ci::opt::hook< ci::michael_list::member_hook<
269                     offsetof( item, hMember ),
270                     co::gc<cds::gc::PTB>
271                 > >
272                 ,co::less< less<item> >
273                 ,ci::opt::disposer< faked_disposer >
274             >::type
275         >    ord_list;
276
277         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
278             ci::split_list::make_traits<
279                 ci::split_list::dynamic_bucket_table<false>
280                 ,co::hash< hash_int >
281                 ,co::memory_model<co::v::sequential_consistent>
282             >::type
283         > set;
284         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
285
286         test_int<set>();
287     }
288
289     void IntrusiveHashSetHdrTest::split_st_PTB_member_cmpmix()
290     {
291         typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::PTB> > > item;
292         typedef ci::MichaelList< cds::gc::PTB
293             ,item
294             ,ci::michael_list::make_traits<
295                 ci::opt::hook< ci::michael_list::member_hook<
296                     offsetof( item, hMember ),
297                     co::gc<cds::gc::PTB>
298                 > >
299                 ,co::compare< cmp<item> >
300                 ,co::less< less<item> >
301                 ,ci::opt::disposer< faked_disposer >
302             >::type
303         >    ord_list;
304
305         typedef ci::SplitListSet< cds::gc::PTB, ord_list,
306             ci::split_list::make_traits<
307                 co::hash< hash_int >
308                 ,co::item_counter< simple_item_counter >
309                 ,ci::split_list::dynamic_bucket_table<false>
310             >::type
311         > set;
312         static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
313
314         test_int<set>();
315     }
316
317
318 } // namespace set