Merge pull request #24 from krinkinmu/unordered-list-wip
[libcds.git] / tests / test-hdr / map / hdr_michael_map_lazy_nogc.cpp
1 //$$CDS-header$$
2
3 #include "map/hdr_map.h"
4 #include <cds/container/lazy_kvlist_nogc.h>
5 #include <cds/container/michael_map_nogc.h>
6
7 namespace map {
8     namespace {
9         struct map_traits: public cc::michael_map::traits
10         {
11             typedef HashMapHdrTest::hash_int            hash;
12             typedef HashMapHdrTest::simple_item_counter item_counter;
13         };
14         struct nogc_cmp_traits: public cc::lazy_list::traits
15         {
16             typedef HashMapHdrTest::cmp   compare;
17         };
18
19         struct nogc_less_traits: public cc::lazy_list::traits
20         {
21             typedef HashMapHdrTest::less  less;
22         };
23
24         struct nogc_cmpmix_traits: public cc::lazy_list::traits
25         {
26             typedef HashMapHdrTest::cmp   compare;
27             typedef HashMapHdrTest::less  less;
28         };
29
30         struct nogc_equal_traits: public cc::lazy_list::traits
31         {
32             typedef HashMapHdrTest::equal  equal_to;
33             static const bool sort = false;
34         };
35     }
36
37     void HashMapHdrTest::Lazy_nogc_cmp()
38     {
39         typedef cc::LazyKVList< cds::gc::nogc, int, HashMapHdrTest::value_type, nogc_cmp_traits > list;
40
41         // traits-based version
42         typedef cc::MichaelHashMap< cds::gc::nogc, list, map_traits > map;
43         test_int_nogc< map >();
44
45         // option-based version
46         typedef cc::MichaelHashMap< cds::gc::nogc, list,
47             cc::michael_map::make_traits<
48                 cc::opt::hash< hash_int >
49                 ,cc::opt::item_counter< simple_item_counter >
50             >::type
51         > opt_map;
52         test_int_nogc< opt_map >();
53     }
54
55     void HashMapHdrTest::Lazy_nogc_less()
56     {
57         typedef cc::LazyKVList< cds::gc::nogc, int, HashMapHdrTest::value_type, nogc_less_traits > list;
58
59         // traits-based version
60         typedef cc::MichaelHashMap< cds::gc::nogc, list, map_traits > map;
61         test_int_nogc< map >();
62
63         // option-based version
64         typedef cc::MichaelHashMap< cds::gc::nogc, list,
65             cc::michael_map::make_traits<
66                 cc::opt::hash< hash_int >
67                 ,cc::opt::item_counter< simple_item_counter >
68             >::type
69         > opt_map;
70         test_int_nogc< opt_map >();
71     }
72
73     void HashMapHdrTest::Lazy_nogc_equal()
74     {
75         typedef cc::LazyKVList< cds::gc::nogc, int, HashMapHdrTest::value_type, nogc_equal_traits > list;
76
77         // traits-based version
78         typedef cc::MichaelHashMap< cds::gc::nogc, list, map_traits > map;
79         test_int_nogc_unordered< map >();
80
81         // option-based version
82         typedef cc::MichaelHashMap< cds::gc::nogc, list,
83             cc::michael_map::make_traits<
84                 cc::opt::hash< hash_int >
85                 ,cc::opt::item_counter< simple_item_counter >
86             >::type
87         > opt_map;
88         test_int_nogc_unordered< opt_map >();
89     }
90
91     void HashMapHdrTest::Lazy_nogc_cmpmix()
92     {
93         typedef cc::LazyKVList< cds::gc::nogc, int, HashMapHdrTest::value_type, nogc_cmpmix_traits > list;
94
95         // traits-based version
96         typedef cc::MichaelHashMap< cds::gc::nogc, list, map_traits > map;
97         test_int_nogc< map >();
98
99         // option-based version
100         typedef cc::MichaelHashMap< cds::gc::nogc, list,
101             cc::michael_map::make_traits<
102                 cc::opt::hash< hash_int >
103                 ,cc::opt::item_counter< simple_item_counter >
104             >::type
105         > opt_map;
106         test_int_nogc< opt_map >();
107     }
108
109 }   // namespace map