2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
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_TREE_TEST_ELLEN_BINTREE_MAP_RCU_H
31 #define CDSUNIT_TREE_TEST_ELLEN_BINTREE_MAP_RCU_H
33 #include "test_tree_map_rcu.h"
34 #include <cds/container/ellen_bintree_map_rcu.h>
35 #include "test_ellen_bintree_update_desc_pool.h"
38 namespace cc = cds::container;
41 class EllenBinTreeMap: public cds_test::container_tree_map_rcu
43 typedef cds_test::container_tree_map_rcu base_class;
45 typedef cds::urcu::gc<RCU> rcu_type;
52 cds::threading::Manager::attachThread();
57 cds::threading::Manager::detachThread();
62 TYPED_TEST_CASE_P( EllenBinTreeMap );
64 TYPED_TEST_P( EllenBinTreeMap, compare )
66 typedef typename TestFixture::rcu_type rcu_type;
67 typedef typename TestFixture::key_type key_type;
68 typedef typename TestFixture::value_type value_type;
70 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
71 typename cc::ellen_bintree::make_map_traits<
72 cds::opt::compare< typename TestFixture::cmp >
80 TYPED_TEST_P( EllenBinTreeMap, less )
82 typedef typename TestFixture::rcu_type rcu_type;
83 typedef typename TestFixture::key_type key_type;
84 typedef typename TestFixture::value_type value_type;
86 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
87 typename cc::ellen_bintree::make_map_traits<
88 cds::opt::less< typename TestFixture::less >
96 TYPED_TEST_P( EllenBinTreeMap, update_desc_pool )
98 typedef typename TestFixture::rcu_type rcu_type;
99 typedef typename TestFixture::key_type key_type;
100 typedef typename TestFixture::value_type value_type;
102 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
103 typename cc::ellen_bintree::make_map_traits<
104 cds::opt::less< typename TestFixture::less >
105 ,cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor>>
113 TYPED_TEST_P( EllenBinTreeMap, update_desc_lazy_pool )
115 typedef typename TestFixture::rcu_type rcu_type;
116 typedef typename TestFixture::key_type key_type;
117 typedef typename TestFixture::value_type value_type;
119 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
120 typename cc::ellen_bintree::make_map_traits<
121 cds::opt::less< typename TestFixture::less >
122 , cc::ellen_bintree::update_desc_allocator< cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor>>
130 TYPED_TEST_P( EllenBinTreeMap, cmpmix )
132 typedef typename TestFixture::rcu_type rcu_type;
133 typedef typename TestFixture::key_type key_type;
134 typedef typename TestFixture::value_type value_type;
136 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type,
137 typename cc::ellen_bintree::make_map_traits<
138 cds::opt::less< typename TestFixture::less >
139 ,cds::opt::compare< typename TestFixture::cmp >
147 TYPED_TEST_P( EllenBinTreeMap, item_counting )
149 typedef typename TestFixture::rcu_type rcu_type;
150 typedef typename TestFixture::key_type key_type;
151 typedef typename TestFixture::value_type value_type;
153 struct map_traits: public cc::ellen_bintree::traits
155 typedef typename TestFixture::cmp compare;
156 typedef typename TestFixture::less less;
157 typedef cds::atomicity::item_counter item_counter;
158 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
160 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type, map_traits > map_type;
166 TYPED_TEST_P( EllenBinTreeMap, backoff )
168 typedef typename TestFixture::rcu_type rcu_type;
169 typedef typename TestFixture::key_type key_type;
170 typedef typename TestFixture::value_type value_type;
172 struct map_traits: public cc::ellen_bintree::traits
174 typedef typename TestFixture::cmp compare;
175 typedef typename TestFixture::less less;
176 typedef cds::atomicity::item_counter item_counter;
177 typedef cds::backoff::yield back_off;
178 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
180 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type, map_traits > map_type;
186 TYPED_TEST_P( EllenBinTreeMap, stat )
188 typedef typename TestFixture::rcu_type rcu_type;
189 typedef typename TestFixture::key_type key_type;
190 typedef typename TestFixture::value_type value_type;
192 struct map_traits: public cc::ellen_bintree::traits
194 typedef typename TestFixture::less less;
195 typedef cds::atomicity::item_counter item_counter;
196 typedef cds::backoff::yield back_off;
197 typedef cc::ellen_bintree::stat<> stat;
198 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
200 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type, map_traits > map_type;
206 TYPED_TEST_P( EllenBinTreeMap, copy_policy )
208 typedef typename TestFixture::rcu_type rcu_type;
209 typedef typename TestFixture::key_type key_type;
210 typedef typename TestFixture::value_type value_type;
212 struct map_traits: public cc::ellen_bintree::traits
214 typedef typename TestFixture::less less;
215 typedef cds::atomicity::item_counter item_counter;
216 typedef cds::backoff::yield back_off;
217 typedef cc::ellen_bintree::stat<> stat;
218 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
219 typedef typename TestFixture::copy_key copy_policy;
221 typedef cc::EllenBinTreeMap< rcu_type, key_type, value_type, map_traits > map_type;
227 REGISTER_TYPED_TEST_CASE_P( EllenBinTreeMap,
228 compare, less, update_desc_pool, update_desc_lazy_pool, cmpmix, item_counting, backoff, stat, copy_policy
233 #endif // CDSUNIT_TREE_TEST_ELLEN_BINTREE_MAP_RCU_H