Renamed MultiLevelHashSet/Map to FeldmanHashSet/Map
[libcds.git] / tests / test-hdr / map / hdr_feldman_hashmap_hp.cpp
1 //$$CDS-header$$
2
3 #include "map/hdr_feldman_hashmap.h"
4 #include <cds/container/feldman_hashmap_hp.h>
5 #include "unit/print_feldman_hashset_stat.h"
6
7 namespace map {
8     namespace {
9         typedef cds::gc::HP gc_type;
10     } // namespace
11
12     void FeldmanHashMapHdrTest::hp_nohash()
13     {
14         typedef cc::FeldmanHashMap< gc_type, size_t, Item > map_type;
15
16         test_hp<map_type>(4, 2);
17     }
18
19     void FeldmanHashMapHdrTest::hp_stdhash()
20     {
21         struct traits : public cc::feldman_hashmap::traits {
22             typedef std::hash<size_t> hash;
23         };
24         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
25
26         test_hp<map_type>(4, 2);
27     }
28
29     void FeldmanHashMapHdrTest::hp_hash128()
30     {
31         struct traits : public cc::feldman_hashmap::traits {
32             typedef hash128::make hash;
33             typedef hash128::less less;
34         };
35         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
36         test_hp<map_type>(4, 2);
37
38         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
39             typename cc::feldman_hashmap::make_traits<
40                 co::hash< hash128::make >
41                 , co::less< hash128::less >
42             >::type
43         > map_type2;
44         test_hp<map_type2>(4, 2);
45     }
46
47     void FeldmanHashMapHdrTest::hp_nohash_stat()
48     {
49         struct traits : public cc::feldman_hashmap::traits {
50             typedef cc::feldman_hashmap::stat<> stat;
51         };
52         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
53         test_hp<map_type>(4, 2);
54
55         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
56             typename cc::feldman_hashmap::make_traits<
57                 co::stat< cc::feldman_hashmap::stat<>>
58             >::type
59         > map_type2;
60         test_hp<map_type2>(4, 2);
61     }
62
63     void FeldmanHashMapHdrTest::hp_stdhash_stat()
64     {
65         struct traits : public cc::feldman_hashmap::traits {
66             typedef std::hash<size_t> hash;
67             typedef cc::feldman_hashmap::stat<> stat;
68         };
69         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
70         test_hp<map_type>(4, 2);
71
72         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
73             typename cc::feldman_hashmap::make_traits<
74                 co::stat< cc::feldman_hashmap::stat<>>
75                 ,co::hash< std::hash<size_t>>
76             >::type
77         > map_type2;
78         test_hp<map_type2>(4, 2);
79     }
80
81     void FeldmanHashMapHdrTest::hp_hash128_stat()
82     {
83         struct traits : public cc::feldman_hashmap::traits {
84             typedef cc::feldman_hashmap::stat<> stat;
85             typedef hash128::make hash;
86             typedef hash128::cmp compare;
87         };
88         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
89         test_hp<map_type>(4, 2);
90
91         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
92             typename cc::feldman_hashmap::make_traits<
93                 co::stat< cc::feldman_hashmap::stat<>>
94                 , co::hash< hash128::make >
95                 , co::compare< hash128::cmp >
96             >::type
97         > map_type2;
98         test_hp<map_type2>(4, 2);
99     }
100
101     void FeldmanHashMapHdrTest::hp_nohash_5_3()
102     {
103         typedef cc::FeldmanHashMap< gc_type, size_t, Item > map_type;
104
105         test_hp<map_type>(5, 3);
106     }
107
108
109     void FeldmanHashMapHdrTest::hp_stdhash_5_3()
110     {
111         struct traits : public cc::feldman_hashmap::traits {
112             typedef std::hash<size_t> hash;
113         };
114         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
115
116         test_hp<map_type>(5, 3);
117     }
118
119     void FeldmanHashMapHdrTest::hp_nohash_5_3_stat()
120     {
121         struct traits : public cc::feldman_hashmap::traits {
122             typedef cc::feldman_hashmap::stat<> stat;
123             typedef cds::backoff::empty back_off;
124         };
125         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
126         test_hp<map_type>(5, 3);
127
128         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
129             typename cc::feldman_hashmap::make_traits<
130             co::stat< cc::feldman_hashmap::stat<>>
131             , co::back_off< cds::backoff::empty >
132             >::type
133         > map_type2;
134         test_hp<map_type2>(5, 3);
135     }
136
137     void FeldmanHashMapHdrTest::hp_stdhash_5_3_stat()
138     {
139         struct traits : public cc::feldman_hashmap::traits {
140             typedef cc::feldman_hashmap::stat<> stat;
141             typedef cds::backoff::empty back_off;
142             typedef std::hash<size_t> hash;
143         };
144         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
145         test_hp<map_type>(5, 3);
146
147         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
148             typename cc::feldman_hashmap::make_traits<
149                 co::stat< cc::feldman_hashmap::stat<>>
150                 ,co::back_off< cds::backoff::empty >
151                 ,co::hash< std::hash<size_t>>
152             >::type
153         > map_type2;
154         test_hp<map_type2>(5, 3);
155     }
156
157     void FeldmanHashMapHdrTest::hp_hash128_4_3()
158     {
159         struct traits : public cc::feldman_hashmap::traits {
160             typedef hash128::make hash;
161             typedef hash128::less less;
162         };
163         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
164         test_hp<map_type>(4, 3);
165
166         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
167             typename cc::feldman_hashmap::make_traits<
168                 co::hash< hash128::make >
169                 , co::less< hash128::less >
170             >::type
171         > map_type2;
172         test_hp<map_type2>(4, 3);
173     }
174
175     void FeldmanHashMapHdrTest::hp_hash128_4_3_stat()
176     {
177         struct traits : public cc::feldman_hashmap::traits {
178             typedef hash128::make hash;
179             typedef hash128::less less;
180             typedef cc::feldman_hashmap::stat<> stat;
181             typedef co::v::sequential_consistent memory_model;
182         };
183         typedef cc::FeldmanHashMap< gc_type, size_t, Item, traits > map_type;
184         test_hp<map_type>(4, 3);
185
186         typedef cc::FeldmanHashMap< gc_type, size_t, Item,
187             typename cc::feldman_hashmap::make_traits<
188                 co::hash< hash128::make >
189                 , co::less< hash128::less >
190                 , co::stat< cc::feldman_hashmap::stat<>>
191                 , co::memory_model< co::v::sequential_consistent >
192             >::type
193         > map_type2;
194         test_hp<map_type2>(4, 3);
195     }
196 } // namespace map
197
198 CPPUNIT_TEST_SUITE_REGISTRATION(map::FeldmanHashMapHdrTest);