3 #include "set/hdr_striped_set.h"
5 #include <boost/version.hpp>
6 #include <cds/details/defs.h>
7 #if CDS_COMPILER == CDS_COMPILER_MSVC && CDS_COMPILER_VERSION == CDS_COMPILER_MSVC12 && BOOST_VERSION <= 105500
9 void StripedSetHdrTest::Striped_boost_list()
11 CPPUNIT_MESSAGE("Skipped; for Microsoft Visual C++ 2013 and boost::container::list you should use boost version 1.56 or above");
15 #elif BOOST_VERSION >= 104800
17 #include <cds/container/striped_set/boost_list.h>
18 #include <cds/container/striped_set.h>
19 #include <cds/sync/spinlock.h>
24 struct my_copy_policy {
25 typedef boost::container::list<StripedSetHdrTest::item> list_type;
26 typedef list_type::iterator iterator;
28 void operator()( list_type& list, iterator itInsert, iterator itWhat )
30 list.insert( itInsert, std::make_pair(itWhat->key(), itWhat->val()) );
33 typedef boost::container::list<StripedSetHdrTest::item> sequence_t;
36 void StripedSetHdrTest::Striped_boost_list()
38 CPPUNIT_MESSAGE( "cmp");
39 typedef cc::StripedSet< sequence_t
40 , co::hash< hash_int >
41 , co::compare< cmp<item> >
43 test_striped2< set_cmp >();
45 CPPUNIT_MESSAGE( "less");
46 typedef cc::StripedSet< sequence_t
47 , co::hash< hash_int >
48 , co::less< less<item> >
50 test_striped2< set_less >();
52 CPPUNIT_MESSAGE( "cmpmix");
53 typedef cc::StripedSet< sequence_t
54 , co::hash< hash_int >
55 , co::compare< cmp<item> >
56 , co::less< less<item> >
58 test_striped2< set_cmpmix >();
60 // Spinlock as lock policy
61 CPPUNIT_MESSAGE( "spinlock");
62 typedef cc::StripedSet< sequence_t
63 , co::hash< hash_int >
64 , co::less< less<item> >
65 , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> >
67 test_striped2< set_spin >();
70 CPPUNIT_MESSAGE( "load_factor_resizing<0>(8)");
72 typedef cc::StripedSet< sequence_t
73 , co::hash< hash_int >
74 , co::less< less<item> >
75 , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
76 > set_less_resizing_lf;
77 set_less_resizing_lf s( 30, cc::striped_set::load_factor_resizing<0>(8));
81 CPPUNIT_MESSAGE( "load_factor_resizing<4>");
82 typedef cc::StripedSet< sequence_t
83 , co::hash< hash_int >
84 , co::less< less<item> >
85 , co::resizing_policy< cc::striped_set::load_factor_resizing<4> >
86 > set_less_resizing_lf16;
87 test_striped2< set_less_resizing_lf16 >();
89 CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(8)");
91 typedef cc::StripedSet< sequence_t
92 , co::hash< hash_int >
93 , co::less< less<item> >
94 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
95 > set_less_resizing_sbt;
96 set_less_resizing_sbt s(30, cc::striped_set::single_bucket_size_threshold<0>(8) );
100 CPPUNIT_MESSAGE( "single_bucket_size_threshold<6>");
101 typedef cc::StripedSet< sequence_t
102 , co::hash< hash_int >
103 , co::less< less<item> >
104 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<6> >
105 > set_less_resizing_sbt6;
106 test_striped2< set_less_resizing_sbt6 >();
110 CPPUNIT_MESSAGE( "copy_item");
111 typedef cc::StripedSet< sequence_t
112 , co::hash< hash_int >
113 , co::compare< cmp<item> >
114 , co::copy_policy< cc::striped_set::copy_item >
116 test_striped2< set_copy_item >();
118 CPPUNIT_MESSAGE( "swap_item");
119 typedef cc::StripedSet< sequence_t
120 , co::hash< hash_int >
121 , co::compare< cmp<item> >
122 , co::copy_policy< cc::striped_set::swap_item >
124 test_striped2< set_swap_item >();
126 CPPUNIT_MESSAGE( "move_item");
127 typedef cc::StripedSet< sequence_t
128 , co::hash< hash_int >
129 , co::compare< cmp<item> >
130 , co::copy_policy< cc::striped_set::move_item >
132 test_striped2< set_move_item >();
134 CPPUNIT_MESSAGE( "special copy policy");
135 typedef cc::StripedSet< sequence_t
136 , co::hash< hash_int >
137 , co::compare< cmp<item> >
138 , co::copy_policy< my_copy_policy >
139 > set_special_copy_item;
140 test_striped2< set_special_copy_item >();
145 #else // BOOST_VERSION < 104800
148 void StripedSetHdrTest::Striped_boost_list()
150 CPPUNIT_MESSAGE( "Skipped; for boost::container::list you should use boost version 1.48 or above" );
153 #endif // BOOST_VERSION