3 #include "map/hdr_striped_map.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 StripedMapHdrTest::Refinable_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_map/boost_list.h>
18 #include <cds/container/striped_map.h>
19 #include <cds/lock/spinlock.h>
24 typedef boost::container::list< StripedMapHdrTest::pair_type > sequence_t;
26 struct my_copy_policy {
27 typedef sequence_t::iterator iterator;
29 void operator()( sequence_t& list, iterator itInsert, iterator itWhat )
31 list.insert( itInsert, std::make_pair(itWhat->first, itWhat->second ));
36 void StripedMapHdrTest::Refinable_boost_list()
38 CPPUNIT_MESSAGE( "cmp");
39 typedef cc::StripedMap< sequence_t
40 ,co::mutex_policy< cc::striped_set::refinable<> >
41 , co::hash< hash_int >
44 test_striped2< map_cmp >();
46 CPPUNIT_MESSAGE( "less");
47 typedef cc::StripedMap< sequence_t
48 ,co::mutex_policy< cc::striped_set::refinable<> >
49 , co::hash< hash_int >
52 test_striped2< map_less >();
54 CPPUNIT_MESSAGE( "cmpmix");
55 typedef cc::StripedMap< sequence_t
56 ,co::mutex_policy< cc::striped_set::refinable<> >
57 , co::hash< hash_int >
61 test_striped2< map_cmpmix >();
63 // Spinlock as lock policy
64 CPPUNIT_MESSAGE( "spinlock");
65 typedef cc::StripedMap< sequence_t
66 ,co::mutex_policy< cc::striped_set::refinable<cds::lock::Spin> >
67 , co::hash< hash_int >
70 test_striped2< map_spin >();
73 CPPUNIT_MESSAGE( "load_factor_resizing<0>(8)");
75 typedef cc::StripedMap< sequence_t
76 ,co::mutex_policy< cc::striped_set::refinable<> >
77 , co::hash< hash_int >
79 , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
80 > pair_type_less_resizing_lf;
81 pair_type_less_resizing_lf m(30, cc::striped_set::load_factor_resizing<0>(8) );
85 CPPUNIT_MESSAGE( "load_factor_resizing<4>");
86 typedef cc::StripedMap< sequence_t
87 ,co::mutex_policy< cc::striped_set::refinable<> >
88 , co::hash< hash_int >
90 , co::resizing_policy< cc::striped_set::load_factor_resizing<4> >
91 > map_less_resizing_lf16;
92 test_striped2< map_less_resizing_lf16 >();
95 CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(8)");
96 typedef cc::StripedMap< sequence_t
97 ,co::mutex_policy< cc::striped_set::refinable<> >
98 , co::hash< hash_int >
100 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
101 > map_less_resizing_sbt;
102 map_less_resizing_sbt m(30, cc::striped_set::single_bucket_size_threshold<0>(8));
103 test_striped_with(m);
106 CPPUNIT_MESSAGE( "single_bucket_size_threshold<6>");
107 typedef cc::StripedMap< sequence_t
108 ,co::mutex_policy< cc::striped_set::refinable<> >
109 , co::hash< hash_int >
111 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<6> >
112 > map_less_resizing_sbt16;
113 test_striped2< map_less_resizing_sbt16 >();
116 CPPUNIT_MESSAGE( "copy_item");
117 typedef cc::StripedMap< sequence_t
118 ,co::mutex_policy< cc::striped_set::refinable<> >
119 , co::hash< hash_int >
121 , co::copy_policy< cc::striped_set::copy_item >
123 test_striped2< set_copy_item >();
125 CPPUNIT_MESSAGE( "swap_item");
126 typedef cc::StripedMap< sequence_t
127 ,co::mutex_policy< cc::striped_set::refinable<> >
128 , co::hash< hash_int >
130 , co::copy_policy< cc::striped_set::swap_item >
132 test_striped2< set_swap_item >();
134 CPPUNIT_MESSAGE( "move_item");
135 typedef cc::StripedMap< sequence_t
136 , co::hash< hash_int >
137 ,co::mutex_policy< cc::striped_set::refinable<> >
139 , co::copy_policy< cc::striped_set::move_item >
141 test_striped2< set_move_item >();
143 CPPUNIT_MESSAGE( "special copy_item");
144 typedef cc::StripedMap< sequence_t
145 , co::hash< hash_int >
147 ,co::mutex_policy< cc::striped_set::refinable<> >
148 , co::copy_policy< my_copy_policy >
149 > set_special_copy_item;
150 test_striped2< set_special_copy_item >();
155 #else // BOOST_VERSION < 104800
158 void StripedMapHdrTest::Refinable_boost_list()
160 CPPUNIT_MESSAGE( "Skipped; for boost::container::list you should use boost version 1.48 or above" );
163 #endif // BOOST_VERSION