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.
30 #ifndef CDSUNIT_MAP_TEST_SPLIT_LIST_MICHAEL_RCU_H
31 #define CDSUNIT_MAP_TEST_SPLIT_LIST_MICHAEL_RCU_H
33 #include "test_map_rcu.h"
34 #include <cds/container/michael_list_rcu.h>
35 #include <cds/container/split_list_map_rcu.h>
36 #include <cds/intrusive/free_list.h>
38 namespace cc = cds::container;
41 class SplitListMichaelMap: public cds_test::container_map_rcu
43 typedef cds_test::container_map_rcu base_class;
45 typedef cds::urcu::gc<RCU> rcu_type;
51 cds::threading::Manager::attachThread();
56 cds::threading::Manager::detachThread();
61 TYPED_TEST_CASE_P( SplitListMichaelMap );
63 TYPED_TEST_P( SplitListMichaelMap, compare )
65 typedef typename TestFixture::rcu_type rcu_type;
66 typedef typename TestFixture::key_type key_type;
67 typedef typename TestFixture::value_type value_type;
68 typedef typename TestFixture::hash1 hash1;
70 typedef cc::SplitListMap< rcu_type, key_type, value_type,
71 typename cc::split_list::make_traits<
72 cc::split_list::ordered_list< cc::michael_list_tag >
73 , cds::opt::hash< hash1 >
74 , cc::split_list::ordered_list_traits<
75 typename cc::michael_list::make_traits<
76 cds::opt::compare< typename TestFixture::cmp >
82 map_type m( TestFixture::kSize, 2 );
86 TYPED_TEST_P( SplitListMichaelMap, less )
88 typedef typename TestFixture::rcu_type rcu_type;
89 typedef typename TestFixture::key_type key_type;
90 typedef typename TestFixture::value_type value_type;
91 typedef typename TestFixture::hash1 hash1;
93 typedef cc::SplitListMap< rcu_type, key_type, value_type,
94 typename cc::split_list::make_traits<
95 cc::split_list::ordered_list< cc::michael_list_tag >
96 , cds::opt::hash< hash1 >
97 , cc::split_list::ordered_list_traits<
98 typename cc::michael_list::make_traits<
99 cds::opt::less< typename TestFixture::less >
105 map_type m( TestFixture::kSize, 2 );
109 TYPED_TEST_P( SplitListMichaelMap, cmpmix )
111 typedef typename TestFixture::rcu_type rcu_type;
112 typedef typename TestFixture::key_type key_type;
113 typedef typename TestFixture::value_type value_type;
114 typedef typename TestFixture::hash1 hash1;
116 typedef cc::SplitListMap< rcu_type, key_type, value_type,
117 typename cc::split_list::make_traits<
118 cc::split_list::ordered_list< cc::michael_list_tag >
119 , cds::opt::hash< hash1 >
120 , cc::split_list::ordered_list_traits<
121 typename cc::michael_list::make_traits<
122 cds::opt::less< typename TestFixture::less >
123 , cds::opt::compare< typename TestFixture::cmp >
129 map_type m( TestFixture::kSize, 3 );
133 TYPED_TEST_P( SplitListMichaelMap, item_counting )
135 typedef typename TestFixture::rcu_type rcu_type;
136 typedef typename TestFixture::key_type key_type;
137 typedef typename TestFixture::value_type value_type;
138 typedef typename TestFixture::hash1 hash1;
140 struct map_traits: public cc::split_list::traits
142 typedef cc::michael_list_tag ordered_list;
144 typedef cds::atomicity::item_counter item_counter;
146 struct ordered_list_traits: public cc::michael_list::traits
148 typedef typename TestFixture::cmp compare;
149 typedef typename TestFixture::less less;
150 typedef cds::backoff::empty back_off;
153 typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type;
155 map_type m( TestFixture::kSize, 8 );
159 TYPED_TEST_P( SplitListMichaelMap, stat )
161 typedef typename TestFixture::rcu_type rcu_type;
162 typedef typename TestFixture::key_type key_type;
163 typedef typename TestFixture::value_type value_type;
164 typedef typename TestFixture::hash1 hash1;
166 struct map_traits: public cc::split_list::traits
168 typedef cc::michael_list_tag ordered_list;
170 typedef cds::atomicity::item_counter item_counter;
171 typedef cc::split_list::stat<> stat;
173 struct ordered_list_traits: public cc::michael_list::traits
175 typedef typename TestFixture::less less;
176 typedef cds::opt::v::sequential_consistent memory_model;
179 typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type;
181 map_type m( TestFixture::kSize, 4 );
185 TYPED_TEST_P( SplitListMichaelMap, back_off )
187 typedef typename TestFixture::rcu_type rcu_type;
188 typedef typename TestFixture::key_type key_type;
189 typedef typename TestFixture::value_type value_type;
190 typedef typename TestFixture::hash1 hash1;
192 struct map_traits: public cc::split_list::traits
194 typedef cc::michael_list_tag ordered_list;
196 typedef cds::atomicity::item_counter item_counter;
197 typedef cds::backoff::yield back_off;
198 typedef cds::opt::v::sequential_consistent memory_model;
200 struct ordered_list_traits: public cc::michael_list::traits
202 typedef typename TestFixture::cmp compare;
203 typedef cds::backoff::pause back_off;
206 typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type;
208 map_type m( TestFixture::kSize, 2 );
212 TYPED_TEST_P( SplitListMichaelMap, free_list )
214 typedef typename TestFixture::rcu_type rcu_type;
215 typedef typename TestFixture::key_type key_type;
216 typedef typename TestFixture::value_type value_type;
217 typedef typename TestFixture::hash1 hash1;
219 struct map_traits: public cc::split_list::traits
221 typedef cc::michael_list_tag ordered_list;
223 typedef cds::intrusive::FreeList free_list;
225 struct ordered_list_traits: public cc::michael_list::traits
227 typedef typename TestFixture::cmp compare;
228 typedef cds::backoff::pause back_off;
231 typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type;
233 map_type m( TestFixture::kSize, 2 );
238 struct set_static_traits: public cc::split_list::traits
240 static bool const dynamic_bucket_table = false;
244 TYPED_TEST_P( SplitListMichaelMap, static_bucket_table )
246 typedef typename TestFixture::rcu_type rcu_type;
247 typedef typename TestFixture::key_type key_type;
248 typedef typename TestFixture::value_type value_type;
249 typedef typename TestFixture::hash1 hash1;
251 struct map_traits: public set_static_traits
253 typedef cc::michael_list_tag ordered_list;
255 typedef cds::atomicity::item_counter item_counter;
257 struct ordered_list_traits: public cc::michael_list::traits
259 typedef typename TestFixture::cmp compare;
260 typedef cds::backoff::pause back_off;
263 typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type;
265 map_type m( TestFixture::kSize, 4 );
269 TYPED_TEST_P( SplitListMichaelMap, static_bucket_table_free_list )
271 typedef typename TestFixture::rcu_type rcu_type;
272 typedef typename TestFixture::key_type key_type;
273 typedef typename TestFixture::value_type value_type;
274 typedef typename TestFixture::hash1 hash1;
276 struct map_traits: public set_static_traits
278 typedef cc::michael_list_tag ordered_list;
280 typedef cds::atomicity::item_counter item_counter;
281 typedef cds::intrusive::FreeList free_list;
283 struct ordered_list_traits: public cc::michael_list::traits
285 typedef typename TestFixture::cmp compare;
286 typedef cds::backoff::pause back_off;
289 typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type;
291 map_type m( TestFixture::kSize, 4 );
295 REGISTER_TYPED_TEST_CASE_P( SplitListMichaelMap,
296 compare, less, cmpmix, item_counting, stat, back_off, free_list, static_bucket_table, static_bucket_table_free_list
300 #endif // CDSUNIT_MAP_TEST_SPLIT_LIST_MICHAEL_RCU_H