43cb36452b9e2eb14512a3bdd3e514b8ea64998d
[libcds.git] / tests / test-hdr / map / hdr_multilevel_hashmap_dhp.cpp
1 //$$CDS-header$$
2
3 #include "map/hdr_multilevel_hashmap.h"
4 #include <cds/container/multilevel_hashmap_dhp.h>
5 #include "unit/print_multilevel_hashset_stat.h"
6
7 namespace map {
8     namespace {
9         typedef cds::gc::DHP gc_type;
10     } // namespace
11
12     void MultiLevelHashMapHdrTest::dhp_stdhash()
13     {
14         typedef cc::MultiLevelHashMap< gc_type, size_t, Item > map_type;
15
16         test_hp<map_type>(4, 2);
17     }
18
19     void MultiLevelHashMapHdrTest::dhp_hash128()
20     {
21         struct traits : public cc::multilevel_hashmap::traits {
22             typedef hash128::make hash;
23             typedef hash128::less less;
24         };
25         typedef cc::MultiLevelHashMap< gc_type, size_t, Item, traits > map_type;
26         test_hp<map_type>(4, 2);
27
28         typedef cc::MultiLevelHashMap< gc_type, size_t, Item,
29             typename cc::multilevel_hashmap::make_traits<
30                 co::hash< hash128::make >
31                 , co::less< hash128::less >
32             >::type
33         > map_type2;
34         test_hp<map_type2>(4, 2);
35     }
36
37     void MultiLevelHashMapHdrTest::dhp_stdhash_stat()
38     {
39         struct traits : public cc::multilevel_hashmap::traits {
40             typedef cc::multilevel_hashmap::stat<> stat;
41         };
42         typedef cc::MultiLevelHashMap< gc_type, size_t, Item, traits > map_type;
43         test_hp<map_type>(4, 2);
44
45         typedef cc::MultiLevelHashMap< gc_type, size_t, Item,
46             typename cc::multilevel_hashmap::make_traits<
47                 co::stat< cc::multilevel_hashmap::stat<>>
48             >::type
49         > map_type2;
50         test_hp<map_type2>(4, 2);
51     }
52
53         void MultiLevelHashMapHdrTest::dhp_hash128_stat()
54     {
55         struct traits : public cc::multilevel_hashmap::traits {
56             typedef cc::multilevel_hashmap::stat<> stat;
57             typedef hash128::make hash;
58             typedef hash128::cmp compare;
59         };
60         typedef cc::MultiLevelHashMap< gc_type, size_t, Item, traits > map_type;
61         test_hp<map_type>(4, 2);
62
63         typedef cc::MultiLevelHashMap< gc_type, size_t, Item,
64             typename cc::multilevel_hashmap::make_traits<
65                 co::stat< cc::multilevel_hashmap::stat<>>
66                 , co::hash< hash128::make >
67                 , co::compare< hash128::cmp >
68             >::type
69         > map_type2;
70         test_hp<map_type2>(4, 2);
71     }
72
73     void MultiLevelHashMapHdrTest::dhp_stdhash_5_3()
74     {
75         typedef cc::MultiLevelHashMap< gc_type, size_t, Item > map_type;
76
77         test_hp<map_type>(5, 3);
78     }
79
80     void MultiLevelHashMapHdrTest::dhp_stdhash_5_3_stat()
81     {
82         struct traits : public cc::multilevel_hashmap::traits {
83             typedef cc::multilevel_hashmap::stat<> stat;
84             typedef cds::backoff::empty back_off;
85         };
86         typedef cc::MultiLevelHashMap< gc_type, size_t, Item, traits > map_type;
87         test_hp<map_type>(5, 3);
88
89         typedef cc::MultiLevelHashMap< gc_type, size_t, Item,
90             typename cc::multilevel_hashmap::make_traits<
91                 co::stat< cc::multilevel_hashmap::stat<>>
92                 ,co::back_off< cds::backoff::empty >
93             >::type
94         > map_type2;
95         test_hp<map_type2>(5, 3);
96     }
97
98     void MultiLevelHashMapHdrTest::dhp_hash128_4_3()
99     {
100         struct traits : public cc::multilevel_hashmap::traits {
101             typedef hash128::make hash;
102             typedef hash128::less less;
103         };
104         typedef cc::MultiLevelHashMap< gc_type, size_t, Item, traits > map_type;
105         test_hp<map_type>(4, 3);
106
107         typedef cc::MultiLevelHashMap< gc_type, size_t, Item,
108             typename cc::multilevel_hashmap::make_traits<
109                 co::hash< hash128::make >
110                 , co::less< hash128::less >
111             >::type
112         > map_type2;
113         test_hp<map_type2>(4, 3);
114     }
115
116     void MultiLevelHashMapHdrTest::dhp_hash128_4_3_stat()
117     {
118         struct traits : public cc::multilevel_hashmap::traits {
119             typedef hash128::make hash;
120             typedef hash128::less less;
121             typedef cc::multilevel_hashmap::stat<> stat;
122             typedef co::v::sequential_consistent memory_model;
123         };
124         typedef cc::MultiLevelHashMap< gc_type, size_t, Item, traits > map_type;
125         test_hp<map_type>(4, 3);
126
127         typedef cc::MultiLevelHashMap< gc_type, size_t, Item,
128             typename cc::multilevel_hashmap::make_traits<
129                 co::hash< hash128::make >
130                 , co::less< hash128::less >
131                 , co::stat< cc::multilevel_hashmap::stat<>>
132                 , co::memory_model< co::v::sequential_consistent >
133             >::type
134         > map_type2;
135         test_hp<map_type2>(4, 3);
136     }
137
138 } // namespace map