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_tree_set_hp.h"
33 #include <cds/container/ellen_bintree_set_dhp.h>
34 #include "test_ellen_bintree_update_desc_pool.h"
37 namespace cc = cds::container;
38 typedef cds::gc::DHP gc_type;
40 class EllenBinTreeSet_DHP : public cds_test::container_tree_set_hp
43 typedef cds_test::container_tree_set_hp base_class;
46 struct generic_traits: public cc::ellen_bintree::traits
48 typedef base_class::key_extractor key_extractor;
53 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item > set_type;
55 cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount );
56 cds::threading::Manager::attachThread();
61 cds::threading::Manager::detachThread();
62 cds::gc::hp::GarbageCollector::Destruct();
67 TEST_F( EllenBinTreeSet_DHP, compare )
69 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item,
70 typename cc::ellen_bintree::make_set_traits<
71 cc::opt::type_traits< generic_traits >
72 ,cds::opt::compare< cmp >
80 TEST_F( EllenBinTreeSet_DHP, less )
82 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item,
83 typename cc::ellen_bintree::make_set_traits<
84 cc::opt::type_traits< generic_traits >
85 ,cds::opt::less< base_class::less >
93 TEST_F( EllenBinTreeSet_DHP, cmpmix )
95 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item,
96 typename cc::ellen_bintree::make_set_traits<
97 cc::opt::type_traits< generic_traits >
98 ,cds::opt::less< base_class::less >
99 ,cds::opt::compare< cmp >
107 TEST_F( EllenBinTreeSet_DHP, update_desc_pool )
109 struct set_traits: public generic_traits
112 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
114 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item, set_traits > set_type;
120 TEST_F( EllenBinTreeSet_DHP, update_desc_lazy_pool )
122 struct set_traits: public generic_traits
125 typedef cds::memory::pool_allocator< cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
127 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item, set_traits > set_type;
133 TEST_F( EllenBinTreeSet_DHP, item_counting )
135 struct set_traits: public generic_traits
138 typedef base_class::less less;
139 typedef cds::atomicity::item_counter item_counter;
140 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
142 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item, set_traits > set_type;
148 TEST_F( EllenBinTreeSet_DHP, backoff )
150 struct set_traits: public generic_traits
153 typedef base_class::less less;
154 typedef cds::atomicity::item_counter item_counter;
155 typedef cds::backoff::yield back_off;
156 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
158 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item, set_traits > set_type;
164 TEST_F( EllenBinTreeSet_DHP, stat )
166 struct set_traits: public generic_traits
168 typedef base_class::less less;
169 typedef cds::atomicity::item_counter item_counter;
170 typedef cds::backoff::yield back_off;
171 typedef cc::ellen_bintree::stat<> stat;
172 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
174 typedef cc::EllenBinTreeSet< gc_type, key_type, int_item, set_traits > set_type;