fixed adding file problem
[c11concurrency-benchmarks.git] / gdax-orderbook-hpp / demo / dependencies / libcds-2.3.2 / test / unit / intrusive-set / intrusive_skiplist_nogc.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-2017
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 "test_intrusive_set_nogc.h"
32
33 #include <cds/intrusive/skip_list_nogc.h>
34
35 namespace {
36     namespace ci = cds::intrusive;
37     typedef cds::gc::nogc gc_type;
38
39     class IntrusiveSkipListSet_NoGC : public cds_test::intrusive_set_nogc
40     {
41     protected:
42         typedef cds_test::intrusive_set_nogc base_class;
43
44     protected:
45         typedef typename base_class::base_int_item< ci::skip_list::node< gc_type>>   base_item_type;
46         typedef typename base_class::member_int_item< ci::skip_list::node< gc_type>> member_item_type;
47
48         //void SetUp()
49         //{}
50
51         //void TearDown()
52         //{}
53     };
54
55
56     TEST_F( IntrusiveSkipListSet_NoGC, base_cmp )
57     {
58         struct traits : public ci::skip_list::traits
59         {
60             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
61             typedef mock_disposer disposer;
62             typedef cmp<base_item_type> compare;
63         };
64
65         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
66
67         set_type s;
68         test( s );
69     }
70
71     TEST_F( IntrusiveSkipListSet_NoGC, base_less )
72     {
73         struct traits : public ci::skip_list::traits
74         {
75             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
76             typedef mock_disposer disposer;
77             typedef base_class::less<base_item_type> less;
78             typedef cds::atomicity::item_counter item_counter;
79         };
80
81         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
82
83         set_type s;
84         test( s );
85     }
86
87     TEST_F( IntrusiveSkipListSet_NoGC, base_cmpmix )
88     {
89         struct traits : public ci::skip_list::traits
90         {
91             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
92             typedef mock_disposer disposer;
93             typedef cmp<base_item_type> compare;
94             typedef base_class::less<base_item_type> less;
95             typedef ci::skip_list::stat<> stat;
96         };
97
98         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
99
100         set_type s;
101         test( s );
102     }
103
104     TEST_F( IntrusiveSkipListSet_NoGC, base_xorshift32 )
105     {
106         struct traits : public ci::skip_list::traits
107         {
108             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
109             typedef mock_disposer disposer;
110             typedef cmp<base_item_type> compare;
111             typedef ci::skip_list::xorshift32 random_level_generator;
112         };
113
114         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
115
116         set_type s;
117         test( s );
118     }
119
120     TEST_F( IntrusiveSkipListSet_NoGC, base_xorshift24 )
121     {
122         struct traits: public ci::skip_list::traits
123         {
124             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
125             typedef mock_disposer disposer;
126             typedef cmp<base_item_type> compare;
127             typedef ci::skip_list::xorshift24 random_level_generator;
128         };
129
130         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
131
132         set_type s;
133         test( s );
134     }
135
136     TEST_F( IntrusiveSkipListSet_NoGC, base_xorshift16 )
137     {
138         struct traits: public ci::skip_list::traits
139         {
140             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
141             typedef mock_disposer disposer;
142             typedef cmp<base_item_type> compare;
143             typedef ci::skip_list::xorshift16 random_level_generator;
144         };
145
146         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
147
148         set_type s;
149         test( s );
150     }
151
152     TEST_F( IntrusiveSkipListSet_NoGC, base_turbo32 )
153     {
154         struct traits: public ci::skip_list::traits
155         {
156             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
157             typedef mock_disposer disposer;
158             typedef cmp<base_item_type> compare;
159             typedef ci::skip_list::turbo32 random_level_generator;
160         };
161
162         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
163
164         set_type s;
165         test( s );
166     }
167
168     TEST_F( IntrusiveSkipListSet_NoGC, base_turbo24 )
169     {
170         struct traits: public ci::skip_list::traits
171         {
172             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
173             typedef mock_disposer disposer;
174             typedef cmp<base_item_type> compare;
175             typedef ci::skip_list::turbo24 random_level_generator;
176         };
177
178         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
179
180         set_type s;
181         test( s );
182     }
183
184     TEST_F( IntrusiveSkipListSet_NoGC, base_turbo16 )
185     {
186         struct traits: public ci::skip_list::traits
187         {
188             typedef ci::skip_list::base_hook< ci::opt::gc< gc_type >> hook;
189             typedef mock_disposer disposer;
190             typedef cmp<base_item_type> compare;
191             typedef ci::skip_list::turbo16 random_level_generator;
192         };
193
194         typedef ci::SkipListSet< gc_type, base_item_type, traits > set_type;
195
196         set_type s;
197         test( s );
198     }
199
200     TEST_F( IntrusiveSkipListSet_NoGC, member_cmp )
201     {
202         struct traits : public ci::skip_list::traits
203         {
204             typedef ci::skip_list::member_hook< offsetof(member_item_type, hMember), ci::opt::gc< gc_type >> hook;
205             typedef mock_disposer disposer;
206             typedef cmp<member_item_type> compare;
207         };
208
209         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
210
211         set_type s;
212         test( s );
213     }
214
215     TEST_F( IntrusiveSkipListSet_NoGC, member_less )
216     {
217         struct traits : public ci::skip_list::traits
218         {
219             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
220             typedef mock_disposer disposer;
221             typedef base_class::less<member_item_type> less;
222             typedef cds::atomicity::item_counter item_counter;
223             typedef ci::opt::v::sequential_consistent memory_model;
224         };
225
226         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
227
228         set_type s;
229         test( s );
230     }
231
232     TEST_F( IntrusiveSkipListSet_NoGC, member_cmpmix )
233     {
234         struct traits : public ci::skip_list::traits
235         {
236             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
237             typedef mock_disposer disposer;
238             typedef cmp<member_item_type> compare;
239             typedef base_class::less<member_item_type> less;
240             typedef ci::skip_list::stat<> stat;
241         };
242
243         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
244
245         set_type s;
246         test( s );
247     }
248
249     TEST_F( IntrusiveSkipListSet_NoGC, member_xorshift32 )
250     {
251         struct traits : public ci::skip_list::traits
252         {
253             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
254             typedef mock_disposer disposer;
255             typedef cmp<member_item_type> compare;
256             typedef ci::skip_list::xorshift32 random_level_generator;
257         };
258
259         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
260
261         set_type s;
262         test( s );
263     }
264
265     TEST_F( IntrusiveSkipListSet_NoGC, member_xorshift24 )
266     {
267         struct traits: public ci::skip_list::traits
268         {
269             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
270             typedef mock_disposer disposer;
271             typedef cmp<member_item_type> compare;
272             typedef ci::skip_list::xorshift24 random_level_generator;
273         };
274
275         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
276
277         set_type s;
278         test( s );
279     }
280
281     TEST_F( IntrusiveSkipListSet_NoGC, member_xorshift16 )
282     {
283         struct traits: public ci::skip_list::traits
284         {
285             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
286             typedef mock_disposer disposer;
287             typedef cmp<member_item_type> compare;
288             typedef ci::skip_list::xorshift16 random_level_generator;
289         };
290
291         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
292
293         set_type s;
294         test( s );
295     }
296
297     TEST_F( IntrusiveSkipListSet_NoGC, member_turbo32 )
298     {
299         struct traits: public ci::skip_list::traits
300         {
301             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
302             typedef mock_disposer disposer;
303             typedef cmp<member_item_type> compare;
304             typedef ci::skip_list::turbo32 random_level_generator;
305         };
306
307         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
308
309         set_type s;
310         test( s );
311     }
312
313     TEST_F( IntrusiveSkipListSet_NoGC, member_turbo24 )
314     {
315         struct traits: public ci::skip_list::traits
316         {
317             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
318             typedef mock_disposer disposer;
319             typedef cmp<member_item_type> compare;
320             typedef ci::skip_list::turbo24 random_level_generator;
321         };
322
323         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
324
325         set_type s;
326         test( s );
327     }
328
329     TEST_F( IntrusiveSkipListSet_NoGC, member_turbo16 )
330     {
331         struct traits: public ci::skip_list::traits
332         {
333             typedef ci::skip_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc< gc_type >> hook;
334             typedef mock_disposer disposer;
335             typedef cmp<member_item_type> compare;
336             typedef ci::skip_list::turbo16 random_level_generator;
337         };
338
339         typedef ci::SkipListSet< gc_type, member_item_type, traits > set_type;
340
341         set_type s;
342         test( s );
343     }
344
345 } // namespace