bugfix in cds::gc::HP::guarded_ptr
[libcds.git] / tests / test-hdr / set / hdr_splitlist_set_lazy_nogc.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_set.h"
4 #include <cds/container/lazy_list_nogc.h>
5 #include <cds/container/split_list_set_nogc.h>
6
7 namespace set {
8
9     namespace {
10         struct nogc_cmp_traits: public cc::split_list::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::traits
19             {
20                 typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
21             };
22         };
23
24         struct nogc_less_traits: public cc::split_list::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::traits
33             {
34                 typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
35             };
36         };
37
38         struct nogc_cmpmix_traits: public cc::split_list::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::traits
45             {
46                 typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
47                 typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
48             };
49         };
50
51         struct nogc_cmpmix_stat_traits : public nogc_cmpmix_traits
52         {
53             typedef cc::split_list::stat<> stat;
54         };
55     }
56
57     void HashSetHdrTest::Split_Lazy_nogc_cmp()
58     {
59         // traits-based version
60         typedef cc::SplitListSet< cds::gc::nogc, item, nogc_cmp_traits > set;
61
62         test_int_nogc< set >();
63
64         // option-based version
65         typedef cc::SplitListSet< cds::gc::nogc, item,
66             cc::split_list::make_traits<
67                 cc::split_list::ordered_list<cc::lazy_list_tag>
68                 ,cc::opt::hash< hash_int >
69                 ,cc::opt::item_counter< simple_item_counter >
70                 ,cc::opt::memory_model< cc::opt::v::relaxed_ordering >
71                 ,cc::split_list::dynamic_bucket_table< true >
72                 ,cc::split_list::ordered_list_traits<
73                     cc::lazy_list::make_traits<
74                         cc::opt::compare< cmp<item> >
75                     >::type
76                 >
77             >::type
78         > opt_set;
79         test_int_nogc< opt_set >();
80     }
81
82     void HashSetHdrTest::Split_Lazy_nogc_less()
83     {
84         // traits-based version
85         typedef cc::SplitListSet< cds::gc::nogc, item, nogc_less_traits > set;
86
87         test_int_nogc< set >();
88
89         // option-based version
90         typedef cc::SplitListSet< cds::gc::nogc, item,
91             cc::split_list::make_traits<
92                 cc::split_list::ordered_list<cc::lazy_list_tag>
93                 ,cc::opt::hash< hash_int >
94                 ,cc::opt::item_counter< simple_item_counter >
95                 ,cc::opt::memory_model< cc::opt::v::sequential_consistent >
96                 ,cc::split_list::dynamic_bucket_table< false >
97                 ,cc::split_list::ordered_list_traits<
98                     cc::lazy_list::make_traits<
99                         cc::opt::less< less<item> >
100                     >::type
101                 >
102             >::type
103         > opt_set;
104         test_int_nogc< opt_set >();
105     }
106
107     void HashSetHdrTest::Split_Lazy_nogc_cmpmix()
108     {
109         // traits-based version
110         typedef cc::SplitListSet< cds::gc::nogc, item, nogc_cmpmix_traits > set;
111         test_int_nogc< set >();
112
113         // option-based version
114         typedef cc::SplitListSet< cds::gc::nogc, item,
115             cc::split_list::make_traits<
116                 cc::split_list::ordered_list<cc::lazy_list_tag>
117                 ,cc::opt::hash< hash_int >
118                 ,cc::opt::item_counter< simple_item_counter >
119                 ,cc::split_list::ordered_list_traits<
120                     cc::lazy_list::make_traits<
121                         cc::opt::less< less<item> >
122                         ,cc::opt::compare< cmp<item> >
123                     >::type
124                 >
125             >::type
126         > opt_set;
127         test_int_nogc< opt_set >();
128     }
129
130     void HashSetHdrTest::Split_Lazy_nogc_cmpmix_stat()
131     {
132         // traits-based version
133         typedef cc::SplitListSet< cds::gc::nogc, item, nogc_cmpmix_stat_traits > set;
134         test_int_nogc< set >();
135
136         // option-based version
137         typedef cc::SplitListSet< cds::gc::nogc, item,
138             cc::split_list::make_traits<
139                 cc::split_list::ordered_list<cc::lazy_list_tag>
140                 ,cc::opt::hash< hash_int >
141                 ,cds::opt::stat< cc::split_list::stat<>>
142                 ,cc::opt::item_counter< simple_item_counter >
143                 ,cc::split_list::ordered_list_traits<
144                     cc::lazy_list::make_traits<
145                         cc::opt::less< less<item> >
146                         ,cc::opt::compare< cmp<item> >
147                     >::type
148                 >
149             >::type
150         > opt_set;
151         test_int_nogc< opt_set >();
152     }
153
154 } // namespace set
155
156