Added copyright and license
[libcds.git] / tests / test-hdr / map / hdr_skiplist_map_rcu_gpt.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 "map/hdr_skiplist_map_rcu.h"
32
33 #include <cds/urcu/general_threaded.h>
34 #include <cds/container/skip_list_map_rcu.h>
35
36 #include "unit/michael_alloc.h"
37 #include "map/print_skiplist_stat.h"
38
39 namespace map {
40     namespace {
41         typedef cds::urcu::gc< cds::urcu::general_threaded<> > rcu_type;
42     }
43
44     void SkipListMapRCUHdrTest::SkipList_RCU_GPT_less()
45     {
46         typedef cc::SkipListMap< rcu_type, key_type, value_type,
47             cc::skip_list::make_traits<
48                 co::less< less >
49                 ,co::item_counter< simple_item_counter >
50             >::type
51         > set;
52         test< set, misc::print_skiplist_stat<set::stat> >();
53     }
54
55     void SkipListMapRCUHdrTest::SkipList_RCU_GPT_cmp()
56     {
57         typedef cc::SkipListMap< rcu_type, key_type, value_type,
58             cc::skip_list::make_traits<
59                 co::compare< cmp >
60                 ,co::item_counter< simple_item_counter >
61             >::type
62         > set;
63         test< set, misc::print_skiplist_stat<set::stat> >();
64     }
65
66     void SkipListMapRCUHdrTest::SkipList_RCU_GPT_cmpless()
67     {
68         typedef cc::SkipListMap< rcu_type, key_type, value_type,
69             cc::skip_list::make_traits<
70                 co::less< less >
71                 ,co::compare< cmp >
72                 ,co::item_counter< simple_item_counter >
73             >::type
74         > set;
75         test< set, misc::print_skiplist_stat<set::stat> >();
76     }
77
78     void SkipListMapRCUHdrTest::SkipList_RCU_GPT_less_stat()
79     {
80         typedef cc::SkipListMap< rcu_type, key_type, value_type,
81             cc::skip_list::make_traits<
82                 co::less< less >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_cmp_stat()
91     {
92         typedef cc::SkipListMap< rcu_type, key_type, value_type,
93             cc::skip_list::make_traits<
94                 co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_cmpless_stat()
103     {
104         typedef cc::SkipListMap< rcu_type, key_type, value_type,
105             cc::skip_list::make_traits<
106                 co::less< less >
107                 ,co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_xorshift_less()
116     {
117         typedef cc::SkipListMap< rcu_type, key_type, value_type,
118             cc::skip_list::make_traits<
119                 co::less< less >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_xorshift_cmp()
128     {
129         typedef cc::SkipListMap< rcu_type, key_type, value_type,
130             cc::skip_list::make_traits<
131                 co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_xorshift_cmpless()
140     {
141         typedef cc::SkipListMap< rcu_type, key_type, value_type,
142             cc::skip_list::make_traits<
143                 co::less< less >
144                 ,co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_xorshift_less_stat()
153     {
154         typedef cc::SkipListMap< rcu_type, key_type, value_type,
155             cc::skip_list::make_traits<
156                 co::less< less >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_xorshift_cmp_stat()
166     {
167         typedef cc::SkipListMap< rcu_type, key_type, value_type,
168             cc::skip_list::make_traits<
169                 co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_xorshift_cmpless_stat()
179     {
180         typedef cc::SkipListMap< rcu_type, key_type, value_type,
181             cc::skip_list::make_traits<
182                 co::less< less >
183                 ,co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_turbopas_less()
193     {
194         typedef cc::SkipListMap< rcu_type, key_type, value_type,
195             cc::skip_list::make_traits<
196                 co::less< less >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_turbopas_cmp()
205     {
206         typedef cc::SkipListMap< rcu_type, key_type, value_type,
207             cc::skip_list::make_traits<
208                 co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_turbopas_cmpless()
217     {
218         typedef cc::SkipListMap< rcu_type, key_type, value_type,
219             cc::skip_list::make_traits<
220                 co::less< less >
221                 ,co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_turbopas_less_stat()
230     {
231         typedef cc::SkipListMap< rcu_type, key_type, value_type,
232             cc::skip_list::make_traits<
233                 co::less< less >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_turbopas_cmp_stat()
243     {
244         typedef cc::SkipListMap< rcu_type, key_type, value_type,
245             cc::skip_list::make_traits<
246                 co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_turbopas_cmpless_stat()
256     {
257         typedef cc::SkipListMap< rcu_type, key_type, value_type,
258             cc::skip_list::make_traits<
259                 co::less< less >
260                 ,co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_michaelalloc_less()
270     {
271         typedef cc::SkipListMap< rcu_type, key_type, value_type,
272             cc::skip_list::make_traits<
273                 co::less< less >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_michaelalloc_cmp()
282     {
283             typedef cc::SkipListMap< rcu_type, key_type, value_type,
284                 cc::skip_list::make_traits<
285                     co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_michaelalloc_cmpless()
294     {
295         typedef cc::SkipListMap< rcu_type, key_type, value_type,
296             cc::skip_list::make_traits<
297                 co::less< less >
298                 ,co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_michaelalloc_less_stat()
307     {
308         typedef cc::SkipListMap< rcu_type, key_type, value_type,
309             cc::skip_list::make_traits<
310                 co::less< less >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_michaelalloc_cmp_stat()
320     {
321         typedef cc::SkipListMap< rcu_type, key_type, value_type,
322             cc::skip_list::make_traits<
323                 co::compare< cmp >
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 SkipListMapRCUHdrTest::SkipList_RCU_GPT_michaelalloc_cmpless_stat()
333     {
334         typedef cc::SkipListMap< rcu_type, key_type, value_type,
335             cc::skip_list::make_traits<
336                 co::less< less >
337                 ,co::compare< cmp >
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 map