Added copyright and license
[libcds.git] / tests / test-hdr / set / hdr_skiplist_set_rcu_gpb.cpp
1 /*
2     This file is a part of libcds - Concurrent Data Structures library
3
4     (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
5
6     Source code repo: http://github.com/khizmax/libcds/
7     Download: http://sourceforge.net/projects/libcds/files/
8     
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions are met:
11
12     * Redistributions of source code must retain the above copyright notice, this
13       list of conditions and the following disclaimer.
14
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.
18
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.     
29 */
30
31 #include "set/hdr_skiplist_set_rcu.h"
32
33 #include <cds/urcu/general_buffered.h>
34 #include <cds/container/skip_list_set_rcu.h>
35
36 #include "unit/michael_alloc.h"
37 #include "map/print_skiplist_stat.h"
38
39 namespace set {
40     namespace {
41         typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
42     }
43
44     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_less()
45     {
46         struct set_traits : public cc::skip_list::traits
47         {
48             typedef SkipListSetRCUHdrTest::less<item> less;
49             typedef simple_item_counter item_counter;
50         };
51         typedef cc::SkipListSet< rcu_type, item, set_traits > set;
52         test< set, misc::print_skiplist_stat<set::stat> >();
53     }
54
55     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_cmp()
56     {
57         typedef cc::SkipListSet< rcu_type, item,
58             cc::skip_list::make_traits<
59             co::compare< cmp<item > >
60             ,co::item_counter< simple_item_counter >
61             >::type
62         > set;
63         test< set, misc::print_skiplist_stat<set::stat> >();
64     }
65
66     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_cmpless()
67     {
68         typedef cc::SkipListSet< rcu_type, item,
69             cc::skip_list::make_traits<
70             co::less< less<item > >
71             ,co::compare< cmp<item > >
72             ,co::item_counter< simple_item_counter >
73             >::type
74         > set;
75         test< set, misc::print_skiplist_stat<set::stat> >();
76     }
77
78     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_less_stat()
79     {
80         typedef cc::SkipListSet< rcu_type, item,
81             cc::skip_list::make_traits<
82                 co::less< less<item > >
83                 ,co::item_counter< simple_item_counter >
84                 ,co::stat< cc::skip_list::stat<> >
85             >::type
86         > set;
87         test< set, misc::print_skiplist_stat<set::stat> >();
88     }
89
90     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_cmp_stat()
91     {
92         typedef cc::SkipListSet< rcu_type, item,
93             cc::skip_list::make_traits<
94                 co::compare< cmp<item > >
95                 ,co::item_counter< simple_item_counter >
96                 ,co::stat< cc::skip_list::stat<> >
97             >::type
98         > set;
99         test< set, misc::print_skiplist_stat<set::stat> >();
100     }
101
102     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_cmpless_stat()
103     {
104         typedef cc::SkipListSet< rcu_type, item,
105             cc::skip_list::make_traits<
106                 co::less< less<item > >
107                 ,co::compare< cmp<item > >
108                 ,co::item_counter< simple_item_counter >
109                 ,co::stat< cc::skip_list::stat<> >
110             >::type
111         > set;
112         test< set, misc::print_skiplist_stat<set::stat> >();
113     }
114
115     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_xorshift_less()
116     {
117         typedef cc::SkipListSet< rcu_type, item,
118             cc::skip_list::make_traits<
119                 co::less< less<item > >
120                 ,co::item_counter< simple_item_counter >
121                 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
122             >::type
123         > set;
124         test< set, misc::print_skiplist_stat<set::stat> >();
125     }
126
127     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_xorshift_cmp()
128     {
129         typedef cc::SkipListSet< rcu_type, item,
130             cc::skip_list::make_traits<
131                 co::compare< cmp<item > >
132                 ,co::item_counter< simple_item_counter >
133                 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
134             >::type
135         > set;
136         test< set, misc::print_skiplist_stat<set::stat> >();
137     }
138
139     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_xorshift_cmpless()
140     {
141         typedef cc::SkipListSet< rcu_type, item,
142             cc::skip_list::make_traits<
143                 co::less< less<item > >
144                 ,co::compare< cmp<item > >
145                 ,co::item_counter< simple_item_counter >
146                 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
147             >::type
148         > set;
149         test< set, misc::print_skiplist_stat<set::stat> >();
150     }
151
152     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_xorshift_less_stat()
153     {
154         typedef cc::SkipListSet< rcu_type, item,
155             cc::skip_list::make_traits<
156                 co::less< less<item > >
157                 ,co::item_counter< simple_item_counter >
158                 ,co::stat< cc::skip_list::stat<> >
159                 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
160             >::type
161         > set;
162         test< set, misc::print_skiplist_stat<set::stat> >();
163     }
164
165     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_xorshift_cmp_stat()
166     {
167         typedef cc::SkipListSet< rcu_type, item,
168             cc::skip_list::make_traits<
169                 co::compare< cmp<item > >
170                 ,co::item_counter< simple_item_counter >
171                 ,co::stat< cc::skip_list::stat<> >
172                 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
173             >::type
174         > set;
175         test< set, misc::print_skiplist_stat<set::stat> >();
176     }
177
178     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_xorshift_cmpless_stat()
179     {
180         typedef cc::SkipListSet< rcu_type, item,
181             cc::skip_list::make_traits<
182                 co::less< less<item > >
183                 ,co::compare< cmp<item > >
184                 ,co::item_counter< simple_item_counter >
185                 ,co::stat< cc::skip_list::stat<> >
186                 ,cc::skip_list::random_level_generator< cc::skip_list::xorshift >
187             >::type
188         > set;
189         test< set, misc::print_skiplist_stat<set::stat> >();
190     }
191
192     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_turbopas_less()
193     {
194         typedef cc::SkipListSet< rcu_type, item,
195             cc::skip_list::make_traits<
196                 co::less< less<item > >
197                 ,co::item_counter< simple_item_counter >
198                 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
199             >::type
200         > set;
201         test< set, misc::print_skiplist_stat<set::stat> >();
202     }
203
204     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_turbopas_cmp()
205     {
206         typedef cc::SkipListSet< rcu_type, item,
207             cc::skip_list::make_traits<
208                 co::compare< cmp<item > >
209                 ,co::item_counter< simple_item_counter >
210                 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
211             >::type
212         > set;
213         test< set, misc::print_skiplist_stat<set::stat> >();
214     }
215
216     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_turbopas_cmpless()
217     {
218         typedef cc::SkipListSet< rcu_type, item,
219             cc::skip_list::make_traits<
220                 co::less< less<item > >
221                 ,co::compare< cmp<item > >
222                 ,co::item_counter< simple_item_counter >
223                 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
224             >::type
225         > set;
226         test< set, misc::print_skiplist_stat<set::stat> >();
227     }
228
229     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_turbopas_less_stat()
230     {
231         typedef cc::SkipListSet< rcu_type, item,
232             cc::skip_list::make_traits<
233                 co::less< less<item > >
234                 ,co::item_counter< simple_item_counter >
235                 ,co::stat< cc::skip_list::stat<> >
236                 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
237             >::type
238         > set;
239         test< set, misc::print_skiplist_stat<set::stat> >();
240     }
241
242     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_turbopas_cmp_stat()
243     {
244         typedef cc::SkipListSet< rcu_type, item,
245             cc::skip_list::make_traits<
246                 co::compare< cmp<item > >
247                 ,co::item_counter< simple_item_counter >
248                 ,co::stat< cc::skip_list::stat<> >
249                 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
250             >::type
251         > set;
252         test< set, misc::print_skiplist_stat<set::stat> >();
253     }
254
255     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_turbopas_cmpless_stat()
256     {
257         typedef cc::SkipListSet< rcu_type, item,
258             cc::skip_list::make_traits<
259                 co::less< less<item > >
260                 ,co::compare< cmp<item > >
261                 ,co::item_counter< simple_item_counter >
262                 ,co::stat< cc::skip_list::stat<> >
263                 ,cc::skip_list::random_level_generator< cc::skip_list::turbo_pascal >
264             >::type
265         > set;
266         test< set, misc::print_skiplist_stat<set::stat> >();
267     }
268
269     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_michaelalloc_less()
270     {
271         typedef cc::SkipListSet< rcu_type, item,
272             cc::skip_list::make_traits<
273                 co::less< less<item > >
274                 ,co::item_counter< simple_item_counter >
275                 ,co::allocator< memory::MichaelAllocator<int> >
276             >::type
277         > set;
278         test< set, misc::print_skiplist_stat<set::stat> >();
279     }
280
281     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_michaelalloc_cmp()
282     {
283         typedef cc::SkipListSet< rcu_type, item,
284             cc::skip_list::make_traits<
285                 co::compare< cmp<item > >
286                 ,co::item_counter< simple_item_counter >
287                 ,co::allocator< memory::MichaelAllocator<int> >
288             >::type
289         > set;
290         test< set, misc::print_skiplist_stat<set::stat> >();
291     }
292
293     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_michaelalloc_cmpless()
294     {
295         typedef cc::SkipListSet< rcu_type, item,
296             cc::skip_list::make_traits<
297                 co::less< less<item > >
298                 ,co::compare< cmp<item > >
299                 ,co::item_counter< simple_item_counter >
300                 ,co::allocator< memory::MichaelAllocator<int> >
301             >::type
302         > set;
303         test< set, misc::print_skiplist_stat<set::stat> >();
304     }
305
306     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_michaelalloc_less_stat()
307     {
308         typedef cc::SkipListSet< rcu_type, item,
309             cc::skip_list::make_traits<
310                 co::less< less<item > >
311                 ,co::item_counter< simple_item_counter >
312                 ,co::stat< cc::skip_list::stat<> >
313                 ,co::allocator< memory::MichaelAllocator<int> >
314             >::type
315         > set;
316         test< set, misc::print_skiplist_stat<set::stat> >();
317     }
318
319     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_michaelalloc_cmp_stat()
320     {
321         typedef cc::SkipListSet< rcu_type, item,
322             cc::skip_list::make_traits<
323                 co::compare< cmp<item > >
324                 ,co::item_counter< simple_item_counter >
325                 ,co::stat< cc::skip_list::stat<> >
326                 ,co::allocator< memory::MichaelAllocator<int> >
327             >::type
328         > set;
329         test< set, misc::print_skiplist_stat<set::stat> >();
330     }
331
332     void SkipListSetRCUHdrTest::SkipList_RCU_GPB_michaelalloc_cmpless_stat()
333     {
334         typedef cc::SkipListSet< rcu_type, item,
335             cc::skip_list::make_traits<
336                 co::less< less<item > >
337                 ,co::compare< cmp<item > >
338                 ,co::item_counter< simple_item_counter >
339                 ,co::stat< cc::skip_list::stat<> >
340                 ,co::allocator< memory::MichaelAllocator<int> >
341             >::type
342         > set;
343         test< set, misc::print_skiplist_stat<set::stat> >();
344     }
345 } // namespace set