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_map_hp.h"
33 #include <cds/container/ellen_bintree_map_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 EllenBinTreeMap_DHP : public cds_test::container_tree_map_hp
43 typedef cds_test::container_tree_map_hp base_class;
47 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type > map_type;
49 cds::gc::dhp::GarbageCollector::Construct( 16, map_type::c_nHazardPtrCount );
50 cds::threading::Manager::attachThread();
55 cds::threading::Manager::detachThread();
56 cds::gc::dhp::GarbageCollector::Destruct();
61 TEST_F( EllenBinTreeMap_DHP, compare )
63 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
64 typename cc::ellen_bintree::make_map_traits<
65 cds::opt::compare< cmp >
73 TEST_F( EllenBinTreeMap_DHP, less )
75 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
76 typename cc::ellen_bintree::make_map_traits<
77 cds::opt::less< base_class::less >
85 TEST_F( EllenBinTreeMap_DHP, cmpmix )
87 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type,
88 typename cc::ellen_bintree::make_map_traits<
89 cds::opt::less< base_class::less >
90 ,cds::opt::compare< cmp >
98 TEST_F( EllenBinTreeMap_DHP, update_desc_pool )
100 struct map_traits: public cc::ellen_bintree::traits
103 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
105 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > map_type;
111 TEST_F( EllenBinTreeMap_DHP, update_desc_lazy_pool )
113 struct map_traits: public cc::ellen_bintree::traits
116 typedef cds::memory::pool_allocator< cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
118 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > map_type;
124 TEST_F( EllenBinTreeMap_DHP, item_counting )
126 struct map_traits: public cc::ellen_bintree::traits
129 typedef base_class::less less;
130 typedef cds::atomicity::item_counter item_counter;
131 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
133 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > map_type;
139 TEST_F( EllenBinTreeMap_DHP, backoff )
141 struct map_traits: public cc::ellen_bintree::traits
144 typedef base_class::less less;
145 typedef cds::atomicity::item_counter item_counter;
146 typedef cds::backoff::yield back_off;
147 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
149 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > map_type;
155 TEST_F( EllenBinTreeMap_DHP, stat )
157 struct map_traits: public cc::ellen_bintree::traits
159 typedef base_class::less less;
160 typedef cds::atomicity::item_counter item_counter;
161 typedef cds::backoff::yield back_off;
162 typedef cc::ellen_bintree::stat<> stat;
163 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
165 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > map_type;
171 TEST_F( EllenBinTreeMap_DHP, copy_policy )
173 struct map_traits: public cc::ellen_bintree::traits
175 typedef base_class::less less;
176 typedef cds::atomicity::item_counter item_counter;
177 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::pool_accessor> update_desc_allocator;
178 typedef copy_key copy_policy;
180 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > map_type;
186 TEST_F( EllenBinTreeMap_DHP, seq_cst )
188 struct map_traits: public cc::ellen_bintree::traits
191 typedef cds::atomicity::item_counter item_counter;
192 typedef cds::backoff::yield back_off;
193 typedef cds::memory::pool_allocator<cds_test::update_desc, cds_test::lazy_pool_accessor> update_desc_allocator;
194 typedef cds::opt::v::sequential_consistent memory_model;
196 typedef cc::EllenBinTreeMap< gc_type, key_type, value_type, map_traits > map_type;