Move libcds 1.6.0 from SVN
[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::type_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::type_traits
15         {
16             typedef HashMapHdrTest::cmp   compare;
17         };
18
19         struct nogc_less_traits: public cc::lazy_list::type_traits
20         {
21             typedef HashMapHdrTest::less  less;
22         };
23
24         struct nogc_cmpmix_traits: public cc::lazy_list::type_traits
25         {
26             typedef HashMapHdrTest::cmp   compare;
27             typedef HashMapHdrTest::less  less;
28         };
29     }
30
31     void HashMapHdrTest::Lazy_nogc_cmp()
32     {
33         typedef cc::LazyKVList< cds::gc::nogc, int, HashMapHdrTest::value_type, nogc_cmp_traits > list;
34
35         // traits-based version
36         typedef cc::MichaelHashMap< cds::gc::nogc, list, map_traits > map;
37         test_int_nogc< map >();
38
39         // option-based version
40         typedef cc::MichaelHashMap< cds::gc::nogc, list,
41             cc::michael_map::make_traits<
42                 cc::opt::hash< hash_int >
43                 ,cc::opt::item_counter< simple_item_counter >
44             >::type
45         > opt_map;
46         test_int_nogc< opt_map >();
47     }
48
49     void HashMapHdrTest::Lazy_nogc_less()
50     {
51         typedef cc::LazyKVList< cds::gc::nogc, int, HashMapHdrTest::value_type, nogc_less_traits > list;
52
53         // traits-based version
54         typedef cc::MichaelHashMap< cds::gc::nogc, list, map_traits > map;
55         test_int_nogc< map >();
56
57         // option-based version
58         typedef cc::MichaelHashMap< cds::gc::nogc, list,
59             cc::michael_map::make_traits<
60                 cc::opt::hash< hash_int >
61                 ,cc::opt::item_counter< simple_item_counter >
62             >::type
63         > opt_map;
64         test_int_nogc< opt_map >();
65     }
66
67     void HashMapHdrTest::Lazy_nogc_cmpmix()
68     {
69         typedef cc::LazyKVList< cds::gc::nogc, int, HashMapHdrTest::value_type, nogc_cmpmix_traits > list;
70
71         // traits-based version
72         typedef cc::MichaelHashMap< cds::gc::nogc, list, map_traits > map;
73         test_int_nogc< map >();
74
75         // option-based version
76         typedef cc::MichaelHashMap< cds::gc::nogc, list,
77             cc::michael_map::make_traits<
78                 cc::opt::hash< hash_int >
79                 ,cc::opt::item_counter< simple_item_counter >
80             >::type
81         > opt_map;
82         test_int_nogc< opt_map >();
83     }
84
85 }   // namespace map