MichaelMap refactoring
[libcds.git] / tests / test-hdr / set / hdr_splitlist_set_lazy_ptb.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_set.h"
4 #include <cds/container/lazy_list_dhp.h>
5 #include <cds/container/split_list_set.h>
6
7 namespace set {
8
9     namespace {
10         struct PTB_cmp_traits: public cc::split_list::type_traits
11         {
12             typedef cc::lazy_list_tag                   ordered_list;
13             typedef HashSetHdrTest::hash_int            hash;
14             typedef HashSetHdrTest::simple_item_counter item_counter;
15             typedef cc::opt::v::relaxed_ordering        memory_model;
16             enum { dynamic_bucket_table = false };
17
18             struct ordered_list_traits: public cc::lazy_list::type_traits
19             {
20                 typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
21             };
22         };
23
24         struct PTB_less_traits: public cc::split_list::type_traits
25         {
26             typedef cc::lazy_list_tag                ordered_list;
27             typedef HashSetHdrTest::hash_int            hash;
28             typedef HashSetHdrTest::simple_item_counter item_counter;
29             typedef cc::opt::v::sequential_consistent                      memory_model;
30             enum { dynamic_bucket_table = false };
31
32             struct ordered_list_traits: public cc::lazy_list::type_traits
33             {
34                 typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
35             };
36         };
37
38         struct PTB_cmpmix_traits: public cc::split_list::type_traits
39         {
40             typedef cc::lazy_list_tag                ordered_list;
41             typedef HashSetHdrTest::hash_int            hash;
42             typedef HashSetHdrTest::simple_item_counter item_counter;
43
44             struct ordered_list_traits: public cc::lazy_list::type_traits
45             {
46                 typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
47                 typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
48             };
49         };
50     }
51
52     void HashSetHdrTest::Split_Lazy_PTB_cmp()
53     {
54         // traits-based version
55         typedef cc::SplitListSet< cds::gc::PTB, item, PTB_cmp_traits > set;
56
57         test_int< set >();
58
59         // option-based version
60         typedef cc::SplitListSet< cds::gc::PTB, item,
61             cc::split_list::make_traits<
62                 cc::split_list::ordered_list<cc::lazy_list_tag>
63                 ,cc::opt::hash< hash_int >
64                 ,cc::opt::item_counter< simple_item_counter >
65                 ,cc::opt::memory_model< cc::opt::v::relaxed_ordering >
66                 ,cc::split_list::dynamic_bucket_table< true >
67                 ,cc::split_list::ordered_list_traits<
68                     cc::lazy_list::make_traits<
69                         cc::opt::compare< cmp<item> >
70                     >::type
71                 >
72             >::type
73         > opt_set;
74         test_int< opt_set >();
75     }
76
77     void HashSetHdrTest::Split_Lazy_PTB_less()
78     {
79         // traits-based version
80         typedef cc::SplitListSet< cds::gc::PTB, item, PTB_less_traits > set;
81
82         test_int< set >();
83
84         // option-based version
85         typedef cc::SplitListSet< cds::gc::PTB, item,
86             cc::split_list::make_traits<
87                 cc::split_list::ordered_list<cc::lazy_list_tag>
88                 ,cc::opt::hash< hash_int >
89                 ,cc::opt::item_counter< simple_item_counter >
90                 ,cc::opt::memory_model< cc::opt::v::sequential_consistent >
91                 ,cc::split_list::dynamic_bucket_table< false >
92                 ,cc::split_list::ordered_list_traits<
93                     cc::lazy_list::make_traits<
94                         cc::opt::less< less<item> >
95                     >::type
96                 >
97             >::type
98         > opt_set;
99         test_int< opt_set >();
100     }
101
102     void HashSetHdrTest::Split_Lazy_PTB_cmpmix()
103     {
104         // traits-based version
105         typedef cc::SplitListSet< cds::gc::PTB, item, PTB_cmpmix_traits > set;
106         test_int< set >();
107
108         // option-based version
109         typedef cc::SplitListSet< cds::gc::PTB, item,
110             cc::split_list::make_traits<
111                 cc::split_list::ordered_list<cc::lazy_list_tag>
112                 ,cc::opt::hash< hash_int >
113                 ,cc::opt::item_counter< simple_item_counter >
114                 ,cc::split_list::ordered_list_traits<
115                     cc::lazy_list::make_traits<
116                         cc::opt::less< less<item> >
117                         ,cc::opt::compare< cmp<item> >
118                     >::type
119                 >
120             >::type
121         > opt_set;
122         test_int< opt_set >();
123     }
124
125
126 } // namespace set
127
128