3 #include "set/hdr_multilevel_hashset.h"
4 #include <cds/container/multilevel_hashset_hp.h>
5 #include "unit/print_multilevel_hashset_stat.h"
9 typedef cds::gc::HP gc_type;
12 void MultiLevelHashSetHdrTest::hp_stdhash()
14 typedef size_t hash_type;
16 struct traits: public cc::multilevel_hashset::traits
18 typedef get_hash<hash_type> hash_accessor;
20 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
21 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
22 test_hp<set_type, std::hash<hash_type>>(4, 2);
24 typedef cc::MultiLevelHashSet<
27 typename cc::multilevel_hashset::make_traits<
28 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
31 test_hp<set_type2, std::hash<hash_type>>(4, 2);
34 void MultiLevelHashSetHdrTest::hp_hash128()
36 typedef hash128 hash_type;
38 struct traits: public cc::multilevel_hashset::traits
40 typedef get_hash<hash_type> hash_accessor;
41 typedef hash128::less less;
43 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
44 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash128!!!" );
45 test_hp<set_type, hash128::make>(4, 2);
47 typedef cc::MultiLevelHashSet<
50 typename cc::multilevel_hashset::make_traits<
51 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
52 , co::less< hash_type::less >
55 test_hp<set_type2, hash128::make>(4, 2);
58 void MultiLevelHashSetHdrTest::hp_stdhash_stat()
60 typedef size_t hash_type;
62 struct traits: public cc::multilevel_hashset::traits
64 typedef get_hash<hash_type> hash_accessor;
65 typedef cc::multilevel_hashset::stat<> stat;
67 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
68 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
69 test_hp<set_type, std::hash<hash_type>>(4, 2);
71 typedef cc::MultiLevelHashSet<
74 typename cc::multilevel_hashset::make_traits<
75 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
76 ,co::stat< cc::multilevel_hashset::stat<>>
79 test_hp<set_type2, std::hash<hash_type>>(4, 2);
82 void MultiLevelHashSetHdrTest::hp_hash128_stat()
84 typedef hash128 hash_type;
86 struct traits: public cc::multilevel_hashset::traits
88 typedef get_hash<hash_type> hash_accessor;
89 typedef hash128::cmp compare;
90 typedef cc::multilevel_hashset::stat<> stat;
92 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
93 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
94 test_hp<set_type, hash_type::make>(4, 2);
96 typedef cc::MultiLevelHashSet<
99 typename cc::multilevel_hashset::make_traits<
100 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
101 ,co::stat< cc::multilevel_hashset::stat<>>
102 ,co::compare< hash128::cmp >
105 test_hp<set_type2, hash_type::make>(4, 2);
108 void MultiLevelHashSetHdrTest::hp_stdhash_5_3()
110 typedef size_t hash_type;
112 struct traits: public cc::multilevel_hashset::traits
114 typedef get_hash<hash_type> hash_accessor;
116 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
117 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
118 test_hp<set_type, std::hash<hash_type>>(5, 3);
120 typedef cc::MultiLevelHashSet<
123 typename cc::multilevel_hashset::make_traits<
124 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
127 test_hp<set_type2, std::hash<hash_type>>(5, 3);
130 void MultiLevelHashSetHdrTest::hp_hash128_4_3()
132 typedef hash128 hash_type;
134 struct traits: public cc::multilevel_hashset::traits
136 typedef get_hash<hash_type> hash_accessor;
137 typedef co::v::sequential_consistent memory_model;
139 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
140 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
141 test_hp<set_type, hash128::make >(4, 3);
143 typedef cc::MultiLevelHashSet<
146 typename cc::multilevel_hashset::make_traits<
147 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
148 ,co::memory_model< co::v::sequential_consistent >
151 test_hp<set_type2, hash128::make >(4, 3);
154 void MultiLevelHashSetHdrTest::hp_stdhash_5_3_stat()
156 typedef size_t hash_type;
158 struct traits: public cc::multilevel_hashset::traits
160 typedef get_hash<hash_type> hash_accessor;
161 typedef cc::multilevel_hashset::stat<> stat;
163 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
164 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
165 test_hp<set_type, std::hash<hash_type>>(5, 3);
167 typedef cc::MultiLevelHashSet<
170 typename cc::multilevel_hashset::make_traits<
171 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
172 ,co::stat< cc::multilevel_hashset::stat<>>
175 test_hp<set_type2, std::hash<hash_type>>(5, 3);
178 void MultiLevelHashSetHdrTest::hp_hash128_4_3_stat()
180 typedef hash128 hash_type;
182 struct traits: public cc::multilevel_hashset::traits
184 typedef get_hash<hash_type> hash_accessor;
185 typedef cc::multilevel_hashset::stat<> stat;
186 typedef hash128::less less;
187 typedef hash128::cmp compare;
189 typedef cc::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
190 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
191 test_hp<set_type, hash_type::make>(4, 3);
193 typedef cc::MultiLevelHashSet<
196 typename cc::multilevel_hashset::make_traits<
197 cc::multilevel_hashset::hash_accessor< get_hash<hash_type>>
198 , co::stat< cc::multilevel_hashset::stat<>>
199 , co::less< hash_type::less >
200 , co::compare< hash128::cmp >
203 test_hp<set_type2, hash_type::make>(4, 3);
209 CPPUNIT_TEST_SUITE_REGISTRATION(set::MultiLevelHashSetHdrTest);