2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
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.
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.
31 #include "test_set_nogc.h"
33 #include <cds/container/lazy_list_nogc.h>
34 #include <cds/container/split_list_set_nogc.h>
37 namespace cc = cds::container;
38 typedef cds::gc::nogc gc_type;
40 class SplitListLazySet_NoGC : public cds_test::container_set_nogc
43 typedef cds_test::container_set_nogc base_class;
52 TEST_F( SplitListLazySet_NoGC, compare )
54 typedef cc::SplitListSet< gc_type, int_item,
55 typename cc::split_list::make_traits<
56 cc::split_list::ordered_list< cc::lazy_list_tag >
57 , cds::opt::hash< hash_int >
58 , cc::split_list::ordered_list_traits<
59 typename cc::lazy_list::make_traits<
60 cds::opt::compare< cmp >
66 set_type s( kSize, 2 );
70 TEST_F( SplitListLazySet_NoGC, less )
72 typedef cc::SplitListSet< gc_type, int_item,
73 typename cc::split_list::make_traits<
74 cc::split_list::ordered_list< cc::lazy_list_tag >
75 , cds::opt::hash< hash_int >
76 , cc::split_list::ordered_list_traits<
77 typename cc::lazy_list::make_traits<
78 cds::opt::less< less >
84 set_type s( kSize, 2 );
88 TEST_F( SplitListLazySet_NoGC, cmpmix )
90 typedef cc::SplitListSet< gc_type, int_item,
91 typename cc::split_list::make_traits<
92 cc::split_list::ordered_list< cc::lazy_list_tag >
93 , cds::opt::hash< hash_int >
94 , cc::split_list::ordered_list_traits<
95 typename cc::lazy_list::make_traits<
96 cds::opt::less< less >
97 , cds::opt::compare< cmp >
103 set_type s( kSize, 1 );
107 TEST_F( SplitListLazySet_NoGC, item_counting )
109 struct set_traits: public cc::split_list::traits
111 typedef cc::lazy_list_tag ordered_list;
112 typedef hash_int hash;
113 typedef cds::atomicity::item_counter item_counter;
115 struct ordered_list_traits: public cc::lazy_list::traits
118 typedef base_class::less less;
119 typedef cds::backoff::empty back_off;
122 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
124 set_type s( kSize, 3 );
128 TEST_F( SplitListLazySet_NoGC, stat )
130 struct set_traits: public cc::split_list::traits
132 typedef cc::lazy_list_tag ordered_list;
133 typedef hash_int hash;
134 typedef cds::atomicity::item_counter item_counter;
135 typedef cc::split_list::stat<> stat;
137 struct ordered_list_traits: public cc::lazy_list::traits
139 typedef base_class::less less;
140 typedef cds::opt::v::sequential_consistent memory_model;
143 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
145 set_type s( kSize, 4 );
149 TEST_F( SplitListLazySet_NoGC, back_off )
151 struct set_traits: public cc::split_list::traits
153 typedef cc::lazy_list_tag ordered_list;
154 typedef hash_int hash;
155 typedef cds::atomicity::item_counter item_counter;
156 typedef cds::backoff::yield back_off;
157 typedef cds::opt::v::sequential_consistent memory_model;
159 struct ordered_list_traits: public cc::lazy_list::traits
162 typedef cds::backoff::empty back_off;
165 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
167 set_type s( kSize, 2 );
171 TEST_F( SplitListLazySet_NoGC, mutex )
173 struct set_traits: public cc::split_list::traits
175 typedef cc::lazy_list_tag ordered_list;
176 typedef hash_int hash;
177 typedef cds::atomicity::item_counter item_counter;
178 typedef cds::backoff::yield back_off;
179 typedef cds::opt::v::sequential_consistent memory_model;
181 struct ordered_list_traits: public cc::lazy_list::traits
184 typedef cds::backoff::pause back_off;
185 typedef std::mutex lock_type;
188 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
190 set_type s( kSize, 3 );
194 struct set_static_traits: public cc::split_list::traits
196 static bool const dynamic_bucket_table = false;
199 TEST_F( SplitListLazySet_NoGC, static_bucket_table )
201 struct set_traits: public set_static_traits
203 typedef cc::lazy_list_tag ordered_list;
204 typedef hash_int hash;
205 typedef cds::atomicity::item_counter item_counter;
207 struct ordered_list_traits: public cc::lazy_list::traits
210 typedef cds::backoff::pause back_off;
213 typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type;
215 set_type s( kSize, 4 );