Move libcds 1.6.0 from SVN
[libcds.git] / tests / test-hdr / set / hdr_michael_set_lazy_ptb.cpp
1 //$$CDS-header$$
2
3 #include "set/hdr_set.h"
4 #include <cds/container/lazy_list_ptb.h>
5 #include <cds/container/michael_set.h>
6
7 namespace set {
8
9     namespace {
10         struct set_traits: public cc::michael_set::type_traits
11         {
12             typedef HashSetHdrTest::hash_int            hash;
13             typedef HashSetHdrTest::simple_item_counter item_counter;
14         };
15
16         struct PTB_cmp_traits: public cc::lazy_list::type_traits
17         {
18             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
19         };
20
21         struct PTB_less_traits: public cc::lazy_list::type_traits
22         {
23             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
24         };
25
26         struct PTB_cmpmix_traits: public cc::lazy_list::type_traits
27         {
28             typedef HashSetHdrTest::cmp<HashSetHdrTest::item>   compare;
29             typedef HashSetHdrTest::less<HashSetHdrTest::item>   less;
30         };
31     }
32
33     void HashSetHdrTest::Lazy_PTB_cmp()
34     {
35         typedef cc::LazyList< cds::gc::PTB, item, PTB_cmp_traits > list;
36
37         // traits-based version
38         typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
39         test_int< set >();
40
41         // option-based version
42         typedef cc::MichaelHashSet< cds::gc::PTB, list,
43             cc::michael_set::make_traits<
44                 cc::opt::hash< hash_int >
45                 ,cc::opt::item_counter< simple_item_counter >
46             >::type
47         > opt_set;
48         test_int< opt_set >();
49     }
50
51     void HashSetHdrTest::Lazy_PTB_less()
52     {
53         typedef cc::LazyList< cds::gc::PTB, item, PTB_less_traits > list;
54
55         // traits-based version
56         typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
57         test_int< set >();
58
59         // option-based version
60         typedef cc::MichaelHashSet< cds::gc::PTB, list,
61             cc::michael_set::make_traits<
62                 cc::opt::hash< hash_int >
63                 ,cc::opt::item_counter< simple_item_counter >
64             >::type
65         > opt_set;
66         test_int< opt_set >();
67     }
68
69     void HashSetHdrTest::Lazy_PTB_cmpmix()
70     {
71         typedef cc::LazyList< cds::gc::PTB, item, PTB_cmpmix_traits > list;
72
73         // traits-based version
74         typedef cc::MichaelHashSet< cds::gc::PTB, list, set_traits > set;
75         test_int< set >();
76
77         // option-based version
78         typedef cc::MichaelHashSet< cds::gc::PTB, list,
79             cc::michael_set::make_traits<
80                 cc::opt::hash< hash_int >
81                 ,cc::opt::item_counter< simple_item_counter >
82             >::type
83         > opt_set;
84         test_int< opt_set >();
85     }
86
87
88 } // namespace set