bugfix in cds::gc::HP::guarded_ptr
[libcds.git] / tests / test-hdr / set / hdr_intrusive_refinable_hashset_treapset.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_striped_set.h"
4 #include <cds/intrusive/striped_set/boost_treap_set.h>
5 #include <cds/intrusive/striped_set.h>
6
7 namespace set {
8     namespace bi = boost::intrusive;
9
10     namespace {
11         typedef IntrusiveStripedSetHdrTest::base_item< bi::bs_set_base_hook<> > base_item_type;
12         typedef IntrusiveStripedSetHdrTest::member_item< bi::bs_set_member_hook<> > member_item_type;
13
14         template <typename T>
15         struct priority_cmp: private IntrusiveStripedSetHdrTest::less<T>
16         {
17             typedef IntrusiveStripedSetHdrTest::less<T> base_class;
18
19             template <typename A, typename B>
20             bool operator()( A const& a, B const& b ) const
21             {
22                 return base_class::operator()( b, a );
23             }
24         };
25     }
26
27     void IntrusiveStripedSetHdrTest::Refinable_treap_set_basehook()
28     {
29         typedef ci::StripedSet<
30             bi::treap_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> >, bi::priority<priority_cmp<base_item_type> >  >
31             ,co::mutex_policy< ci::striped_set::refinable<> >
32             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
33         > set_type;
34
35         test<set_type>();
36     }
37
38     void IntrusiveStripedSetHdrTest::Refinable_treap_set_basehook_bucket_threshold()
39     {
40         typedef ci::StripedSet<
41             bi::treap_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> >, bi::priority<priority_cmp<base_item_type> > >
42             ,co::mutex_policy< ci::striped_set::refinable<> >
43             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
44             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<64> >
45         > set_type;
46
47         test<set_type>();
48     }
49
50     void IntrusiveStripedSetHdrTest::Refinable_treap_set_basehook_bucket_threshold_rt()
51     {
52         typedef ci::StripedSet<
53             bi::treap_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> >, bi::priority<priority_cmp<base_item_type> > >
54             ,co::mutex_policy< ci::striped_set::refinable<> >
55             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
56             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<0> >
57         > set_type;
58
59         set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>(256) );
60         test_with( s );
61     }
62
63     void IntrusiveStripedSetHdrTest::Refinable_treap_set_memberhook()
64     {
65         typedef ci::StripedSet<
66             bi::treap_set<
67                 member_item_type
68                 , bi::member_hook< member_item_type, bi::bs_set_member_hook<>, &member_item_type::hMember>
69                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
70                 , bi::priority<priority_cmp<member_item_type> >
71             >
72             ,co::mutex_policy< ci::striped_set::refinable<> >
73             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
74         > set_type;
75
76         test<set_type>();
77     }
78
79     void IntrusiveStripedSetHdrTest::Refinable_treap_set_memberhook_bucket_threshold()
80     {
81         typedef ci::StripedSet<
82             bi::treap_set<
83                 member_item_type
84                 , bi::member_hook< member_item_type, bi::bs_set_member_hook<>, &member_item_type::hMember>
85                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
86                 , bi::priority<priority_cmp<member_item_type> >
87             >
88             ,co::mutex_policy< ci::striped_set::refinable<> >
89             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
90             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<256> >
91         > set_type;
92
93         test<set_type>();
94     }
95
96     void IntrusiveStripedSetHdrTest::Refinable_treap_set_memberhook_bucket_threshold_rt()
97     {
98         typedef ci::StripedSet<
99             bi::treap_set<
100                 member_item_type
101                 , bi::member_hook< member_item_type, bi::bs_set_member_hook<>, &member_item_type::hMember>
102                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
103                 , bi::priority<priority_cmp<member_item_type> >
104             >
105             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
106             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<0> >
107             ,co::mutex_policy< ci::striped_set::refinable<> >
108         > set_type;
109
110         set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>(256) );
111         test_with( s );
112     }
113
114 } // namespace set
115
116