Improved value-parameterized test f intrusive stack
[libcds.git] / tests / test-hdr / list / hdr_intrusive_lazy_rcu_gpb.cpp
1 /*
2     This file is a part of libcds - Concurrent Data Structures library
3
4     (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
5
6     Source code repo: http://github.com/khizmax/libcds/
7     Download: http://sourceforge.net/projects/libcds/files/
8     
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions are met:
11
12     * Redistributions of source code must retain the above copyright notice, this
13       list of conditions and the following disclaimer.
14
15     * Redistributions in binary form must reproduce the above copyright notice,
16       this list of conditions and the following disclaimer in the documentation
17       and/or other materials provided with the distribution.
18
19     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
29 */
30
31 #include "list/hdr_intrusive_lazy.h"
32 #include <cds/urcu/general_buffered.h>
33 #include <cds/intrusive/lazy_list_rcu.h>
34
35 namespace ordlist {
36     namespace {
37         typedef cds::urcu::gc< cds::urcu::general_buffered<> >    RCU;
38     }
39
40     void IntrusiveLazyListHeaderTest::RCU_GPB_base_cmp()
41     {
42         typedef base_int_item< RCU > item;
43         typedef ci::lazy_list::make_traits<
44             ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
45             ,co::compare< cmp<item> >
46             ,ci::opt::disposer< faked_disposer >
47         >::type list_traits;
48         typedef ci::LazyList< RCU, item, list_traits > list;
49
50         test_rcu_int<list>();
51     }
52     void IntrusiveLazyListHeaderTest::RCU_GPB_base_less()
53     {
54         typedef base_int_item< RCU > item;
55         typedef ci::LazyList< RCU
56             ,item
57             ,ci::lazy_list::make_traits<
58                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
59                 ,co::less< less<item> >
60                 ,ci::opt::disposer< faked_disposer >
61             >::type
62         >    list;
63         test_rcu_int<list>();
64     }
65     void IntrusiveLazyListHeaderTest::RCU_GPB_base_cmpmix()
66     {
67         typedef base_int_item< RCU > item;
68         typedef ci::LazyList< RCU
69             ,item
70             ,ci::lazy_list::make_traits<
71                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
72                 ,co::less< less<item> >
73                 ,co::compare< cmp<item> >
74                 ,ci::opt::disposer< faked_disposer >
75             >::type
76         >    list;
77         test_rcu_int<list>();
78     }
79     void IntrusiveLazyListHeaderTest::RCU_GPB_base_ic()
80     {
81         typedef base_int_item< RCU > item;
82         typedef ci::LazyList< RCU
83             ,item
84             ,ci::lazy_list::make_traits<
85                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
86                 ,co::less< less<item> >
87                 ,co::compare< cmp<item> >
88                 ,ci::opt::disposer< faked_disposer >
89                 ,co::item_counter< cds::atomicity::item_counter >
90             >::type
91         >    list;
92         test_rcu_int<list>();
93     }
94     void IntrusiveLazyListHeaderTest::RCU_GPB_member_cmp()
95     {
96         typedef member_int_item< RCU > item;
97         typedef ci::LazyList< RCU
98             ,item
99             ,ci::lazy_list::make_traits<
100                 ci::opt::hook< ci::lazy_list::member_hook<
101                     offsetof( item, hMember ),
102                     co::gc<RCU>
103                 > >
104                 ,co::compare< cmp<item> >
105                 ,ci::opt::disposer< faked_disposer >
106             >::type
107         >    list;
108         test_rcu_int<list>();
109     }
110     void IntrusiveLazyListHeaderTest::RCU_GPB_member_less()
111     {
112         typedef member_int_item< RCU > item;
113         typedef ci::LazyList< RCU
114             ,item
115             ,ci::lazy_list::make_traits<
116                 ci::opt::hook< ci::lazy_list::member_hook<
117                     offsetof( item, hMember ),
118                     co::gc<RCU>
119                 > >
120                 ,co::less< less<item> >
121                 ,ci::opt::disposer< faked_disposer >
122             >::type
123         >    list;
124         test_rcu_int<list>();
125     }
126     void IntrusiveLazyListHeaderTest::RCU_GPB_member_cmpmix()
127     {
128         typedef member_int_item< RCU > item;
129         typedef ci::LazyList< RCU
130             ,item
131             ,ci::lazy_list::make_traits<
132                 ci::opt::hook< ci::lazy_list::member_hook<
133                     offsetof( item, hMember ),
134                     co::gc<RCU>
135                 > >
136                 ,co::less< less<item> >
137                 ,co::compare< cmp<item> >
138                 ,ci::opt::disposer< faked_disposer >
139             >::type
140         >    list;
141         test_rcu_int<list>();
142     }
143     void IntrusiveLazyListHeaderTest::RCU_GPB_member_ic()
144     {
145         typedef member_int_item< RCU > item;
146         typedef ci::LazyList< RCU
147             ,item
148             ,ci::lazy_list::make_traits<
149                 ci::opt::hook< ci::lazy_list::member_hook<
150                     offsetof( item, hMember ),
151                     co::gc<RCU>
152                 > >
153                 ,co::compare< cmp<item> >
154                 ,ci::opt::disposer< faked_disposer >
155                 ,co::item_counter< cds::atomicity::item_counter >
156             >::type
157         >    list;
158         test_rcu_int<list>();
159     }
160 }   // namespace ordlist