From d0f8edf79da41bd5e87754a0250db1822e54b7b9 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 19 Mar 2016 00:58:15 +0300 Subject: [PATCH] Migrated SplitListSet unit tests o gtest framework --- projects/Win/vc14/gtest-set.vcxproj | 111 ++++++++- projects/Win/vc14/gtest-set.vcxproj.filters | 57 +++++ test/unit/set/CMakeLists.txt | 16 ++ test/unit/set/split_lazy_dhp.cpp | 210 +++++++++++++++++ test/unit/set/split_lazy_hp.cpp | 211 +++++++++++++++++ test/unit/set/split_lazy_nogc.cpp | 194 ++++++++++++++++ test/unit/set/split_lazy_rcu_gpb.cpp | 41 ++++ test/unit/set/split_lazy_rcu_gpi.cpp | 41 ++++ test/unit/set/split_lazy_rcu_gpt.cpp | 41 ++++ test/unit/set/split_lazy_rcu_shb.cpp | 45 ++++ test/unit/set/split_lazy_rcu_sht.cpp | 45 ++++ test/unit/set/split_michael_dhp.cpp | 187 +++++++++++++++ test/unit/set/split_michael_hp.cpp | 188 +++++++++++++++ test/unit/set/split_michael_nogc.cpp | 171 ++++++++++++++ test/unit/set/split_michael_rcu_gpb.cpp | 41 ++++ test/unit/set/split_michael_rcu_gpi.cpp | 41 ++++ test/unit/set/split_michael_rcu_gpt.cpp | 41 ++++ test/unit/set/split_michael_rcu_shb.cpp | 45 ++++ test/unit/set/split_michael_rcu_sht.cpp | 45 ++++ test/unit/set/test_split_lazy_rcu.h | 241 ++++++++++++++++++++ test/unit/set/test_split_michael_rcu.h | 215 +++++++++++++++++ 21 files changed, 2226 insertions(+), 1 deletion(-) create mode 100644 test/unit/set/split_lazy_dhp.cpp create mode 100644 test/unit/set/split_lazy_hp.cpp create mode 100644 test/unit/set/split_lazy_nogc.cpp create mode 100644 test/unit/set/split_lazy_rcu_gpb.cpp create mode 100644 test/unit/set/split_lazy_rcu_gpi.cpp create mode 100644 test/unit/set/split_lazy_rcu_gpt.cpp create mode 100644 test/unit/set/split_lazy_rcu_shb.cpp create mode 100644 test/unit/set/split_lazy_rcu_sht.cpp create mode 100644 test/unit/set/split_michael_dhp.cpp create mode 100644 test/unit/set/split_michael_hp.cpp create mode 100644 test/unit/set/split_michael_nogc.cpp create mode 100644 test/unit/set/split_michael_rcu_gpb.cpp create mode 100644 test/unit/set/split_michael_rcu_gpi.cpp create mode 100644 test/unit/set/split_michael_rcu_gpt.cpp create mode 100644 test/unit/set/split_michael_rcu_shb.cpp create mode 100644 test/unit/set/split_michael_rcu_sht.cpp create mode 100644 test/unit/set/test_split_lazy_rcu.h create mode 100644 test/unit/set/test_split_michael_rcu.h diff --git a/projects/Win/vc14/gtest-set.vcxproj b/projects/Win/vc14/gtest-set.vcxproj index 6c27a5a8..c7056066 100644 --- a/projects/Win/vc14/gtest-set.vcxproj +++ b/projects/Win/vc14/gtest-set.vcxproj @@ -28,7 +28,14 @@ - + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + @@ -65,6 +72,106 @@ + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + 4503 + 4503 + 4503 + 4503 + 4503 + 4503 + + + @@ -73,6 +180,8 @@ + + {A589D3F1-A749-4268-ADEC-D0CE13D1E359} diff --git a/projects/Win/vc14/gtest-set.vcxproj.filters b/projects/Win/vc14/gtest-set.vcxproj.filters index b279b0a6..6c8d01e9 100644 --- a/projects/Win/vc14/gtest-set.vcxproj.filters +++ b/projects/Win/vc14/gtest-set.vcxproj.filters @@ -16,6 +16,9 @@ {4c75be9d-6104-435d-b08f-09fa33b2bfcc} + + {6cf522b0-3039-424a-80f6-12e9ca592630} + @@ -69,6 +72,54 @@ Source Files\MichaelSet + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + + + Source Files\SplitList + @@ -89,5 +140,11 @@ Header Files + + Header Files + + + Header Files + \ No newline at end of file diff --git a/test/unit/set/CMakeLists.txt b/test/unit/set/CMakeLists.txt index 9dc0776a..98606398 100644 --- a/test/unit/set/CMakeLists.txt +++ b/test/unit/set/CMakeLists.txt @@ -18,6 +18,22 @@ set(CDSGTEST_SET_SOURCES michael_michael_rcu_gpt.cpp michael_michael_rcu_shb.cpp michael_michael_rcu_sht.cpp + split_lazy_hp.cpp + split_lazy_dhp.cpp + split_lazy_nogc.cpp + split_lazy_rcu_gpb.cpp + split_lazy_rcu_gpi.cpp + split_lazy_rcu_gpt.cpp + split_lazy_rcu_shb.cpp + split_lazy_rcu_sht.cpp + split_michael_hp.cpp + split_michael_dhp.cpp + split_michael_nogc.cpp + split_michael_rcu_gpb.cpp + split_michael_rcu_gpi.cpp + split_michael_rcu_gpt.cpp + split_michael_rcu_shb.cpp + split_michael_rcu_sht.cpp ) include_directories( diff --git a/test/unit/set/split_lazy_dhp.cpp b/test/unit/set/split_lazy_dhp.cpp new file mode 100644 index 00000000..83d30525 --- /dev/null +++ b/test/unit/set/split_lazy_dhp.cpp @@ -0,0 +1,210 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "test_set_hp.h" + +#include +#include + +namespace { + namespace cc = cds::container; + typedef cds::gc::DHP gc_type; + + class SplitListLazySet_DHP : public cds_test::container_set_hp + { + protected: + typedef cds_test::container_set_hp base_class; + + void SetUp() + { + struct set_traits: public cc::split_list::traits { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount ); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + cds::gc::dhp::GarbageCollector::Destruct(); + } + }; + + TEST_F( SplitListLazySet_DHP, compare ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_DHP, less ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< less > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_DHP, cmpmix ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< less > + , cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_DHP, item_counting ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef base_class::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_DHP, stat ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef base_class::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_DHP, back_off ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_DHP, mutex ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + typedef std::mutex lock_type; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + +} // namespace diff --git a/test/unit/set/split_lazy_hp.cpp b/test/unit/set/split_lazy_hp.cpp new file mode 100644 index 00000000..07c42f93 --- /dev/null +++ b/test/unit/set/split_lazy_hp.cpp @@ -0,0 +1,211 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "test_set_hp.h" + +#include +#include + +namespace { + namespace cc = cds::container; + typedef cds::gc::HP gc_type; + + class SplitListLazySet_HP : public cds_test::container_set_hp + { + protected: + typedef cds_test::container_set_hp base_class; + + void SetUp() + { + struct set_traits: public cc::split_list::traits { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + // +1 - for guarded_ptr + cds::gc::hp::GarbageCollector::Construct( set_type::c_nHazardPtrCount + 1, 1, 16 ); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + cds::gc::hp::GarbageCollector::Destruct( true ); + } + }; + + TEST_F( SplitListLazySet_HP, compare ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_HP, less ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< less > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_HP, cmpmix ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< less > + , cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_HP, item_counting ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef base_class::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_HP, stat ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef base_class::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_HP, back_off ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_HP, mutex ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + typedef std::mutex lock_type; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + +} // namespace diff --git a/test/unit/set/split_lazy_nogc.cpp b/test/unit/set/split_lazy_nogc.cpp new file mode 100644 index 00000000..eab17132 --- /dev/null +++ b/test/unit/set/split_lazy_nogc.cpp @@ -0,0 +1,194 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "test_set_nogc.h" + +#include +#include + +namespace { + namespace cc = cds::container; + typedef cds::gc::nogc gc_type; + + class SplitListLazySet_NoGC : public cds_test::container_set_nogc + { + protected: + typedef cds_test::container_set_nogc base_class; + + //void SetUp() + //{} + + //void TearDown() + //{} + }; + + TEST_F( SplitListLazySet_NoGC, compare ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_NoGC, less ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< less > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_NoGC, cmpmix ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< less > + , cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_NoGC, item_counting ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef base_class::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_NoGC, stat ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef base_class::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_NoGC, back_off ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListLazySet_NoGC, mutex ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + typedef std::mutex lock_type; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + +} // namespace diff --git a/test/unit/set/split_lazy_rcu_gpb.cpp b/test/unit/set/split_lazy_rcu_gpb.cpp new file mode 100644 index 00000000..119e59be --- /dev/null +++ b/test/unit/set/split_lazy_rcu_gpb.cpp @@ -0,0 +1,41 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "test_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::general_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, SplitListLazySet, rcu_implementation ); diff --git a/test/unit/set/split_lazy_rcu_gpi.cpp b/test/unit/set/split_lazy_rcu_gpi.cpp new file mode 100644 index 00000000..c9876b8a --- /dev/null +++ b/test/unit/set/split_lazy_rcu_gpi.cpp @@ -0,0 +1,41 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "test_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::general_instant<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, SplitListLazySet, rcu_implementation ); diff --git a/test/unit/set/split_lazy_rcu_gpt.cpp b/test/unit/set/split_lazy_rcu_gpt.cpp new file mode 100644 index 00000000..bf5e8512 --- /dev/null +++ b/test/unit/set/split_lazy_rcu_gpt.cpp @@ -0,0 +1,41 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "test_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::general_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, SplitListLazySet, rcu_implementation ); diff --git a/test/unit/set/split_lazy_rcu_shb.cpp b/test/unit/set/split_lazy_rcu_shb.cpp new file mode 100644 index 00000000..538c7f5f --- /dev/null +++ b/test/unit/set/split_lazy_rcu_shb.cpp @@ -0,0 +1,45 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + +#include "test_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::signal_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, SplitListLazySet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/split_lazy_rcu_sht.cpp b/test/unit/set/split_lazy_rcu_sht.cpp new file mode 100644 index 00000000..d3451775 --- /dev/null +++ b/test/unit/set/split_lazy_rcu_sht.cpp @@ -0,0 +1,45 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + +#include "test_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::signal_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, SplitListLazySet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/split_michael_dhp.cpp b/test/unit/set/split_michael_dhp.cpp new file mode 100644 index 00000000..4f88b2e3 --- /dev/null +++ b/test/unit/set/split_michael_dhp.cpp @@ -0,0 +1,187 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "test_set_hp.h" + +#include +#include + +namespace { + namespace cc = cds::container; + typedef cds::gc::DHP gc_type; + + class SplitListMichaelSet_DHP : public cds_test::container_set_hp + { + protected: + typedef cds_test::container_set_hp base_class; + + void SetUp() + { + struct set_traits: public cc::split_list::traits { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount ); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + cds::gc::dhp::GarbageCollector::Destruct(); + } + }; + + TEST_F( SplitListMichaelSet_DHP, compare ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_DHP, less ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< less > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_DHP, cmpmix ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< less > + , cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_DHP, item_counting ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef base_class::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_DHP, stat ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef base_class::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_DHP, back_off ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + +} // namespace diff --git a/test/unit/set/split_michael_hp.cpp b/test/unit/set/split_michael_hp.cpp new file mode 100644 index 00000000..d5bba0f0 --- /dev/null +++ b/test/unit/set/split_michael_hp.cpp @@ -0,0 +1,188 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "test_set_hp.h" + +#include +#include + +namespace { + namespace cc = cds::container; + typedef cds::gc::HP gc_type; + + class SplitListMichaelSet_HP : public cds_test::container_set_hp + { + protected: + typedef cds_test::container_set_hp base_class; + + void SetUp() + { + struct set_traits: public cc::split_list::traits { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + // +1 - for guarded_ptr + cds::gc::hp::GarbageCollector::Construct( set_type::c_nHazardPtrCount + 1, 1, 16 ); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + cds::gc::hp::GarbageCollector::Destruct( true ); + } + }; + + TEST_F( SplitListMichaelSet_HP, compare ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_HP, less ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< less > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_HP, cmpmix ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< less > + , cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_HP, item_counting ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef base_class::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_HP, stat ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef base_class::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_HP, back_off ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + +} // namespace diff --git a/test/unit/set/split_michael_nogc.cpp b/test/unit/set/split_michael_nogc.cpp new file mode 100644 index 00000000..d8714da9 --- /dev/null +++ b/test/unit/set/split_michael_nogc.cpp @@ -0,0 +1,171 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "test_set_nogc.h" + +#include +#include + +namespace { + namespace cc = cds::container; + typedef cds::gc::nogc gc_type; + + class SplitListMichaelSet_NoGC : public cds_test::container_set_nogc + { + protected: + typedef cds_test::container_set_nogc base_class; + + //void SetUp() + //{} + + //void TearDown() + //{} + }; + + TEST_F( SplitListMichaelSet_NoGC, compare ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_NoGC, less ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< less > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_NoGC, cmpmix ) + { + typedef cc::SplitListSet< gc_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< less > + , cds::opt::compare< cmp > + >::type + > + >::type + > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_NoGC, item_counting ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef base_class::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_NoGC, stat ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef base_class::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + + TEST_F( SplitListMichaelSet_NoGC, back_off ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s; + test( s ); + } + +} // namespace diff --git a/test/unit/set/split_michael_rcu_gpb.cpp b/test/unit/set/split_michael_rcu_gpb.cpp new file mode 100644 index 00000000..e8dc699a --- /dev/null +++ b/test/unit/set/split_michael_rcu_gpb.cpp @@ -0,0 +1,41 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "test_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::general_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, SplitListMichaelSet, rcu_implementation ); diff --git a/test/unit/set/split_michael_rcu_gpi.cpp b/test/unit/set/split_michael_rcu_gpi.cpp new file mode 100644 index 00000000..10d058f9 --- /dev/null +++ b/test/unit/set/split_michael_rcu_gpi.cpp @@ -0,0 +1,41 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "test_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::general_instant<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, SplitListMichaelSet, rcu_implementation ); diff --git a/test/unit/set/split_michael_rcu_gpt.cpp b/test/unit/set/split_michael_rcu_gpt.cpp new file mode 100644 index 00000000..2a49f74b --- /dev/null +++ b/test/unit/set/split_michael_rcu_gpt.cpp @@ -0,0 +1,41 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#include "test_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::general_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, SplitListMichaelSet, rcu_implementation ); diff --git a/test/unit/set/split_michael_rcu_shb.cpp b/test/unit/set/split_michael_rcu_shb.cpp new file mode 100644 index 00000000..7a5e763e --- /dev/null +++ b/test/unit/set/split_michael_rcu_shb.cpp @@ -0,0 +1,45 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + +#include "test_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::signal_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, SplitListMichaelSet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/split_michael_rcu_sht.cpp b/test/unit/set/split_michael_rcu_sht.cpp new file mode 100644 index 00000000..d5d8db48 --- /dev/null +++ b/test/unit/set/split_michael_rcu_sht.cpp @@ -0,0 +1,45 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED + +#include "test_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::signal_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, SplitListMichaelSet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/test_split_lazy_rcu.h b/test/unit/set/test_split_lazy_rcu.h new file mode 100644 index 00000000..72e9a791 --- /dev/null +++ b/test/unit/set/test_split_lazy_rcu.h @@ -0,0 +1,241 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef CDSUNIT_SET_TEST_SPLIT_LIST_LAZY_RCU_H +#define CDSUNIT_SET_TEST_SPLIT_LIST_LAZY_RCU_H + +#include "test_set_rcu.h" +#include +#include + +namespace cc = cds::container; + +template +class SplitListLazySet: public cds_test::container_set_rcu +{ + typedef cds_test::container_set_rcu base_class; +public: + typedef cds::urcu::gc rcu_type; + +protected: + void SetUp() + { + RCU::Construct(); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + RCU::Destruct(); + } +}; + +TYPED_TEST_CASE_P( SplitListLazySet ); + +//TYPED_TEST_P( SplitListLazySet, compare ) +TYPED_TEST_P( SplitListLazySet, compare ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + typedef cc::SplitListSet< rcu_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::compare< typename TestFixture::cmp > + >::type + > + >::type + > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListLazySet, less ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + typedef cc::SplitListSet< rcu_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< typename TestFixture::less > + >::type + > + >::type + > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListLazySet, cmpmix ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + typedef cc::SplitListSet< rcu_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::lazy_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::lazy_list::make_traits< + cds::opt::less< typename TestFixture::less > + , cds::opt::compare< typename TestFixture::cmp > + >::type + > + >::type + > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListLazySet, item_counting ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef typename TestFixture::cmp compare; + typedef typename TestFixture::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListLazySet, stat ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef typename TestFixture::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListLazySet, back_off ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListLazySet, mutex ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public cc::split_list::traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::backoff::pause back_off; + typedef std::mutex lock_type; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s; + this->test( s ); +} + +// GCC 5: All this->test names should be written on single line, otherwise a runtime error will be encountered like as +// "No this->test named can be found in this this->test case" +REGISTER_TYPED_TEST_CASE_P( SplitListLazySet, + compare, less, cmpmix, item_counting, stat, back_off, mutex +); + + +#endif // CDSUNIT_SET_TEST_SPLIT_LIST_LAZY_RCU_H + \ No newline at end of file diff --git a/test/unit/set/test_split_michael_rcu.h b/test/unit/set/test_split_michael_rcu.h new file mode 100644 index 00000000..7952ed86 --- /dev/null +++ b/test/unit/set/test_split_michael_rcu.h @@ -0,0 +1,215 @@ +/* + This file is a part of libcds - Concurrent Data Structures library + + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + + Source code repo: http://github.com/khizmax/libcds/ + Download: http://sourceforge.net/projects/libcds/files/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef CDSUNIT_SET_TEST_SPLIT_LIST_MICHAEL_RCU_H +#define CDSUNIT_SET_TEST_SPLIT_LIST_MICHAEL_RCU_H + +#include "test_set_rcu.h" +#include +#include + +namespace cc = cds::container; + +template +class SplitListMichaelSet: public cds_test::container_set_rcu +{ + typedef cds_test::container_set_rcu base_class; +public: + typedef cds::urcu::gc rcu_type; + +protected: + void SetUp() + { + RCU::Construct(); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + RCU::Destruct(); + } +}; + +TYPED_TEST_CASE_P( SplitListMichaelSet ); + +//TYPED_TEST_P( SplitListMichaelSet, compare ) +TYPED_TEST_P( SplitListMichaelSet, compare ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + typedef cc::SplitListSet< rcu_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::compare< typename TestFixture::cmp > + >::type + > + >::type + > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListMichaelSet, less ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + typedef cc::SplitListSet< rcu_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< typename TestFixture::less > + >::type + > + >::type + > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListMichaelSet, cmpmix ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + typedef cc::SplitListSet< rcu_type, int_item, + typename cc::split_list::make_traits< + cc::split_list::ordered_list< cc::michael_list_tag > + , cds::opt::hash< hash_int > + , cc::split_list::ordered_list_traits< + typename cc::michael_list::make_traits< + cds::opt::less< typename TestFixture::less > + , cds::opt::compare< typename TestFixture::cmp > + >::type + > + >::type + > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListMichaelSet, item_counting ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef typename TestFixture::cmp compare; + typedef typename TestFixture::less less; + typedef cds::backoff::empty back_off; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListMichaelSet, stat ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cc::split_list::stat<> stat; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef typename TestFixture::less less; + typedef cds::opt::v::sequential_consistent memory_model; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s; + this->test( s ); +} + +TYPED_TEST_P( SplitListMichaelSet, back_off ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + typedef cds::opt::v::sequential_consistent memory_model; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s; + this->test( s ); +} + + +// GCC 5: All this->test names should be written on single line, otherwise a runtime error will be encountered like as +// "No this->test named can be found in this this->test case" +REGISTER_TYPED_TEST_CASE_P( SplitListMichaelSet, + compare, less, cmpmix, item_counting, stat, back_off +); + + +#endif // CDSUNIT_SET_TEST_SPLIT_LIST_MICHAEL_RCU_H + \ No newline at end of file -- 2.34.1