Added copyright and license
[libcds.git] / tests / test-hdr / list / hdr_intrusive_lazy_rcu_gpi.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_instant.h>
33 #include <cds/intrusive/lazy_list_rcu.h>
34
35 namespace ordlist {
36     namespace {
37         typedef cds::urcu::gc< cds::urcu::general_instant<> >    RCU;
38     }
39
40     void IntrusiveLazyListHeaderTest::RCU_GPI_base_cmp()
41     {
42         typedef base_int_item< RCU > item;
43         typedef ci::LazyList< RCU
44             ,item
45             ,ci::lazy_list::make_traits<
46                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
47                 ,co::compare< cmp<item> >
48                 ,ci::opt::disposer< faked_disposer >
49             >::type
50         >    list;
51         test_rcu_int<list>();
52     }
53     void IntrusiveLazyListHeaderTest::RCU_GPI_base_less()
54     {
55         typedef base_int_item< RCU > item;
56         typedef ci::LazyList< RCU
57             ,item
58             ,ci::lazy_list::make_traits<
59                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
60                 ,co::less< less<item> >
61                 ,ci::opt::disposer< faked_disposer >
62             >::type
63         >    list;
64         test_rcu_int<list>();
65     }
66     void IntrusiveLazyListHeaderTest::RCU_GPI_base_cmpmix()
67     {
68         typedef base_int_item< RCU > item;
69         typedef ci::LazyList< RCU
70             ,item
71             ,ci::lazy_list::make_traits<
72                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
73                 ,co::less< less<item> >
74                 ,co::compare< cmp<item> >
75                 ,ci::opt::disposer< faked_disposer >
76             >::type
77         >    list;
78         test_rcu_int<list>();
79     }
80     void IntrusiveLazyListHeaderTest::RCU_GPI_base_ic()
81     {
82         typedef base_int_item< RCU > item;
83         typedef ci::LazyList< RCU
84             ,item
85             ,ci::lazy_list::make_traits<
86                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
87                 ,co::less< less<item> >
88                 ,co::compare< cmp<item> >
89                 ,ci::opt::disposer< faked_disposer >
90                 ,co::item_counter< cds::atomicity::item_counter >
91             >::type
92         >    list;
93         test_rcu_int<list>();
94     }
95     void IntrusiveLazyListHeaderTest::RCU_GPI_member_cmp()
96     {
97         typedef member_int_item< RCU > item;
98         typedef ci::LazyList< RCU
99             ,item
100             ,ci::lazy_list::make_traits<
101                 ci::opt::hook< ci::lazy_list::member_hook<
102                     offsetof( item, hMember ),
103                     co::gc<RCU>
104                 > >
105                 ,co::compare< cmp<item> >
106                 ,ci::opt::disposer< faked_disposer >
107             >::type
108         >    list;
109         test_rcu_int<list>();
110     }
111     void IntrusiveLazyListHeaderTest::RCU_GPI_member_less()
112     {
113         typedef member_int_item< RCU > item;
114         typedef ci::LazyList< RCU
115             ,item
116             ,ci::lazy_list::make_traits<
117                 ci::opt::hook< ci::lazy_list::member_hook<
118                     offsetof( item, hMember ),
119                     co::gc<RCU>
120                 > >
121                 ,co::less< less<item> >
122                 ,ci::opt::disposer< faked_disposer >
123             >::type
124         >    list;
125         test_rcu_int<list>();
126     }
127     void IntrusiveLazyListHeaderTest::RCU_GPI_member_cmpmix()
128     {
129         typedef member_int_item< RCU > item;
130         typedef ci::LazyList< RCU
131             ,item
132             ,ci::lazy_list::make_traits<
133                 ci::opt::hook< ci::lazy_list::member_hook<
134                     offsetof( item, hMember ),
135                     co::gc<RCU>
136                 > >
137                 ,co::less< less<item> >
138                 ,co::compare< cmp<item> >
139                 ,ci::opt::disposer< faked_disposer >
140             >::type
141         >    list;
142         test_rcu_int<list>();
143     }
144     void IntrusiveLazyListHeaderTest::RCU_GPI_member_ic()
145     {
146         typedef member_int_item< RCU > item;
147         typedef ci::LazyList< RCU
148             ,item
149             ,ci::lazy_list::make_traits<
150                 ci::opt::hook< ci::lazy_list::member_hook<
151                     offsetof( item, hMember ),
152                     co::gc<RCU>
153                 > >
154                 ,co::compare< cmp<item> >
155                 ,ci::opt::disposer< faked_disposer >
156                 ,co::item_counter< cds::atomicity::item_counter >
157             >::type
158         >    list;
159         test_rcu_int<list>();
160     }
161 }   // namespace ordlist