Renamed MultiLevelHashSet/Map to FeldmanHashSet/Map
[libcds.git] / tests / test-hdr / map / hdr_feldman_hashmap_rcu_gpi.cpp
1 //$$CDS-header$$
2
3 #include "map/hdr_feldman_hashmap.h"
4 #include <cds/urcu/general_instant.h>
5 #include <cds/container/feldman_hashmap_rcu.h>
6 #include "unit/print_feldman_hashset_stat.h"
7
8 namespace map {
9     namespace {
10         typedef cds::urcu::gc< cds::urcu::general_instant<>> rcu_type;
11     } // namespace
12
13     void FeldmanHashMapHdrTest::rcu_gpi_nohash()
14     {
15         typedef cc::FeldmanHashMap< rcu_type, size_t, Item > map_type;
16
17         test_rcu<map_type>(4, 2);
18     }
19
20     void FeldmanHashMapHdrTest::rcu_gpi_stdhash()
21     {
22         struct traits : public cc::feldman_hashmap::traits {
23             typedef std::hash<size_t> hash;
24         };
25         typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
26
27         test_rcu<map_type>(4, 2);
28     }
29
30     void FeldmanHashMapHdrTest::rcu_gpi_hash128()
31     {
32         struct traits : public cc::feldman_hashmap::traits {
33             typedef hash128::make hash;
34             typedef hash128::less less;
35         };
36         typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
37         test_rcu<map_type>(4, 2);
38
39         typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
40             typename cc::feldman_hashmap::make_traits<
41                 co::hash< hash128::make >
42                 , co::less< hash128::less >
43             >::type
44         > map_type2;
45         test_rcu<map_type2>(4, 2);
46     }
47
48     void FeldmanHashMapHdrTest::rcu_gpi_nohash_stat()
49     {
50         struct traits : public cc::feldman_hashmap::traits {
51             typedef cc::feldman_hashmap::stat<> stat;
52         };
53         typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
54         test_rcu<map_type>(4, 2);
55
56         typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
57             typename cc::feldman_hashmap::make_traits<
58             co::stat< cc::feldman_hashmap::stat<>>
59             >::type
60         > map_type2;
61         test_rcu<map_type2>(4, 2);
62     }
63
64     void FeldmanHashMapHdrTest::rcu_gpi_stdhash_stat()
65     {
66         struct traits : public cc::feldman_hashmap::traits {
67             typedef std::hash<size_t> hash;
68             typedef cc::feldman_hashmap::stat<> stat;
69         };
70         typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
71         test_rcu<map_type>(4, 2);
72
73         typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
74             typename cc::feldman_hashmap::make_traits<
75                 co::stat< cc::feldman_hashmap::stat<>>
76                 ,co::hash<std::hash<size_t>>
77             >::type
78         > map_type2;
79         test_rcu<map_type2>(4, 2);
80     }
81
82         void FeldmanHashMapHdrTest::rcu_gpi_hash128_stat()
83     {
84         struct traits : public cc::feldman_hashmap::traits {
85             typedef cc::feldman_hashmap::stat<> stat;
86             typedef hash128::make hash;
87             typedef hash128::cmp compare;
88         };
89         typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
90         test_rcu<map_type>(4, 2);
91
92         typedef cc::FeldmanHashMap< rcu_type, size_t, Item,
93             typename cc::feldman_hashmap::make_traits<
94                 co::stat< cc::feldman_hashmap::stat<>>
95                 , co::hash< hash128::make >
96                 , co::compare< hash128::cmp >
97             >::type
98         > map_type2;
99         test_rcu<map_type2>(4, 2);
100     }
101
102     void FeldmanHashMapHdrTest::rcu_gpi_nohash_5_3()
103     {
104         typedef cc::FeldmanHashMap< rcu_type, size_t, Item > map_type;
105
106         test_rcu<map_type>(5, 3);
107     }
108
109     void FeldmanHashMapHdrTest::rcu_gpi_stdhash_5_3()
110     {
111         struct traits : public cc::feldman_hashmap::traits {
112             typedef std::hash<size_t> hash;
113         };
114         typedef cc::FeldmanHashMap< rcu_type, size_t, Item, traits > map_type;
115
116         test_rcu<map_type>(5, 3);
117     }
118
119     void FeldmanHashMapHdrTest::rcu_gpi_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< rcu_type, size_t, Item, traits > map_type;
126         test_rcu<map_type>(5, 3);
127
128         typedef cc::FeldmanHashMap< rcu_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_rcu<map_type2>(5, 3);
135     }
136
137     void FeldmanHashMapHdrTest::rcu_gpi_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< rcu_type, size_t, Item, traits > map_type;
145         test_rcu<map_type>(5, 3);
146
147         typedef cc::FeldmanHashMap< rcu_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_rcu<map_type2>(5, 3);
155     }
156
157     void FeldmanHashMapHdrTest::rcu_gpi_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< rcu_type, size_t, Item, traits > map_type;
164         test_rcu<map_type>(4, 3);
165
166         typedef cc::FeldmanHashMap< rcu_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_rcu<map_type2>(4, 3);
173     }
174
175     void FeldmanHashMapHdrTest::rcu_gpi_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< rcu_type, size_t, Item, traits > map_type;
184         test_rcu<map_type>(4, 3);
185
186         typedef cc::FeldmanHashMap< rcu_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_rcu<map_type2>(4, 3);
195     }
196
197 } // namespace map