2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
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.
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.
31 #include "test_intrusive_set_nogc.h"
33 #include <cds/intrusive/michael_list_nogc.h>
34 #include <cds/intrusive/michael_set_nogc.h>
37 namespace ci = cds::intrusive;
38 typedef cds::gc::nogc gc_type;
40 class IntrusiveMichaelSet_NoGC : public cds_test::intrusive_set_nogc
43 typedef cds_test::intrusive_set_nogc base_class;
46 typedef typename base_class::base_int_item< ci::michael_list::node<gc_type>> base_item_type;
47 typedef typename base_class::member_int_item< ci::michael_list::node<gc_type>> member_item_type;
57 TEST_F( IntrusiveMichaelSet_NoGC, base_cmp )
59 typedef ci::MichaelList< gc_type
61 ,ci::michael_list::make_traits<
62 ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type > > >
63 ,ci::opt::compare< cmp<base_item_type> >
64 ,ci::opt::disposer< mock_disposer >
68 typedef ci::MichaelHashSet< gc_type, bucket_type,
69 ci::michael_set::make_traits<
70 ci::opt::hash< hash_int >
74 set_type s( kSize, 2 );
78 TEST_F( IntrusiveMichaelSet_NoGC, base_less )
80 typedef ci::MichaelList< gc_type
82 ,ci::michael_list::make_traits<
83 ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type >>>
84 ,ci::opt::less< less<base_item_type> >
85 ,ci::opt::disposer< mock_disposer >
89 typedef ci::MichaelHashSet< gc_type, bucket_type,
90 ci::michael_set::make_traits<
91 ci::opt::hash< hash_int >
95 set_type s( kSize, 2 );
99 TEST_F( IntrusiveMichaelSet_NoGC, base_cmpmix )
101 struct list_traits : public ci::michael_list::traits
103 typedef ci::michael_list::base_hook< ci::opt::gc<gc_type>> hook;
104 typedef base_class::less<base_item_type> less;
105 typedef cmp<base_item_type> compare;
106 typedef mock_disposer disposer;
108 typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type;
110 struct set_traits : public ci::michael_set::traits
112 typedef hash_int hash;
113 typedef simple_item_counter item_counter;
115 typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
117 set_type s( kSize, 2 );
121 TEST_F( IntrusiveMichaelSet_NoGC, base_stat )
123 struct list_traits: public ci::michael_list::traits
125 typedef ci::michael_list::base_hook< ci::opt::gc<gc_type>> hook;
126 typedef base_class::less<base_item_type> less;
127 typedef mock_disposer disposer;
128 typedef ci::michael_list::stat<> stat;
130 typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type;
132 struct set_traits: public ci::michael_set::traits
134 typedef hash_int hash;
135 typedef simple_item_counter item_counter;
137 typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
139 set_type s( kSize, 2 );
143 TEST_F( IntrusiveMichaelSet_NoGC, base_wrapped_stat )
145 struct list_traits: public ci::michael_list::traits
147 typedef ci::michael_list::base_hook< ci::opt::gc<gc_type>> hook;
148 typedef base_class::less<base_item_type> less;
149 typedef mock_disposer disposer;
150 typedef ci::michael_list::wrapped_stat<> stat;
152 typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type;
154 struct set_traits: public ci::michael_set::traits
156 typedef hash_int hash;
157 typedef simple_item_counter item_counter;
159 typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
161 set_type s( kSize, 2 );
165 TEST_F( IntrusiveMichaelSet_NoGC, member_cmp )
167 typedef ci::MichaelList< gc_type
169 ,ci::michael_list::make_traits<
170 ci::opt::hook< ci::michael_list::member_hook<
171 offsetof( member_item_type, hMember ),
174 ,ci::opt::compare< cmp<member_item_type> >
175 ,ci::opt::disposer< mock_disposer >
179 typedef ci::MichaelHashSet< gc_type, bucket_type,
180 ci::michael_set::make_traits<
181 ci::opt::hash< hash_int >
185 set_type s( kSize, 2 );
189 TEST_F( IntrusiveMichaelSet_NoGC, member_less )
191 typedef ci::MichaelList< gc_type
193 ,ci::michael_list::make_traits<
194 ci::opt::hook< ci::michael_list::member_hook<
195 offsetof( member_item_type, hMember ),
198 ,ci::opt::less< less<member_item_type> >
199 ,ci::opt::disposer< mock_disposer >
203 typedef ci::MichaelHashSet< gc_type, bucket_type,
204 ci::michael_set::make_traits<
205 ci::opt::hash< hash_int >
209 set_type s( kSize, 2 );
213 TEST_F( IntrusiveMichaelSet_NoGC, member_cmpmix )
215 struct list_traits : public ci::michael_list::traits
217 typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
218 typedef base_class::less<member_item_type> less;
219 typedef cmp<member_item_type> compare;
220 typedef mock_disposer disposer;
222 typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type;
224 struct set_traits : public ci::michael_set::traits
226 typedef hash_int hash;
227 typedef simple_item_counter item_counter;
229 typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
231 set_type s( kSize, 2 );
235 TEST_F( IntrusiveMichaelSet_NoGC, member_stat )
237 struct list_traits: public ci::michael_list::traits
239 typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
240 typedef cmp<member_item_type> compare;
241 typedef mock_disposer disposer;
242 typedef ci::michael_list::stat<> stat;
244 typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type;
246 struct set_traits: public ci::michael_set::traits
248 typedef hash_int hash;
249 typedef simple_item_counter item_counter;
251 typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
253 set_type s( kSize, 2 );
257 TEST_F( IntrusiveMichaelSet_NoGC, member_wrapped_stat )
259 struct list_traits: public ci::michael_list::traits
261 typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
262 typedef cmp<member_item_type> compare;
263 typedef mock_disposer disposer;
264 typedef ci::michael_list::wrapped_stat<> stat;
266 typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type;
268 struct set_traits: public ci::michael_set::traits
270 typedef hash_int hash;
271 typedef simple_item_counter item_counter;
273 typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
275 set_type s( kSize, 2 );