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_SET_RCU_H
31 #define CDSUNIT_TREE_TEST_ELLEN_BINTREE_SET_RCU_H
33 #include "test_tree_set_rcu.h"
34 #include <cds/container/ellen_bintree_set_rcu.h>
35 #include "test_ellen_bintree_update_desc_pool.h"
39 namespace cc = cds::container;
42 class EllenBinTreeSet: public cds_test::container_tree_set_rcu
44 typedef cds_test::container_tree_set_rcu base_class;
46 typedef cds::urcu::gc<RCU> rcu_type;
52 cds::threading::Manager::attachThread();
57 cds::threading::Manager::detachThread();
62 TYPED_TEST_CASE_P( EllenBinTreeSet );
64 TYPED_TEST_P( EllenBinTreeSet, compare )
66 typedef typename TestFixture::rcu_type rcu_type;
67 typedef typename TestFixture::int_item int_item;
68 typedef typename TestFixture::key_extractor key_extractor;
70 typedef cc::EllenBinTreeSet< rcu_type, int, int_item,
71 typename cc::ellen_bintree::make_set_traits<
72 cds::opt::compare< typename TestFixture::cmp >
73 ,cc::ellen_bintree::key_extractor< key_extractor >
81 TYPED_TEST_P( EllenBinTreeSet, less )
83 typedef typename TestFixture::rcu_type rcu_type;
84 typedef typename TestFixture::int_item int_item;
85 typedef typename TestFixture::key_extractor key_extractor;
87 typedef cc::EllenBinTreeSet< rcu_type, int, int_item,
88 typename cc::ellen_bintree::make_set_traits<
89 cds::opt::less< typename TestFixture::less >
90 ,cc::ellen_bintree::key_extractor< key_extractor >
98 TYPED_TEST_P( EllenBinTreeSet, cmpmix )
100 typedef typename TestFixture::rcu_type rcu_type;
101 typedef typename TestFixture::int_item int_item;
102 typedef typename TestFixture::key_extractor key_extractor;
104 typedef cc::EllenBinTreeSet< rcu_type, int, int_item,
105 typename cc::ellen_bintree::make_set_traits<
106 cds::opt::less< typename TestFixture::less >
107 ,cds::opt::compare< typename TestFixture::cmp >
108 ,cc::ellen_bintree::key_extractor< key_extractor >
116 TYPED_TEST_P( EllenBinTreeSet, update_desc_pool )
118 typedef typename TestFixture::rcu_type rcu_type;
119 typedef typename TestFixture::int_item int_item;
121 struct set_traits: public cc::ellen_bintree::traits
123 typedef typename TestFixture::key_extractor key_extractor;
124 typedef typename TestFixture::cmp compare;
125 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
127 typedef cc::EllenBinTreeSet< rcu_type, int, int_item, set_traits > set_type;
133 TYPED_TEST_P( EllenBinTreeSet, update_desc_lazy_pool )
135 typedef typename TestFixture::rcu_type rcu_type;
136 typedef typename TestFixture::int_item int_item;
138 struct set_traits: public cc::ellen_bintree::traits
140 typedef typename TestFixture::key_extractor key_extractor;
141 typedef typename TestFixture::less less;
142 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
144 typedef cc::EllenBinTreeSet< rcu_type, int, int_item, set_traits > set_type;
150 TYPED_TEST_P( EllenBinTreeSet, item_counting )
152 typedef typename TestFixture::rcu_type rcu_type;
153 typedef typename TestFixture::int_item int_item;
155 struct set_traits: public cc::ellen_bintree::traits
157 typedef typename TestFixture::key_extractor key_extractor;
158 typedef typename TestFixture::cmp compare;
159 typedef typename TestFixture::less less;
160 typedef cds::atomicity::item_counter item_counter;
161 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
163 typedef cc::EllenBinTreeSet< rcu_type, int, int_item, set_traits > set_type;
169 TYPED_TEST_P( EllenBinTreeSet, backoff )
171 typedef typename TestFixture::rcu_type rcu_type;
172 typedef typename TestFixture::int_item int_item;
174 struct set_traits: public cc::ellen_bintree::traits
176 typedef typename TestFixture::key_extractor key_extractor;
177 typedef typename TestFixture::cmp compare;
178 typedef typename TestFixture::less less;
179 typedef cds::atomicity::item_counter item_counter;
180 typedef cds::backoff::yield back_off;
181 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
183 typedef cc::EllenBinTreeSet< rcu_type, int, int_item, set_traits > set_type;
189 TYPED_TEST_P( EllenBinTreeSet, stat )
191 typedef typename TestFixture::rcu_type rcu_type;
192 typedef typename TestFixture::int_item int_item;
194 struct set_traits: public cc::ellen_bintree::traits
196 typedef typename TestFixture::less less;
197 typedef cds::atomicity::item_counter item_counter;
198 typedef cds::backoff::yield back_off;
199 typedef cc::ellen_bintree::stat<> stat;
200 typedef typename TestFixture::key_extractor key_extractor;
201 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
203 typedef cc::EllenBinTreeSet< rcu_type, int, int_item, set_traits > set_type;
209 TYPED_TEST_P( EllenBinTreeSet, seq_cst )
211 typedef typename TestFixture::rcu_type rcu_type;
212 typedef typename TestFixture::int_item int_item;
214 struct set_traits: public cc::ellen_bintree::traits
216 typedef typename TestFixture::less less;
217 typedef cds::atomicity::item_counter item_counter;
218 typedef cds::backoff::yield back_off;
219 typedef cc::ellen_bintree::stat<> stat;
220 typedef typename TestFixture::key_extractor key_extractor;
221 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
222 typedef cds::opt::v::sequential_consistent memory_model;
224 typedef cc::EllenBinTreeSet< rcu_type, int, int_item, set_traits > set_type;
231 // GCC 5: All this->test names should be written on single line, otherwise a runtime error will be encountered like as
232 // "No this->test named <test_name> can be found in this this->test case"
233 REGISTER_TYPED_TEST_CASE_P( EllenBinTreeSet,
234 compare, less, cmpmix, update_desc_pool, update_desc_lazy_pool, item_counting, backoff, stat, seq_cst
238 #endif // CDSUNIT_TREE_TEST_ELLEN_BINTREE_SET_RCU_H