2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
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.
30 #ifndef CDSUNIT_LIST_TEST_MICHAEL_KV_LIST_RCU_H
31 #define CDSUNIT_LIST_TEST_MICHAEL_KV_LIST_RCU_H
33 #include "test_kv_list_rcu.h"
34 #include <cds/container/michael_kvlist_rcu.h>
36 namespace cc = cds::container;
39 class MichaelKVList : public cds_test::kv_list_rcu
41 typedef cds_test::kv_list_rcu base_class;
43 typedef cds::urcu::gc<RCU> rcu_type;
49 cds::threading::Manager::attachThread();
54 cds::threading::Manager::detachThread();
59 TYPED_TEST_CASE_P( MichaelKVList );
61 TYPED_TEST_P( MichaelKVList, less_ordered )
63 typedef cc::MichaelKVList< typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type,
64 typename cc::michael_list::make_traits<
65 cds::opt::less< typename TestFixture::lt >
70 this->test_common( l );
71 this->test_ordered_iterator( l );
75 TYPED_TEST_P( MichaelKVList, compare_ordered )
77 typedef cc::MichaelKVList< typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type,
78 typename cc::michael_list::make_traits<
79 cds::opt::compare< typename TestFixture::cmp>
84 this->test_common( l );
85 this->test_ordered_iterator( l );
89 TYPED_TEST_P( MichaelKVList, mix_ordered )
91 typedef cc::MichaelKVList< typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type,
92 typename cc::michael_list::make_traits<
93 cds::opt::compare< typename TestFixture::cmp>
94 ,cds::opt::less< typename TestFixture::lt>
99 this->test_common( l );
100 this->test_ordered_iterator( l );
104 TYPED_TEST_P( MichaelKVList, item_counting )
106 struct traits : public cc::michael_list::traits
108 typedef typename TestFixture::lt less;
109 typedef cds::atomicity::item_counter item_counter;
111 typedef cc::MichaelKVList<typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type, traits > list_type;
114 this->test_common( l );
115 this->test_ordered_iterator( l );
119 TYPED_TEST_P( MichaelKVList, backoff )
121 struct traits : public cc::michael_list::traits
123 typedef typename TestFixture::lt less;
124 typedef cds::atomicity::item_counter item_counter;
125 typedef cds::backoff::empty back_off;
127 typedef cc::MichaelKVList<typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type, traits > list_type;
130 this->test_common( l );
131 this->test_ordered_iterator( l );
135 TYPED_TEST_P( MichaelKVList, seq_cst )
137 struct traits : public cc::michael_list::traits
139 typedef typename TestFixture::lt less;
140 typedef cds::atomicity::item_counter item_counter;
141 typedef cds::opt::v::sequential_consistent memory_model;
143 typedef cc::MichaelKVList<typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type, traits > list_type;
146 this->test_common( l );
147 this->test_ordered_iterator( l );
151 TYPED_TEST_P( MichaelKVList, stat )
153 struct traits: public cc::michael_list::traits
155 typedef typename TestFixture::lt less;
156 typedef cds::atomicity::item_counter item_counter;
157 typedef cds::container::michael_list::stat<> stat;
159 typedef cc::MichaelKVList<typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type, traits > list_type;
162 this->test_common( l );
163 this->test_ordered_iterator( l );
167 TYPED_TEST_P( MichaelKVList, wrapped_stat )
169 struct traits: public cc::michael_list::traits
171 typedef typename TestFixture::lt less;
172 typedef cds::atomicity::item_counter item_counter;
173 typedef cds::container::michael_list::wrapped_stat<> stat;
175 typedef cc::MichaelKVList<typename TestFixture::rcu_type, typename TestFixture::key_type, typename TestFixture::value_type, traits > list_type;
177 cds::container::michael_list::stat<> st;
179 this->test_common( l );
180 this->test_ordered_iterator( l );
184 // GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
185 // "No test named <test_name> can be found in this test case"
186 REGISTER_TYPED_TEST_CASE_P( MichaelKVList,
187 less_ordered, compare_ordered, mix_ordered, item_counting, backoff, seq_cst, stat, wrapped_stat
190 #endif // CDSUNIT_LIST_TEST_MICHAEL_KV_LIST_RCU_H