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