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 "map/hdr_feldman_hashmap.h"
32 #include <cds/container/feldman_hashmap_dhp.h>
33 #include "unit/print_feldman_hashset_stat.h"
37 typedef cds::gc::DHP gc_type;
40 void FeldmanHashMapHdrTest::dhp_nohash()
42 typedef cc::FeldmanHashMap< gc_type, size_t, Item > map_type;
44 test_hp<map_type>(4, 2);
47 void FeldmanHashMapHdrTest::dhp_stdhash()
49 struct traits : public cc::feldman_hashmap::traits {
50 typedef std::hash<size_t> hash;
52 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
54 test_hp<map_type>(4, 2);
57 void FeldmanHashMapHdrTest::dhp_hash128()
59 struct traits : public cc::feldman_hashmap::traits {
60 typedef hash128::make hash;
61 typedef hash128::less less;
63 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
64 test_hp<map_type>(4, 2);
66 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
67 typename cc::feldman_hashmap::make_traits<
68 co::hash< hash128::make >
69 , co::less< hash128::less >
72 test_hp<map_type2>(4, 2);
75 void FeldmanHashMapHdrTest::dhp_nohash_stat()
77 struct traits : public cc::feldman_hashmap::traits {
78 typedef cc::feldman_hashmap::stat<> stat;
80 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
81 test_hp<map_type>(4, 2);
83 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
84 typename cc::feldman_hashmap::make_traits<
85 co::stat< cc::feldman_hashmap::stat<>>
88 test_hp<map_type2>(4, 2);
91 void FeldmanHashMapHdrTest::dhp_stdhash_stat()
93 struct traits : public cc::feldman_hashmap::traits {
94 typedef std::hash<size_t> hash;
95 typedef cc::feldman_hashmap::stat<> stat;
97 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
98 test_hp<map_type>(4, 2);
100 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
101 typename cc::feldman_hashmap::make_traits<
102 co::stat< cc::feldman_hashmap::stat<>>
103 ,co::hash< std::hash<size_t>>
106 test_hp<map_type2>(4, 2);
109 void FeldmanHashMapHdrTest::dhp_hash128_stat()
111 struct traits : public cc::feldman_hashmap::traits {
112 typedef cc::feldman_hashmap::stat<> stat;
113 typedef hash128::make hash;
114 typedef hash128::cmp compare;
116 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
117 test_hp<map_type>(4, 2);
119 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
120 typename cc::feldman_hashmap::make_traits<
121 co::stat< cc::feldman_hashmap::stat<>>
122 , co::hash< hash128::make >
123 , co::compare< hash128::cmp >
126 test_hp<map_type2>(4, 2);
129 void FeldmanHashMapHdrTest::dhp_nohash_5_3()
131 typedef cc::FeldmanHashMap< gc_type, size_t, Item > map_type;
133 test_hp<map_type>(5, 3);
137 void FeldmanHashMapHdrTest::dhp_stdhash_5_3()
139 struct traits : public cc::feldman_hashmap::traits {
140 typedef std::hash<size_t> hash;
142 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
144 test_hp<map_type>(5, 3);
147 void FeldmanHashMapHdrTest::dhp_nohash_5_3_stat()
149 struct traits : public cc::feldman_hashmap::traits {
150 typedef cc::feldman_hashmap::stat<> stat;
151 typedef cds::backoff::empty back_off;
153 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
154 test_hp<map_type>(5, 3);
156 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
157 typename cc::feldman_hashmap::make_traits<
158 co::stat< cc::feldman_hashmap::stat<>>
159 , co::back_off< cds::backoff::empty >
162 test_hp<map_type2>(5, 3);
165 void FeldmanHashMapHdrTest::dhp_stdhash_5_3_stat()
167 struct traits : public cc::feldman_hashmap::traits {
168 typedef cc::feldman_hashmap::stat<> stat;
169 typedef cds::backoff::empty back_off;
170 typedef std::hash<size_t> hash;
172 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
173 test_hp<map_type>(5, 3);
175 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
176 typename cc::feldman_hashmap::make_traits<
177 co::stat< cc::feldman_hashmap::stat<>>
178 ,co::back_off< cds::backoff::empty >
179 ,co::hash< std::hash<size_t>>
182 test_hp<map_type2>(5, 3);
185 void FeldmanHashMapHdrTest::dhp_hash128_4_3()
187 struct traits : public cc::feldman_hashmap::traits {
188 typedef hash128::make hash;
189 typedef hash128::less less;
191 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
192 test_hp<map_type>(4, 3);
194 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
195 typename cc::feldman_hashmap::make_traits<
196 co::hash< hash128::make >
197 , co::less< hash128::less >
200 test_hp<map_type2>(4, 3);
203 void FeldmanHashMapHdrTest::dhp_hash128_4_3_stat()
205 struct traits : public cc::feldman_hashmap::traits {
206 typedef hash128::make hash;
207 typedef hash128::less less;
208 typedef cc::feldman_hashmap::stat<> stat;
209 typedef co::v::sequential_consistent memory_model;
211 typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
212 test_hp<map_type>(4, 3);
214 typedef cc::FeldmanHashMap< gc_type, size_t, Item,
215 typename cc::feldman_hashmap::make_traits<
216 co::hash< hash128::make >
217 , co::less< hash128::less >
218 , co::stat< cc::feldman_hashmap::stat<>>
219 , co::memory_model< co::v::sequential_consistent >
222 test_hp<map_type2>(4, 3);
226 CPPUNIT_TEST_SUITE_REGISTRATION(map::FeldmanHashMapHdrTest);