Added copyright and license
[libcds.git] / tests / test-hdr / list / hdr_lazy_nogc_unord.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_lazy.h"
32 #include <cds/container/lazy_list_nogc.h>
33
34 namespace ordlist {
35     namespace {
36         struct NOGC_cmp_traits : public cc::lazy_list::traits
37         {
38             typedef LazyListTestHeader::cmp<LazyListTestHeader::item>   compare;
39             static const bool sort = false;
40         };
41     }
42     void LazyListTestHeader::NOGC_cmp_unord()
43     {
44         // traits-based version
45         typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmp_traits > list;
46         nogc_unord_test< list >();
47
48         // option-based version
49         typedef cc::LazyList< cds::gc::nogc, item,
50             cc::lazy_list::make_traits<
51                 cc::opt::compare< cmp<item> >
52                 ,cc::opt::sort<false>
53             >::type
54         > opt_list;
55         nogc_unord_test< opt_list >();
56     }
57
58     namespace {
59         struct NOGC_less_traits : public cc::lazy_list::traits
60         {
61             typedef LazyListTestHeader::lt<LazyListTestHeader::item>   less;
62             static const bool sort = false;
63         };
64     }
65     void LazyListTestHeader::NOGC_less_unord()
66     {
67         // traits-based version
68         typedef cc::LazyList< cds::gc::nogc, item, NOGC_less_traits > list;
69         nogc_unord_test< list >();
70
71         // option-based version
72         typedef cc::LazyList< cds::gc::nogc, item,
73             cc::lazy_list::make_traits<
74                 cc::opt::less< lt<item> >
75                 ,cc::opt::sort<false>
76             >::type
77         > opt_list;
78         nogc_unord_test< opt_list >();
79     }
80
81     namespace {
82         struct NOGC_equal_to_traits : public cc::lazy_list::traits
83         {
84             typedef LazyListTestHeader::equal_to<LazyListTestHeader::item> equal_to;
85             static const bool sort = false;
86         };
87     }
88     void LazyListTestHeader::NOGC_equal_to_unord()
89     {
90         // traits-based version
91         typedef cc::LazyList< cds::gc::nogc, item, NOGC_equal_to_traits > list;
92         nogc_unord_test< list >();
93
94         // option-based version
95         typedef cc::LazyList< cds::gc::nogc, item,
96             cc::lazy_list::make_traits<
97                 cc::opt::equal_to< equal_to<item> >
98                 ,cc::opt::sort<false>
99             >::type
100         > opt_list;
101         nogc_unord_test< opt_list >();
102     }
103
104     namespace {
105         struct NOGC_cmpmix_traits : public cc::lazy_list::traits
106         {
107             typedef LazyListTestHeader::cmp<LazyListTestHeader::item>   compare;
108             typedef LazyListTestHeader::lt<LazyListTestHeader::item>  less;
109             static const bool sort = false;
110         };
111     }
112     void LazyListTestHeader::NOGC_cmpmix_unord()
113     {
114         // traits-based version
115         typedef cc::LazyList< cds::gc::nogc, item, NOGC_cmpmix_traits > list;
116         nogc_unord_test< list >();
117
118         // option-based version
119         typedef cc::LazyList< cds::gc::nogc, item,
120             cc::lazy_list::make_traits<
121                 cc::opt::compare< cmp<item> >
122                 ,cc::opt::less< lt<item> >
123                 ,cc::opt::sort<false>
124             >::type
125         > opt_list;
126         nogc_unord_test< opt_list >();
127     }
128
129     namespace {
130         struct NOGC_equal_to_mix_traits : public cc::lazy_list::traits
131         {
132             typedef LazyListTestHeader::cmp<LazyListTestHeader::item> compare;
133             typedef LazyListTestHeader::lt<LazyListTestHeader::item> less;
134             typedef LazyListTestHeader::equal_to<LazyListTestHeader::item> equal_to;
135             static const bool sort = false;
136         };
137     }
138     void LazyListTestHeader::NOGC_equal_to_mix_unord()
139     {
140         // traits-based version
141         typedef cc::LazyList< cds::gc::nogc, item, NOGC_equal_to_mix_traits > list;
142         nogc_unord_test< list >();
143
144         // option-based version
145         typedef cc::LazyList< cds::gc::nogc, item,
146             cc::lazy_list::make_traits<
147                 cc::opt::compare< cmp<item> >
148                 ,cc::opt::less< lt<item> >
149                 ,cc::opt::equal_to< equal_to<item> >
150                 ,cc::opt::sort<false>
151             >::type
152         > opt_list;
153         nogc_unord_test< opt_list >();
154     }
155     namespace {
156         struct NOGC_ic_traits : public cc::lazy_list::traits
157         {
158             typedef LazyListTestHeader::equal_to<LazyListTestHeader::item> equal_to;
159             typedef cds::atomicity::item_counter item_counter;
160             static const bool sort = false;
161         };
162     }
163     void LazyListTestHeader::NOGC_ic_unord()
164     {
165         // traits-based version
166         typedef cc::LazyList< cds::gc::nogc, item, NOGC_ic_traits > list;
167         nogc_unord_test< list >();
168
169         // option-based version
170         typedef cc::LazyList< cds::gc::nogc, item,
171             cc::lazy_list::make_traits<
172                 cc::opt::equal_to< equal_to<item> >
173                 ,cc::opt::item_counter< cds::atomicity::item_counter >
174                 ,cc::opt::sort<false>
175             >::type
176         > opt_list;
177         nogc_unord_test< opt_list >();
178     }
179
180 }   // namespace ordlist