intrusive MultiLevelHashSet:
[libcds.git] / tests / test-hdr / set / hdr_intrusive_multilevel_hashset_hp.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_multilevel_hashset.h"
4 #include <cds/intrusive/multilevel_hashset_hp.h>
5 #include "unit/print_multilevel_hashset_stat.h"
6
7 namespace set {
8     namespace {
9         typedef cds::gc::HP gc_type;
10     } // namespace
11
12     void IntrusiveMultiLevelHashSetHdrTest::hp_stdhash()
13     {
14         typedef size_t hash_type;
15
16         struct traits: public ci::multilevel_hashset::traits
17         {
18             typedef get_hash<hash_type> hash_accessor;
19             typedef item_disposer disposer;
20         };
21         typedef ci::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
22         static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
23         test_hp<set_type, std::hash<hash_type>>(4, 2);
24
25         typedef ci::MultiLevelHashSet< 
26             gc_type, 
27             Item<hash_type>, 
28             typename ci::multilevel_hashset::make_traits<
29                 ci::multilevel_hashset::hash_accessor< get_hash<hash_type>>
30                 , ci::opt::disposer< item_disposer >
31             >::type
32         > set_type2;
33         test_hp<set_type2, std::hash<hash_type>>(4, 2);
34     }
35
36     void IntrusiveMultiLevelHashSetHdrTest::hp_stdhash_stat()
37     {
38         typedef size_t hash_type;
39
40         struct traits: public ci::multilevel_hashset::traits
41         {
42             typedef get_hash<hash_type> hash_accessor;
43             typedef item_disposer disposer;
44             typedef ci::multilevel_hashset::stat<> stat;
45         };
46         typedef ci::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
47         static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
48         test_hp<set_type, std::hash<hash_type>>(4, 2);
49
50         typedef ci::MultiLevelHashSet< 
51             gc_type, 
52             Item<hash_type>, 
53             typename ci::multilevel_hashset::make_traits<
54                 ci::multilevel_hashset::hash_accessor< get_hash<hash_type>>
55                 , ci::opt::disposer< item_disposer >
56                 ,co::stat< ci::multilevel_hashset::stat<>>
57             >::type
58         > set_type2;
59         test_hp<set_type2, std::hash<hash_type>>(4, 2);
60     }
61
62     void IntrusiveMultiLevelHashSetHdrTest::hp_stdhash_5_3()
63     {
64         typedef size_t hash_type;
65
66         struct traits: public ci::multilevel_hashset::traits
67         {
68             typedef get_hash<hash_type> hash_accessor;
69             typedef item_disposer disposer;
70         };
71         typedef ci::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
72         static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
73         test_hp<set_type, std::hash<hash_type>>(5, 3);
74
75         typedef ci::MultiLevelHashSet< 
76             gc_type, 
77             Item<hash_type>, 
78             typename ci::multilevel_hashset::make_traits<
79                 ci::multilevel_hashset::hash_accessor< get_hash<hash_type>>
80                 , ci::opt::disposer< item_disposer >
81             >::type
82         > set_type2;
83         test_hp<set_type2, std::hash<hash_type>>(5, 3);
84     }
85
86     void IntrusiveMultiLevelHashSetHdrTest::hp_stdhash_5_3_stat()
87     {
88         typedef size_t hash_type;
89
90         struct traits: public ci::multilevel_hashset::traits
91         {
92             typedef get_hash<hash_type> hash_accessor;
93             typedef item_disposer disposer;
94             typedef ci::multilevel_hashset::stat<> stat;
95         };
96         typedef ci::MultiLevelHashSet< gc_type, Item<hash_type>, traits > set_type;
97         static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
98         test_hp<set_type, std::hash<hash_type>>(5, 3);
99
100         typedef ci::MultiLevelHashSet< 
101             gc_type, 
102             Item<hash_type>, 
103             typename ci::multilevel_hashset::make_traits<
104                 ci::multilevel_hashset::hash_accessor< get_hash<hash_type>>
105                 , ci::opt::disposer< item_disposer >
106                 ,co::stat< ci::multilevel_hashset::stat<>>
107             >::type
108         > set_type2;
109         test_hp<set_type2, std::hash<hash_type>>(5, 3);
110     }
111
112 } // namespace set
113
114 CPPUNIT_TEST_SUITE_REGISTRATION(set::IntrusiveMultiLevelHashSetHdrTest);