Remove unused vars
[libcds.git] / tests / test-hdr / map / hdr_striped_hashmap_hashmap_std.cpp
1 //$$CDS-header$$
2
3 #include "map/hdr_striped_map.h"
4 #include <cds/container/striped_map/std_hash_map.h>
5 #include <cds/container/striped_map.h>
6 #include <cds/lock/spinlock.h>
7
8 #if !((CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CDS_OSI_WINDOWS)) && _MSC_VER < 1600)
9
10 namespace map {
11
12     namespace {
13         typedef std::unordered_map< StripedMapHdrTest::key_type, StripedMapHdrTest::value_type > map_t;
14
15         struct my_copy_policy {
16             typedef map_t::iterator iterator;
17
18             void operator()( map_t& m, iterator /*itInsert*/, iterator itWhat )
19             {
20                 m.insert( std::make_pair(itWhat->first, itWhat->second ) );
21             }
22         };
23     }
24
25     void StripedMapHdrTest::Striped_hashmap()
26     {
27         CPPUNIT_MESSAGE( "cmp");
28         typedef cc::StripedMap< map_t
29             , co::hash< hash_int >
30             , co::compare< cmp >
31             ,co::mutex_policy< cc::striped_set::striping<> >
32         >   map_cmp;
33         test_striped< map_cmp >();
34
35         CPPUNIT_MESSAGE( "less");
36         typedef cc::StripedMap< map_t
37             , co::hash< hash_int >
38             , co::less< less >
39         >   map_less;
40         test_striped< map_less >();
41
42         CPPUNIT_MESSAGE( "cmpmix");
43         typedef cc::StripedMap< map_t
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::hash< hash_int >
54             , co::less< less >
55             ,co::mutex_policy< cc::striped_set::striping<cds::lock::Spin> >
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::hash< hash_int >
64                 , co::less< less >
65                 , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
66             >   map_less_resizing_lf;
67             map_less_resizing_lf m(30, cc::striped_set::load_factor_resizing<0>(1024));
68             test_striped_with(m);
69         }
70
71         CPPUNIT_MESSAGE( "load_factor_resizing<256>");
72         typedef cc::StripedMap< map_t
73             , co::hash< hash_int >
74             , co::less< less >
75             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
76         >   map_less_resizing_lf16;
77         test_striped< map_less_resizing_lf16 >();
78
79         CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(1024)");
80         {
81             typedef cc::StripedMap< map_t
82                 , co::hash< hash_int >
83                 , co::compare< cmp >
84                 , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
85             >   map_less_resizing_sbt;
86             map_less_resizing_sbt m(30, cc::striped_set::single_bucket_size_threshold<0>(1024));
87             test_striped_with(m);
88         }
89
90         CPPUNIT_MESSAGE( "single_bucket_size_threshold<256>");
91         typedef cc::StripedMap< map_t
92             , co::hash< hash_int >
93             , co::less< less >
94             , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<256> >
95         >   map_less_resizing_sbt16;
96         test_striped< map_less_resizing_sbt16 >();
97
98         // Copy policy
99         CPPUNIT_MESSAGE( "load_factor_resizing<256>, copy_item");
100         typedef cc::StripedMap< map_t
101             , co::hash< hash_int >
102             , co::less< less >
103             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
104             , co::copy_policy< cc::striped_set::copy_item >
105         >   set_copy_item;
106         test_striped< set_copy_item >();
107
108         CPPUNIT_MESSAGE( "load_factor_resizing<256>, swap_item");
109         typedef cc::StripedMap< map_t
110             , co::hash< hash_int >
111             , co::less< less >
112             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
113             , co::copy_policy< cc::striped_set::swap_item >
114         >   set_swap_item;
115         test_striped< set_swap_item >();
116
117         CPPUNIT_MESSAGE( "load_factor_resizing<256>, move_item");
118         typedef cc::StripedMap< map_t
119             , co::hash< hash_int >
120             , co::less< less >
121             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
122             , co::copy_policy< cc::striped_set::move_item >
123         >   set_move_item;
124         test_striped< set_move_item >();
125
126         CPPUNIT_MESSAGE( "load_factor_resizing<256>, special copy_policy");
127         typedef cc::StripedMap< map_t
128             , co::hash< hash_int >
129             , co::less< less >
130             , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
131             , co::copy_policy< my_copy_policy >
132         >   set_special_copy_item;
133         test_striped< set_special_copy_item >();
134     }
135
136 }   // namespace map
137
138 #endif // #if !(CDS_COMPILER == CDS_COMPILER_MSVC && CDS_COMPILER_VERSION < 1600)