4643165f2f0839392436b68f090be6417620ba87
[libcds.git] / tests / test-hdr / set / hdr_intrusive_striped_hashset_splayset.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_intrusive_striped_set.h"
4 #include <cds/intrusive/striped_set/boost_splay_set.h>
5 #include <cds/intrusive/striped_set.h>
6 #include <boost/version.hpp>
7
8 namespace set {
9     namespace bi = boost::intrusive;
10
11     namespace {
12 #   if BOOST_VERSION < 105600
13         typedef bi::splay_set_member_hook<> splay_set_member_hook;
14         typedef bi::splay_set_base_hook<> splay_set_base_hook;
15 #else
16         typedef bi::bs_set_base_hook<> splay_set_member_hook;
17         typedef bi::bs_set_member_hook<> splay_set_base_hook;
18 #endif
19
20         typedef IntrusiveStripedSetHdrTest::base_item< splay_set_base_hook> base_item_type;
21         typedef IntrusiveStripedSetHdrTest::member_item< splay_set_member_hook > member_item_type;
22     }
23
24     void IntrusiveStripedSetHdrTest::Striped_splay_set_basehook()
25     {
26         typedef ci::StripedSet<
27             bi::splay_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
28             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
29             ,co::mutex_policy< ci::striped_set::striping<> >
30         > set_type;
31
32         test<set_type>();
33     }
34
35     void IntrusiveStripedSetHdrTest::Striped_splay_set_basehook_bucket_threshold()
36     {
37         typedef ci::StripedSet<
38             bi::splay_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
39             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
40             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<64> >
41         > set_type;
42
43         test<set_type>();
44     }
45
46     void IntrusiveStripedSetHdrTest::Striped_splay_set_basehook_bucket_threshold_rt()
47     {
48         typedef ci::StripedSet<
49             bi::splay_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
50             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
51             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<0> >
52         > set_type;
53
54         set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>(256) );
55         test_with( s );
56     }
57
58     void IntrusiveStripedSetHdrTest::Striped_splay_set_memberhook()
59     {
60         typedef ci::StripedSet<
61             bi::splay_set<
62                 member_item_type
63                 , bi::member_hook< member_item_type, splay_set_member_hook, &member_item_type::hMember>
64                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
65             >
66             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
67         > set_type;
68
69         test<set_type>();
70     }
71
72     void IntrusiveStripedSetHdrTest::Striped_splay_set_memberhook_bucket_threshold()
73     {
74         typedef ci::StripedSet<
75             bi::splay_set<
76                 member_item_type
77                 , bi::member_hook< member_item_type, splay_set_member_hook, &member_item_type::hMember>
78                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
79             >
80             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
81             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<256> >
82         > set_type;
83
84         test<set_type>();
85     }
86
87     void IntrusiveStripedSetHdrTest::Striped_splay_set_memberhook_bucket_threshold_rt()
88     {
89         typedef ci::StripedSet<
90             bi::splay_set<
91                 member_item_type
92                 , bi::member_hook< member_item_type, splay_set_member_hook, &member_item_type::hMember>
93                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
94             >
95             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
96             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<0> >
97         > set_type;
98
99         set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>(256) );
100         test_with( s );
101     }
102
103 } // namespace set
104
105