From: khizmax Date: Sun, 13 Mar 2016 08:34:31 +0000 (+0300) Subject: Migrated instrusive::SplitListSet unit test to gtest framework X-Git-Tag: v2.2.0~362 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4167cfc85518b84065ad67dce800f3ead2af8eb8;p=libcds.git Migrated instrusive::SplitListSet unit test to gtest framework --- diff --git a/projects/Win/vc14/gtest-set.vcxproj b/projects/Win/vc14/gtest-set.vcxproj index 60f94b2e..5ad899a5 100644 --- a/projects/Win/vc14/gtest-set.vcxproj +++ b/projects/Win/vc14/gtest-set.vcxproj @@ -72,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 + + + @@ -80,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 9bef3570..d3a3a55d 100644 --- a/projects/Win/vc14/gtest-set.vcxproj.filters +++ b/projects/Win/vc14/gtest-set.vcxproj.filters @@ -13,58 +13,112 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {9f3cc5d8-7142-4a8e-a520-512911312b13} + + + {619a4db2-c9a0-44eb-bbcf-842ed42d4172} + Source Files - - Source Files + + Source Files\intrsive:MichaelSet + + + Source Files\intrsive:MichaelSet + + + Source Files\intrsive:MichaelSet + + + Source Files\intrsive:MichaelSet + + + Source Files\intrsive:MichaelSet + + + Source Files\intrsive:MichaelSet + + + Source Files\intrsive:MichaelSet + + + Source Files\intrsive:MichaelSet - Source Files + Source Files\intrsive:MichaelSet - - Source Files + + Source Files\intrsive:MichaelSet - - Source Files + + Source Files\intrsive:MichaelSet - Source Files + Source Files\intrsive:MichaelSet - Source Files + Source Files\intrsive:MichaelSet - Source Files + Source Files\intrsive:MichaelSet - Source Files + Source Files\intrsive:MichaelSet - Source Files + Source Files\intrsive:MichaelSet - - Source Files + + Source Files\intrusive:SplitList - - Source Files + + Source Files\intrusive:SplitList - - Source Files + + Source Files\intrusive:SplitList - - Source Files + + Source Files\intrusive:SplitList - - Source Files + + Source Files\intrusive:SplitList - - Source Files + + Source Files\intrusive:SplitList - - Source Files + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList + + + Source Files\intrusive:SplitList @@ -86,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 61228a43..9f9616a2 100644 --- a/test/unit/set/CMakeLists.txt +++ b/test/unit/set/CMakeLists.txt @@ -20,6 +20,22 @@ set(CDSGTEST_SET_SOURCES intrusive_michael_michael_rcu_gpt.cpp intrusive_michael_michael_rcu_shb.cpp intrusive_michael_michael_rcu_sht.cpp + intrusive_split_lazy_hp.cpp + intrusive_split_lazy_dhp.cpp + intrusive_split_lazy_nogc.cpp + intrusive_split_lazy_rcu_gpb.cpp + intrusive_split_lazy_rcu_gpi.cpp + intrusive_split_lazy_rcu_gpt.cpp + intrusive_split_lazy_rcu_shb.cpp + intrusive_split_lazy_rcu_sht.cpp + intrusive_split_michael_hp.cpp + intrusive_split_michael_dhp.cpp + intrusive_split_michael_nogc.cpp + intrusive_split_michael_rcu_gpb.cpp + intrusive_split_michael_rcu_gpi.cpp + intrusive_split_michael_rcu_gpt.cpp + intrusive_split_michael_rcu_shb.cpp + intrusive_split_michael_rcu_sht.cpp ) include_directories( diff --git a/test/unit/set/intrusive_split_lazy_dhp.cpp b/test/unit/set/intrusive_split_lazy_dhp.cpp new file mode 100644 index 00000000..aad82073 --- /dev/null +++ b/test/unit/set/intrusive_split_lazy_dhp.cpp @@ -0,0 +1,258 @@ +/* + 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_intrusive_set_hp.h" + +#include +#include + +#include + +namespace { + namespace ci = cds::intrusive; + typedef cds::gc::DHP gc_type; + + class IntrusiveSplitListLazySet_DHP : public cds_test::intrusive_set_hp + { + protected: + typedef cds_test::intrusive_set_hp base_class; + + protected: + typedef typename base_class::base_int_item< ci::split_list::node< ci::lazy_list::node>> base_item_type; + typedef typename base_class::base_int_item< ci::split_list::node< ci::lazy_list::node>> base_mutex_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::lazy_list::node>> member_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::lazy_list::node>> member_mutex_item_type; + + void SetUp() + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + }; + typedef ci::LazyList< gc_type, base_item_type, list_traits > list_type; + typedef ci::SplitListSet< gc_type, list_type > 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( IntrusiveSplitListLazySet_DHP, base_cmp ) + { + typedef ci::LazyList< gc_type + , base_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type > > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + ,ci::opt::back_off< cds::backoff::pause > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_DHP, base_less ) + { + typedef ci::LazyList< gc_type + , base_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type >>> + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_DHP, base_cmpmix ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_DHP, base_mutex ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc, ci::opt::lock_type> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, base_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef cds::backoff::empty back_off; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + + TEST_F( IntrusiveSplitListLazySet_DHP, member_cmp ) + { + typedef ci::LazyList< gc_type + ,member_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_DHP, member_less ) + { + typedef ci::LazyList< gc_type + , member_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_DHP, member_cmpmix ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_DHP, member_mutex ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc, ci::opt::lock_type> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, member_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + +} // namespace diff --git a/test/unit/set/intrusive_split_lazy_hp.cpp b/test/unit/set/intrusive_split_lazy_hp.cpp new file mode 100644 index 00000000..eadc0232 --- /dev/null +++ b/test/unit/set/intrusive_split_lazy_hp.cpp @@ -0,0 +1,259 @@ +/* + 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_intrusive_set_hp.h" + +#include +#include + +#include + +namespace { + namespace ci = cds::intrusive; + typedef cds::gc::HP gc_type; + + class IntrusiveSplitListLazySet_HP : public cds_test::intrusive_set_hp + { + protected: + typedef cds_test::intrusive_set_hp base_class; + + protected: + typedef typename base_class::base_int_item< ci::split_list::node< ci::lazy_list::node>> base_item_type; + typedef typename base_class::base_int_item< ci::split_list::node< ci::lazy_list::node>> base_mutex_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::lazy_list::node>> member_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::lazy_list::node>> member_mutex_item_type; + + void SetUp() + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + }; + typedef ci::LazyList< gc_type, base_item_type, list_traits > list_type; + typedef ci::SplitListSet< gc_type, list_type > 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( IntrusiveSplitListLazySet_HP, base_cmp ) + { + typedef ci::LazyList< gc_type + , base_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type > > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + ,ci::opt::back_off< cds::backoff::pause > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_HP, base_less ) + { + typedef ci::LazyList< gc_type + , base_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type >>> + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_HP, base_cmpmix ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_HP, base_mutex ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc, ci::opt::lock_type> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, base_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef cds::backoff::empty back_off; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + + TEST_F( IntrusiveSplitListLazySet_HP, member_cmp ) + { + typedef ci::LazyList< gc_type + ,member_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_HP, member_less ) + { + typedef ci::LazyList< gc_type + , member_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_HP, member_cmpmix ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_HP, member_mutex ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc, ci::opt::lock_type> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, member_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + +} // namespace diff --git a/test/unit/set/intrusive_split_lazy_nogc.cpp b/test/unit/set/intrusive_split_lazy_nogc.cpp new file mode 100644 index 00000000..a832f383 --- /dev/null +++ b/test/unit/set/intrusive_split_lazy_nogc.cpp @@ -0,0 +1,245 @@ +/* + 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_intrusive_set_nogc.h" + +#include +#include + +#include + +namespace { + namespace ci = cds::intrusive; + typedef cds::gc::nogc gc_type; + + class IntrusiveSplitListLazySet_NoGC : public cds_test::intrusive_set_nogc + { + protected: + typedef cds_test::intrusive_set_nogc base_class; + + protected: + typedef typename base_class::base_int_item< ci::split_list::node< ci::lazy_list::node>> base_item_type; + typedef typename base_class::base_int_item< ci::split_list::node< ci::lazy_list::node>> base_mutex_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::lazy_list::node>> member_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::lazy_list::node>> member_mutex_item_type; + + //void SetUp() + //{} + + //void TearDown() + //{} + }; + + + TEST_F( IntrusiveSplitListLazySet_NoGC, base_cmp ) + { + typedef ci::LazyList< gc_type + , base_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type > > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + ,ci::opt::back_off< cds::backoff::pause > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_NoGC, base_less ) + { + typedef ci::LazyList< gc_type + , base_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type >>> + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_NoGC, base_cmpmix ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_NoGC, base_mutex ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc, ci::opt::lock_type> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, base_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef cds::backoff::empty back_off; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + + TEST_F( IntrusiveSplitListLazySet_NoGC, member_cmp ) + { + typedef ci::LazyList< gc_type + ,member_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_NoGC, member_less ) + { + typedef ci::LazyList< gc_type + , member_item_type + ,ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_NoGC, member_cmpmix ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListLazySet_NoGC, member_mutex ) + { + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc, ci::opt::lock_type> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< gc_type, member_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + +} // namespace diff --git a/test/unit/set/intrusive_split_lazy_rcu_gpb.cpp b/test/unit/set/intrusive_split_lazy_rcu_gpb.cpp new file mode 100644 index 00000000..5bdac588 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::general_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveSplitLazySet, rcu_implementation ); diff --git a/test/unit/set/intrusive_split_lazy_rcu_gpi.cpp b/test/unit/set/intrusive_split_lazy_rcu_gpi.cpp new file mode 100644 index 00000000..2008d870 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::general_instant<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveSplitLazySet, rcu_implementation ); diff --git a/test/unit/set/intrusive_split_lazy_rcu_gpt.cpp b/test/unit/set/intrusive_split_lazy_rcu_gpt.cpp new file mode 100644 index 00000000..ae833f13 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::general_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveSplitLazySet, rcu_implementation ); diff --git a/test/unit/set/intrusive_split_lazy_rcu_shb.cpp b/test/unit/set/intrusive_split_lazy_rcu_shb.cpp new file mode 100644 index 00000000..3968e5d7 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::signal_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveSplitLazySet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/intrusive_split_lazy_rcu_sht.cpp b/test/unit/set/intrusive_split_lazy_rcu_sht.cpp new file mode 100644 index 00000000..afa910c3 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_lazy_rcu.h" + +namespace { + + typedef cds::urcu::signal_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveSplitLazySet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/intrusive_split_michael_dhp.cpp b/test/unit/set/intrusive_split_michael_dhp.cpp new file mode 100644 index 00000000..5d067b79 --- /dev/null +++ b/test/unit/set/intrusive_split_michael_dhp.cpp @@ -0,0 +1,208 @@ +/* + 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_intrusive_set_hp.h" + +#include +#include + +namespace { + namespace ci = cds::intrusive; + typedef cds::gc::DHP gc_type; + + class IntrusiveSplitListSet_DHP : public cds_test::intrusive_set_hp + { + protected: + typedef cds_test::intrusive_set_hp base_class; + + protected: + typedef typename base_class::base_int_item< ci::split_list::node< ci::michael_list::node>> base_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::michael_list::node>> member_item_type; + + void SetUp() + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::base_hook< ci::opt::gc> hook; + }; + typedef ci::MichaelList< gc_type, base_item_type, list_traits > list_type; + typedef ci::SplitListSet< gc_type, list_type > 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( IntrusiveSplitListSet_DHP, base_cmp ) + { + typedef ci::MichaelList< gc_type + , base_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type > > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_DHP, base_less ) + { + typedef ci::MichaelList< gc_type + , base_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type >>> + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + ,ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_DHP, base_cmpmix ) + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::base_hook< ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + + TEST_F( IntrusiveSplitListSet_DHP, member_cmp ) + { + typedef ci::MichaelList< gc_type + ,member_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_DHP, member_less ) + { + typedef ci::MichaelList< gc_type + , member_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + ,ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_DHP, member_cmpmix ) + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + +} // namespace diff --git a/test/unit/set/intrusive_split_michael_hp.cpp b/test/unit/set/intrusive_split_michael_hp.cpp new file mode 100644 index 00000000..c904eeb3 --- /dev/null +++ b/test/unit/set/intrusive_split_michael_hp.cpp @@ -0,0 +1,209 @@ +/* + 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_intrusive_set_hp.h" + +#include +#include + +namespace { + namespace ci = cds::intrusive; + typedef cds::gc::HP gc_type; + + class IntrusiveSplitListSet_HP : public cds_test::intrusive_set_hp + { + protected: + typedef cds_test::intrusive_set_hp base_class; + + protected: + typedef typename base_class::base_int_item< ci::split_list::node< ci::michael_list::node>> base_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::michael_list::node>> member_item_type; + + void SetUp() + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::base_hook< ci::opt::gc> hook; + }; + typedef ci::MichaelList< gc_type, base_item_type, list_traits > list_type; + typedef ci::SplitListSet< gc_type, list_type > 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( IntrusiveSplitListSet_HP, base_cmp ) + { + typedef ci::MichaelList< gc_type + , base_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type > > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_HP, base_less ) + { + typedef ci::MichaelList< gc_type + , base_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type >>> + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + ,ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_HP, base_cmpmix ) + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::base_hook< ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + + TEST_F( IntrusiveSplitListSet_HP, member_cmp ) + { + typedef ci::MichaelList< gc_type + ,member_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_HP, member_less ) + { + typedef ci::MichaelList< gc_type + , member_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + ,ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_HP, member_cmpmix ) + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + +} // namespace diff --git a/test/unit/set/intrusive_split_michael_nogc.cpp b/test/unit/set/intrusive_split_michael_nogc.cpp new file mode 100644 index 00000000..ed7c0c3b --- /dev/null +++ b/test/unit/set/intrusive_split_michael_nogc.cpp @@ -0,0 +1,195 @@ +/* + 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_intrusive_set_nogc.h" + +#include +#include + +namespace { + namespace ci = cds::intrusive; + typedef cds::gc::nogc gc_type; + + class IntrusiveSplitListSet_NoGC : public cds_test::intrusive_set_nogc + { + protected: + typedef cds_test::intrusive_set_nogc base_class; + + protected: + typedef typename base_class::base_int_item< ci::split_list::node< ci::michael_list::node>> base_item_type; + typedef typename base_class::member_int_item< ci::split_list::node< ci::michael_list::node>> member_item_type; + + //void SetUp() + //{} + + //void TearDown() + //{} + }; + + + TEST_F( IntrusiveSplitListSet_NoGC, base_cmp ) + { + typedef ci::MichaelList< gc_type + , base_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type > > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_NoGC, base_less ) + { + typedef ci::MichaelList< gc_type + , base_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type >>> + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_NoGC, base_cmpmix ) + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::base_hook< ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + + TEST_F( IntrusiveSplitListSet_NoGC, member_cmp ) + { + typedef ci::MichaelList< gc_type + ,member_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::compare< cmp > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_NoGC, member_less ) + { + typedef ci::MichaelList< gc_type + , member_item_type + ,ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + ,ci::opt::less< less > + ,ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< gc_type, bucket_type, + ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + + TEST_F( IntrusiveSplitListSet_NoGC, member_cmpmix ) + { + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef base_class::less less; + typedef cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef simple_item_counter item_counter; + }; + typedef ci::SplitListSet< gc_type, bucket_type, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + +} // namespace diff --git a/test/unit/set/intrusive_split_michael_rcu_gpb.cpp b/test/unit/set/intrusive_split_michael_rcu_gpb.cpp new file mode 100644 index 00000000..bf923960 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::general_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveSplitMichaelSet, rcu_implementation ); diff --git a/test/unit/set/intrusive_split_michael_rcu_gpi.cpp b/test/unit/set/intrusive_split_michael_rcu_gpi.cpp new file mode 100644 index 00000000..a62aa084 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::general_instant<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveSplitMichaelSet, rcu_implementation ); diff --git a/test/unit/set/intrusive_split_michael_rcu_gpt.cpp b/test/unit/set/intrusive_split_michael_rcu_gpt.cpp new file mode 100644 index 00000000..56a7bc16 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::general_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveSplitMichaelSet, rcu_implementation ); diff --git a/test/unit/set/intrusive_split_michael_rcu_shb.cpp b/test/unit/set/intrusive_split_michael_rcu_shb.cpp new file mode 100644 index 00000000..81f45389 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::signal_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveSplitMichaelSet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/intrusive_split_michael_rcu_sht.cpp b/test/unit/set/intrusive_split_michael_rcu_sht.cpp new file mode 100644 index 00000000..cb646b92 --- /dev/null +++ b/test/unit/set/intrusive_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_intrusive_split_michael_rcu.h" + +namespace { + + typedef cds::urcu::signal_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveSplitMichaelSet, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/set/test_intrusive_split_lazy_rcu.h b/test/unit/set/test_intrusive_split_lazy_rcu.h new file mode 100644 index 00000000..33ab6fd5 --- /dev/null +++ b/test/unit/set/test_intrusive_split_lazy_rcu.h @@ -0,0 +1,302 @@ +/* + 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_INTRUSIVE_SPLIT_LAZY_RCU_H +#define CDSUNIT_SET_TEST_INTRUSIVE_SPLIT_LAZY_RCU_H + +#include "test_intrusive_set_rcu.h" +#include +#include + +namespace ci = cds::intrusive; + +template +class IntrusiveSplitLazySet: public cds_test::intrusive_set_rcu +{ + typedef cds_test::intrusive_set_rcu base_class; +public: + typedef cds::urcu::gc rcu_type; + typedef typename base_class::base_int_item< ci::split_list::node>> base_item_type; + typedef typename base_class::base_int_item< ci::split_list::node>> base_mutex_item_type; + typedef typename base_class::member_int_item< ci::split_list::node>> member_item_type; + typedef typename base_class::member_int_item< ci::split_list::node>> member_mutex_item_type; + +protected: + void SetUp() + { + RCU::Construct(); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + RCU::Destruct(); + } +}; + +TYPED_TEST_CASE_P( IntrusiveSplitLazySet ); + +TYPED_TEST_P( IntrusiveSplitLazySet, base_cmp ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template cmp cmp; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::LazyList< rcu_type + , base_item_type + , typename ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type > > > + , ci::opt::compare< cmp > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, base_less ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template less less; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::LazyList< rcu_type + , base_item_type + , typename ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type >>> + , ci::opt::less< less > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, base_cmpmix ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, base_mutex ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_mutex_item_type base_mutex_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc, ci::opt::lock_type> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, base_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + typedef cds::backoff::empty back_off; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + + +TYPED_TEST_P( IntrusiveSplitLazySet, member_cmp ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template cmp cmp; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::LazyList< rcu_type + , member_item_type + , typename ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + >> + , ci::opt::compare< cmp > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, member_less ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template less less; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::LazyList< rcu_type + , member_item_type + , typename ci::lazy_list::make_traits< + ci::opt::hook< ci::lazy_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + , ci::opt::less< less > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, member_cmpmix ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, member_mutex ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_mutex_item_type member_mutex_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits : public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc, ci::opt::lock_type> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, member_mutex_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + + +// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as +// "No test named can be found in this test case" +REGISTER_TYPED_TEST_CASE_P( IntrusiveSplitLazySet, + base_cmp, base_less, base_cmpmix, base_mutex, member_cmp, member_less, member_cmpmix, member_mutex +); + + +#endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H + \ No newline at end of file diff --git a/test/unit/set/test_intrusive_split_michael_rcu.h b/test/unit/set/test_intrusive_split_michael_rcu.h new file mode 100644 index 00000000..e67097f7 --- /dev/null +++ b/test/unit/set/test_intrusive_split_michael_rcu.h @@ -0,0 +1,246 @@ +/* + 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_INTRUSIVE_SPLIT_MICHAEL_RCU_H +#define CDSUNIT_SET_TEST_INTRUSIVE_SPLIT_MICHAEL_RCU_H + +#include "test_intrusive_set_rcu.h" +#include +#include + +namespace ci = cds::intrusive; + +template +class IntrusiveSplitMichaelSet: public cds_test::intrusive_set_rcu +{ + typedef cds_test::intrusive_set_rcu base_class; +public: + typedef cds::urcu::gc rcu_type; + typedef typename base_class::base_int_item< ci::split_list::node>> base_item_type; + typedef typename base_class::member_int_item< ci::split_list::node>> member_item_type; + +protected: + void SetUp() + { + RCU::Construct(); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + RCU::Destruct(); + } +}; + +TYPED_TEST_CASE_P( IntrusiveSplitMichaelSet ); + +TYPED_TEST_P( IntrusiveSplitMichaelSet, base_cmp ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template cmp cmp; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::MichaelList< rcu_type + , base_item_type + , typename ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< rcu_type > > > + , ci::opt::compare< cmp > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitMichaelSet, base_less ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template less less; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::MichaelList< rcu_type + , base_item_type + , typename ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< rcu_type >>> + , ci::opt::less< less > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::item_counter< cds::atomicity::item_counter > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitMichaelSet, base_cmpmix ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::base_hook< ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< rcu_type, base_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + + +TYPED_TEST_P( IntrusiveSplitMichaelSet, member_cmp ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template cmp cmp; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::MichaelList< rcu_type + , member_item_type + , typename ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + >> + , ci::opt::compare< cmp > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitMichaelSet, member_less ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::template less less; + typedef typename TestFixture::hash_int hash_int; + + typedef ci::MichaelList< rcu_type + , member_item_type + , typename ci::michael_list::make_traits< + ci::opt::hook< ci::michael_list::member_hook< + offsetof( member_item_type, hMember ), + ci::opt::gc + > > + , ci::opt::less< less > + , ci::opt::disposer< mock_disposer > + >::type + > bucket_type; + + typedef ci::SplitListSet< rcu_type, bucket_type, + typename ci::split_list::make_traits< + ci::opt::hash< hash_int > + , ci::opt::back_off< cds::backoff::pause > + >::type + > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitMichaelSet, member_cmpmix ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits : public ci::michael_list::traits + { + typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::MichaelList< rcu_type, member_item_type, list_traits > bucket_type; + + struct set_traits : public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + + + +// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as +// "No test named can be found in this test case" +REGISTER_TYPED_TEST_CASE_P( IntrusiveSplitMichaelSet, + base_cmp, base_less, base_cmpmix, member_cmp, member_less, member_cmpmix +); + + +#endif // CDSUNIT_SET_TEST_INTRUSIVE_SPLIT_MICHAEL_RCU_H + \ No newline at end of file