Remove unused vars
[libcds.git] / tests / test-hdr / map / hdr_refinable_hashmap_boost_unordered_map.cpp
1 //$$CDS-header$$
2
3 #include "map/hdr_striped_map.h"
4 #include <cds/container/striped_map/boost_unordered_map.h>
5 #include <cds/container/striped_map.h>
6 #include <cds/lock/spinlock.h>
7
8 namespace map {
9
10     namespace {
11         typedef boost::unordered_map< StripedMapHdrTest::key_type, StripedMapHdrTest::value_type > map_t;
12
13         struct my_copy_policy {
14             typedef map_t::iterator iterator;
15
16             void operator()( map_t& m, iterator /*itInsert*/, iterator itWhat )
17             {
18                 m.insert( std::make_pair(itWhat->first, itWhat->second ) );
19             }
20         };
21     }
22
23     void StripedMapHdrTest::Refinable_boost_unordered_map()
24     {
25         CPPUNIT_MESSAGE( "cmp");
26         typedef cc::StripedMap< map_t
27             ,co::mutex_policy< cc::striped_set::refinable<> >
28             , co::hash< hash_int >
29             , co::compare< cmp >
30         >   map_cmp;
31         test_striped< map_cmp >();
32
33         CPPUNIT_MESSAGE( "less");
34         typedef cc::StripedMap< map_t
35             ,co::mutex_policy< cc::striped_set::refinable<> >
36             , co::hash< hash_int >
37             , co::less< less >
38         >   map_less;
39         test_striped< map_less >();
40
41         CPPUNIT_MESSAGE( "cmpmix");
42         typedef cc::StripedMap< map_t
43             ,co::mutex_policy< cc::striped_set::refinable<> >
44             , co::hash< hash_int >
45             , co::compare< cmp >
46             , co::less< less >
47         >   map_cmpmix;
48         test_striped< map_cmpmix >();
49
50         // Spinlock as lock policy
51         CPPUNIT_MESSAGE( "spinlock");
52         typedef cc::StripedMap< map_t
53             ,co::mutex_policy< cc::striped_set::refinable<cds::lock::Spin> >
54             , co::hash< hash_int >
55             , co::less< less >
56         >   map_spin;
57         test_striped< map_spin >();
58
59         // Resizing policy
60         CPPUNIT_MESSAGE( "load_factor_resizing<0>(1024)");
61         {
62             typedef cc::StripedMap< map_t
63                 ,co::mutex_policy< cc::striped_set::refinable<> >
64                 , co::hash< hash_int >
65                 , co::less< less >
66                 , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
67             >   map_less_resizing_lf;
68             map_less_resizing_lf m(30, cc::striped_set::load_factor_resizing<0>(1024));
69             test_striped_with(m);
70         }
71
72         CPPUNIT_MESSAGE( "load_factor_resizing<256>");
73         typedef cc::StripedMap< map_t
74             ,co::mutex_policy< cc::striped_set::refinable<> >
75             , co::hash< hash_int >
76             , co::less< less >
77             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
78         >   map_less_resizing_lf16;
79         test_striped< map_less_resizing_lf16 >();
80
81         CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(1024)");
82         {
83             typedef cc::StripedMap< map_t
84                 ,co::mutex_policy< cc::striped_set::refinable<> >
85                 , co::hash< hash_int >
86                 , co::compare< cmp >
87                 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
88             >   map_less_resizing_sbt;
89             map_less_resizing_sbt m(30, cc::striped_set::single_bucket_size_threshold<0>(1024));
90             test_striped_with(m);
91         }
92
93         CPPUNIT_MESSAGE( "single_bucket_size_threshold<256>");
94         typedef cc::StripedMap< map_t
95             ,co::mutex_policy< cc::striped_set::refinable<> >
96             , co::hash< hash_int >
97             , co::less< less >
98             , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<256> >
99         >   map_less_resizing_sbt16;
100         test_striped< map_less_resizing_sbt16 >();
101
102         // Copy policy
103         CPPUNIT_MESSAGE( "load_factor_resizing<256>, copy_item");
104         typedef cc::StripedMap< map_t
105             ,co::mutex_policy< cc::striped_set::refinable<> >
106             , co::hash< hash_int >
107             , co::less< less >
108             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
109             , co::copy_policy< cc::striped_set::copy_item >
110         >   set_copy_item;
111         test_striped< set_copy_item >();
112
113         CPPUNIT_MESSAGE( "load_factor_resizing<256>, swap_item");
114         typedef cc::StripedMap< map_t
115             ,co::mutex_policy< cc::striped_set::refinable<> >
116             , co::hash< hash_int >
117             , co::less< less >
118             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
119             , co::copy_policy< cc::striped_set::swap_item >
120         >   set_swap_item;
121         test_striped< set_swap_item >();
122
123         CPPUNIT_MESSAGE( "load_factor_resizing<256>, move_item");
124         typedef cc::StripedMap< map_t
125             ,co::mutex_policy< cc::striped_set::refinable<> >
126             , co::hash< hash_int >
127             , co::less< less >
128             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
129             , co::copy_policy< cc::striped_set::move_item >
130         >   set_move_item;
131         test_striped< set_move_item >();
132
133         CPPUNIT_MESSAGE( "load_factor_resizing<256>, special copy_policy");
134         typedef cc::StripedMap< map_t
135             ,co::mutex_policy< cc::striped_set::refinable<> >
136             , co::hash< hash_int >
137             , co::less< less >
138             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
139             , co::copy_policy< my_copy_policy >
140         >   set_special_copy_item;
141         test_striped< set_special_copy_item >();
142
143     }
144
145 }   // namespace map
146