bugfix in cds::gc::HP::guarded_ptr
[libcds.git] / tests / test-hdr / ordered_list / hdr_lazy_hp.cpp
1 //$$CDS-header$$
2
3 #include "ordered_list/hdr_lazy.h"
4 #include <cds/container/lazy_list_hp.h>
5
6 namespace ordlist {
7     namespace {
8         struct HP_cmp_traits: public cc::lazy_list::traits
9         {
10             typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
11         };
12
13     }
14     void LazyListTestHeader::HP_cmp()
15     {
16         // traits-based version
17         typedef cc::LazyList< cds::gc::HP, item, HP_cmp_traits > list;
18         test< list >();
19
20         // option-based version
21
22         typedef cc::LazyList< cds::gc::HP, item,
23             cc::lazy_list::make_traits<
24                 cc::opt::compare< cmp<item> >
25             >::type
26         > opt_list;
27         test< opt_list >();
28     }
29
30     namespace {
31         struct HP_less_traits: public cc::lazy_list::traits
32         {
33             typedef LazyListTestHeader::lt<LazyListTestHeader::item>   less;
34         };
35     }
36     void LazyListTestHeader::HP_less()
37     {
38         // traits-based version
39         typedef cc::LazyList< cds::gc::HP, item, HP_less_traits > list;
40         test< list >();
41
42         // option-based version
43
44         typedef cc::LazyList< cds::gc::HP, item,
45             cc::lazy_list::make_traits<
46                 cc::opt::less< lt<item> >
47             >::type
48         > opt_list;
49         test< opt_list >();
50     }
51
52     namespace {
53         struct HP_cmpmix_traits: public cc::lazy_list::traits
54         {
55             typedef LazyListTestHeader::cmp<LazyListTestHeader::item>   compare;
56             typedef LazyListTestHeader::lt<LazyListTestHeader::item>  less;
57         };
58     }
59     void LazyListTestHeader::HP_cmpmix()
60     {
61         // traits-based version
62         typedef cc::LazyList< cds::gc::HP, item, HP_cmpmix_traits > list;
63         test< list >();
64
65         // option-based version
66
67         typedef cc::LazyList< cds::gc::HP, item,
68             cc::lazy_list::make_traits<
69                 cc::opt::compare< cmp<item> >
70                 ,cc::opt::less< lt<item> >
71             >::type
72         > opt_list;
73         test< opt_list >();
74     }
75
76     namespace {
77         struct HP_ic_traits: public cc::lazy_list::traits
78         {
79             typedef LazyListTestHeader::lt<LazyListTestHeader::item>   less;
80             typedef cds::atomicity::item_counter item_counter;
81         };
82     }
83     void LazyListTestHeader::HP_ic()
84     {
85         // traits-based version
86         typedef cc::LazyList< cds::gc::HP, item, HP_ic_traits > list;
87         test< list >();
88
89         // option-based version
90
91         typedef cc::LazyList< cds::gc::HP, item,
92             cc::lazy_list::make_traits<
93                 cc::opt::less< lt<item> >
94                 ,cc::opt::item_counter< cds::atomicity::item_counter >
95             >::type
96         > opt_list;
97         test< opt_list >();
98     }
99
100 }   // namespace ordlist
101
102 CPPUNIT_TEST_SUITE_REGISTRATION(ordlist::LazyListTestHeader);