From cd90c45e961d31fe2d208ebf09df17634e403bec Mon Sep 17 00:00:00 2001 From: khizmax Date: Mon, 21 Mar 2016 00:22:22 +0300 Subject: [PATCH] Migrated intrusive StripedSet unit test to gtest framework --- projects/Win/vc14/gtest-striped-set.vcxproj | 20 +- .../vc14/gtest-striped-set.vcxproj.filters | 24 ++ test/unit/striped-set/CMakeLists.txt | 7 + .../striped-set/intrusive_boost_avl_set.cpp | 64 ++++ .../unit/striped-set/intrusive_boost_list.cpp | 57 +++ test/unit/striped-set/intrusive_boost_set.cpp | 83 +++++ .../striped-set/intrusive_boost_sg_set.cpp | 71 ++++ .../striped-set/intrusive_boost_slist.cpp | 57 +++ .../striped-set/intrusive_boost_splay_set.cpp | 77 ++++ .../striped-set/intrusive_boost_treap_set.cpp | 85 +++++ .../unit/striped-set/intrusive_cuckoo_set.cpp | 46 +-- test/unit/striped-set/test_intrusive_set.h | 73 +++- .../striped-set/test_intrusive_striped_set.h | 345 ++++++++++++++++++ 13 files changed, 955 insertions(+), 54 deletions(-) create mode 100644 test/unit/striped-set/intrusive_boost_avl_set.cpp create mode 100644 test/unit/striped-set/intrusive_boost_list.cpp create mode 100644 test/unit/striped-set/intrusive_boost_set.cpp create mode 100644 test/unit/striped-set/intrusive_boost_sg_set.cpp create mode 100644 test/unit/striped-set/intrusive_boost_slist.cpp create mode 100644 test/unit/striped-set/intrusive_boost_splay_set.cpp create mode 100644 test/unit/striped-set/intrusive_boost_treap_set.cpp create mode 100644 test/unit/striped-set/test_intrusive_striped_set.h diff --git a/projects/Win/vc14/gtest-striped-set.vcxproj b/projects/Win/vc14/gtest-striped-set.vcxproj index 1540a602..8b5384dc 100644 --- a/projects/Win/vc14/gtest-striped-set.vcxproj +++ b/projects/Win/vc14/gtest-striped-set.vcxproj @@ -28,6 +28,13 @@ + + + + + + + _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) @@ -38,6 +45,7 @@ + @@ -148,7 +156,7 @@ NotUsing Level3 Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + CDSUNIT_ENABLE_BOOST_CONTAINER;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) @@ -164,7 +172,7 @@ NotUsing Level3 Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + CDSUNIT_ENABLE_BOOST_CONTAINER;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) @@ -180,7 +188,7 @@ NotUsing Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + CDSUNIT_ENABLE_BOOST_CONTAINER;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) @@ -196,7 +204,7 @@ NotUsing Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + CDSUNIT_ENABLE_BOOST_CONTAINER;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) @@ -214,7 +222,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + CDSUNIT_ENABLE_BOOST_CONTAINER;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) @@ -234,7 +242,7 @@ MaxSpeed true true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + CDSUNIT_ENABLE_BOOST_CONTAINER;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) $(SolutionDir)..\..\..;$(GTEST_ROOT)/include;$(SolutionDir)..\..\..\test\include;$(BOOST_PATH);%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) diff --git a/projects/Win/vc14/gtest-striped-set.vcxproj.filters b/projects/Win/vc14/gtest-striped-set.vcxproj.filters index 0c3d663d..9683579a 100644 --- a/projects/Win/vc14/gtest-striped-set.vcxproj.filters +++ b/projects/Win/vc14/gtest-striped-set.vcxproj.filters @@ -21,10 +21,34 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + Header Files + + Header Files + \ No newline at end of file diff --git a/test/unit/striped-set/CMakeLists.txt b/test/unit/striped-set/CMakeLists.txt index 0a6fe2f8..519aa3ed 100644 --- a/test/unit/striped-set/CMakeLists.txt +++ b/test/unit/striped-set/CMakeLists.txt @@ -4,7 +4,14 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -DCDSUNIT_ENABLE_B set(CDSGTEST_SET_SOURCES ../main.cpp + intrusive_boost_avl_set.cpp + intrusive_boost_list.cpp + intrusive_boost_set.cpp + intrusive_boost_sg_set.cpp + intrusive_boost_slist.cpp intrusive_cuckoo_set.cpp + intrusive_boost_splay_set.cpp + intrusive_boost_treap_set.cpp ) include_directories( diff --git a/test/unit/striped-set/intrusive_boost_avl_set.cpp b/test/unit/striped-set/intrusive_boost_avl_set.cpp new file mode 100644 index 00000000..faf832cd --- /dev/null +++ b/test/unit/striped-set/intrusive_boost_avl_set.cpp @@ -0,0 +1,64 @@ +/* + 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. +*/ + +#ifdef CDSUNIT_ENABLE_BOOST_CONTAINER + +#include +#if BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# define CDSTEST_REQUIRES_IMPLICIT_CONVERSION_WORKAROUND +#endif + +#include "test_intrusive_striped_set.h" +#include + +namespace { + namespace ci = cds::intrusive; + namespace bi = boost::intrusive; + + struct test_traits + { + typedef cds_test::intrusive_set::base_int_item< bi::avl_set_base_hook<> > base_item; + typedef cds_test::intrusive_set::member_int_item< bi::avl_set_member_hook<> > member_item; + + typedef bi::avl_set< base_item, + bi::compare< cds_test::intrusive_set::less< base_item >> + > base_hook_container; + + typedef bi::avl_set< member_item, + bi::member_hook< member_item, bi::avl_set_member_hook<>, &member_item::hMember>, + bi::compare< cds_test::intrusive_set::less< member_item >> + > member_hook_container; + }; + + INSTANTIATE_TYPED_TEST_CASE_P( BoostAvlSet, IntrusiveStripedSet, test_traits ); + +} // namespace + +#endif // CDSUNIT_ENABLE_BOOST_CONTAINER diff --git a/test/unit/striped-set/intrusive_boost_list.cpp b/test/unit/striped-set/intrusive_boost_list.cpp new file mode 100644 index 00000000..48f0a7eb --- /dev/null +++ b/test/unit/striped-set/intrusive_boost_list.cpp @@ -0,0 +1,57 @@ +/* + 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. +*/ + +#ifdef CDSUNIT_ENABLE_BOOST_CONTAINER + +#include +#include "test_intrusive_striped_set.h" + +namespace { + namespace ci = cds::intrusive; + namespace bi = boost::intrusive; + + struct test_traits + { + typedef cds_test::intrusive_set::base_int_item< bi::list_base_hook<> > base_item; + typedef cds_test::intrusive_set::member_int_item< bi::list_member_hook<> > member_item; + + typedef bi::list< base_item, bi::constant_time_size> base_hook_container; + + typedef bi::list< member_item, + bi::member_hook< member_item, bi::list_member_hook<>, &member_item::hMember>, + bi::constant_time_size + > member_hook_container; + }; + + INSTANTIATE_TYPED_TEST_CASE_P( BoostList, IntrusiveStripedSet, test_traits ); + +} // namespace + +#endif // CDSUNIT_ENABLE_BOOST_CONTAINER diff --git a/test/unit/striped-set/intrusive_boost_set.cpp b/test/unit/striped-set/intrusive_boost_set.cpp new file mode 100644 index 00000000..9baf1456 --- /dev/null +++ b/test/unit/striped-set/intrusive_boost_set.cpp @@ -0,0 +1,83 @@ +/* + 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. +*/ + +#ifdef CDSUNIT_ENABLE_BOOST_CONTAINER + +#include +#if BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# define CDSTEST_REQUIRES_IMPLICIT_CONVERSION_WORKAROUND +#endif + +#include "test_intrusive_striped_set.h" +#include + +#if 0 //BOOST_VERSION >= 105900 +# define CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( type ) ,bi::key_of_value< get_key< type >> +#else +# define CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( type ) +#endif + +namespace { + namespace ci = cds::intrusive; + namespace bi = boost::intrusive; + + template + struct get_key + { + typedef int type; + + int operator()( Node const& v ) const + { + return v.key(); + } + }; + + struct test_traits + { + typedef cds_test::intrusive_set::base_int_item< bi::set_base_hook<> > base_item; + typedef cds_test::intrusive_set::member_int_item< bi::set_member_hook<> > member_item; + + typedef bi::set< base_item, + bi::compare< cds_test::intrusive_set::less< base_item >> + CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( base_item ) + > base_hook_container; + + typedef bi::set< member_item, + bi::member_hook< member_item, bi::set_member_hook<>, &member_item::hMember>, + bi::compare< cds_test::intrusive_set::less< member_item >> + CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( member_item ) + > member_hook_container; + }; + + INSTANTIATE_TYPED_TEST_CASE_P( BoostSet, IntrusiveStripedSet, test_traits ); + +} // namespace + +#endif // CDSUNIT_ENABLE_BOOST_CONTAINER diff --git a/test/unit/striped-set/intrusive_boost_sg_set.cpp b/test/unit/striped-set/intrusive_boost_sg_set.cpp new file mode 100644 index 00000000..f1650517 --- /dev/null +++ b/test/unit/striped-set/intrusive_boost_sg_set.cpp @@ -0,0 +1,71 @@ +/* + 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. +*/ + +#ifdef CDSUNIT_ENABLE_BOOST_CONTAINER + +#include + +#if BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# define CDSTEST_REQUIRES_IMPLICIT_CONVERSION_WORKAROUND +#endif + +#include +#if ( CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG ) && BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# pragma message("boost 1.59 - 1.60 has a bug in boost::intrusive::sg_set, test skipped") +#else + +#include "test_intrusive_striped_set.h" +#include + +namespace { + namespace ci = cds::intrusive; + namespace bi = boost::intrusive; + + struct test_traits + { + typedef cds_test::intrusive_set::base_int_item< bi::bs_set_base_hook<> > base_item; + typedef cds_test::intrusive_set::member_int_item< bi::bs_set_member_hook<> > member_item; + + typedef bi::sg_set< base_item, + bi::compare< cds_test::intrusive_set::less< base_item >> + > base_hook_container; + + typedef bi::sg_set< member_item, + bi::member_hook< member_item, bi::bs_set_member_hook<>, &member_item::hMember>, + bi::compare< cds_test::intrusive_set::less< member_item >> + > member_hook_container; + }; + + INSTANTIATE_TYPED_TEST_CASE_P( BoostSgSet, IntrusiveStripedSet, test_traits ); + +} // namespace + +#endif +#endif // CDSUNIT_ENABLE_BOOST_CONTAINER diff --git a/test/unit/striped-set/intrusive_boost_slist.cpp b/test/unit/striped-set/intrusive_boost_slist.cpp new file mode 100644 index 00000000..99fd8c3e --- /dev/null +++ b/test/unit/striped-set/intrusive_boost_slist.cpp @@ -0,0 +1,57 @@ +/* + 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. +*/ + +#ifdef CDSUNIT_ENABLE_BOOST_CONTAINER + +#include +#include "test_intrusive_striped_set.h" + +namespace { + namespace ci = cds::intrusive; + namespace bi = boost::intrusive; + + struct test_traits + { + typedef cds_test::intrusive_set::base_int_item< bi::slist_base_hook<> > base_item; + typedef cds_test::intrusive_set::member_int_item< bi::slist_member_hook<> > member_item; + + typedef bi::slist< base_item, bi::constant_time_size> base_hook_container; + + typedef bi::slist< member_item, + bi::member_hook< member_item, bi::slist_member_hook<>, &member_item::hMember>, + bi::constant_time_size + > member_hook_container; + }; + + INSTANTIATE_TYPED_TEST_CASE_P( BoostSList, IntrusiveStripedSet, test_traits ); + +} // namespace + +#endif // CDSUNIT_ENABLE_BOOST_CONTAINER diff --git a/test/unit/striped-set/intrusive_boost_splay_set.cpp b/test/unit/striped-set/intrusive_boost_splay_set.cpp new file mode 100644 index 00000000..bb1555fb --- /dev/null +++ b/test/unit/striped-set/intrusive_boost_splay_set.cpp @@ -0,0 +1,77 @@ +/* + 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. +*/ + +#ifdef CDSUNIT_ENABLE_BOOST_CONTAINER + +#include +#if BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# define CDSTEST_REQUIRES_IMPLICIT_CONVERSION_WORKAROUND +#endif + +#include +#if ( CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG ) && BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# pragma message("boost 1.59 - 1.60 has a bug in boost::intrusive::splay_set, test skipped") +#else + +#include "test_intrusive_striped_set.h" +#include + +namespace { + namespace ci = cds::intrusive; + namespace bi = boost::intrusive; + + struct test_traits + { +# if BOOST_VERSION < 105600 + typedef bi::splay_set_member_hook<> splay_set_member_hook; + typedef bi::splay_set_base_hook<> splay_set_base_hook; +#else + typedef bi::bs_set_base_hook<> splay_set_base_hook; + typedef bi::bs_set_member_hook<> splay_set_member_hook; +#endif + typedef cds_test::intrusive_set::base_int_item< splay_set_base_hook > base_item; + typedef cds_test::intrusive_set::member_int_item< splay_set_member_hook > member_item; + + typedef bi::splay_set< base_item, + bi::compare< cds_test::intrusive_set::less< base_item >> + > base_hook_container; + + typedef bi::splay_set< member_item, + bi::member_hook< member_item, splay_set_member_hook, &member_item::hMember>, + bi::compare< cds_test::intrusive_set::less< member_item >> + > member_hook_container; + }; + + INSTANTIATE_TYPED_TEST_CASE_P( BoostSplaySet, IntrusiveStripedSet, test_traits ); + +} // namespace + +#endif +#endif // CDSUNIT_ENABLE_BOOST_CONTAINER diff --git a/test/unit/striped-set/intrusive_boost_treap_set.cpp b/test/unit/striped-set/intrusive_boost_treap_set.cpp new file mode 100644 index 00000000..115ac139 --- /dev/null +++ b/test/unit/striped-set/intrusive_boost_treap_set.cpp @@ -0,0 +1,85 @@ +/* + 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. +*/ + +#ifdef CDSUNIT_ENABLE_BOOST_CONTAINER + +#include + +#if BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# define CDSTEST_REQUIRES_IMPLICIT_CONVERSION_WORKAROUND +#endif + +#include +#if ( CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG ) && BOOST_VERSION >= 105900 && BOOST_VERSION < 106100 +# pragma message("boost 1.59 - 1.60 has a bug in boost::intrusive::treap_set, test skipped") +#else + +#include "test_intrusive_striped_set.h" +#include + +namespace { + namespace ci = cds::intrusive; + namespace bi = boost::intrusive; + + template + struct priority_cmp: private cds_test::intrusive_set::less + { + typedef cds_test::intrusive_set::less base_class; + + template + bool operator()( A const& a, B const& b ) const + { + return base_class::operator()( b, a ); + } + }; + + struct test_traits + { + typedef cds_test::intrusive_set::base_int_item< bi::bs_set_base_hook<> > base_item; + typedef cds_test::intrusive_set::member_int_item< bi::bs_set_member_hook<> > member_item; + + typedef bi::treap_set< base_item, + bi::compare< cds_test::intrusive_set::less< base_item >>, + bi::priority> + > base_hook_container; + + typedef bi::treap_set< member_item, + bi::member_hook< member_item, bi::bs_set_member_hook<>, &member_item::hMember>, + bi::compare< cds_test::intrusive_set::less< member_item >>, + bi::priority> + > member_hook_container; + }; + + INSTANTIATE_TYPED_TEST_CASE_P( BoostTreapSet, IntrusiveStripedSet, test_traits ); + +} // namespace + +#endif +#endif // CDSUNIT_ENABLE_BOOST_CONTAINER diff --git a/test/unit/striped-set/intrusive_cuckoo_set.cpp b/test/unit/striped-set/intrusive_cuckoo_set.cpp index 81097194..b1b9f969 100644 --- a/test/unit/striped-set/intrusive_cuckoo_set.cpp +++ b/test/unit/striped-set/intrusive_cuckoo_set.cpp @@ -42,31 +42,6 @@ namespace { typedef base_class::hash_int hash1; - struct hash2: private hash1 - { - typedef hash1 base_class; - - size_t operator()( int i ) const - { - size_t h = ~(base_class::operator()( i )); - return ~h + 0x9e3779b9 + (h << 6) + (h >> 2); - } - template - size_t operator()( const Item& i ) const - { - size_t h = ~(base_class::operator()( i )); - return ~h + 0x9e3779b9 + (h << 6) + (h >> 2); - } - }; - - struct disposer2 - { - template - void operator ()( T * p ) - { - ++p->nEraseCount; - } - }; template void test( Set& s ) @@ -76,23 +51,15 @@ namespace { base_class::test_< Set::c_isSorted>( s ); - ASSERT_TRUE( s.empty() ); - ASSERT_CONTAINER_SIZE( s, 0 ); - typedef typename Set::value_type value_type; + size_t const nSetSize = base_class::kSize; std::vector< value_type > data; - std::vector< size_t> indices; - data.reserve( kSize ); - indices.reserve( kSize ); - size_t const nSetSize = kSize; - for ( size_t key = 0; key < kSize; ++key ) { + data.reserve( nSetSize ); + for ( size_t key = 0; key < nSetSize; ++key ) data.push_back( value_type( static_cast(key) ) ); - indices.push_back( key ); - } - shuffle( indices.begin(), indices.end() ); - // clear_and_dispose + // clear for ( auto& i : data ) { i.clear_stat(); ASSERT_TRUE( s.insert( i ) ); @@ -100,13 +67,12 @@ namespace { ASSERT_FALSE( s.empty() ); ASSERT_CONTAINER_SIZE( s, nSetSize ); - s.clear_and_dispose( disposer2()); + s.clear(); ASSERT_TRUE( s.empty() ); ASSERT_CONTAINER_SIZE( s, 0 ); for ( auto& i : data ) { - EXPECT_EQ( i.nDisposeCount, 0 ); - EXPECT_EQ( i.nEraseCount, 1 ); + EXPECT_EQ( i.nDisposeCount, 1 ); } } diff --git a/test/unit/striped-set/test_intrusive_set.h b/test/unit/striped-set/test_intrusive_set.h index b8c673ff..fe4f8ef1 100644 --- a/test/unit/striped-set/test_intrusive_set.h +++ b/test/unit/striped-set/test_intrusive_set.h @@ -36,6 +36,12 @@ #include +#ifdef CDSTEST_REQUIRES_IMPLICIT_CONVERSION_WORKAROUND +# define CDSTEST_EXPLICIT +#else +# define CDSTEST_EXPLICIT explicit +#endif + // forward declaration namespace cds { namespace intrusive {}} @@ -80,7 +86,7 @@ namespace cds_test { base_int_item() {} - explicit base_int_item( int key ) + CDSTEST_EXPLICIT base_int_item( int key ) : nKey( key ) , nVal( key ) {} @@ -118,7 +124,7 @@ namespace cds_test { member_int_item() {} - explicit member_int_item( int key ) + CDSTEST_EXPLICIT member_int_item( int key ) : nKey( key ) , nVal( key ) {} @@ -151,6 +157,24 @@ namespace cds_test { return (*this)( i.key() ); } }; + typedef hash_int hash1; + + struct hash2: private hash1 + { + typedef hash1 base_class; + + size_t operator()( int i ) const + { + size_t h = ~(base_class::operator()( i )); + return ~h + 0x9e3779b9 + (h << 6) + (h >> 2); + } + template + size_t operator()( const Item& i ) const + { + size_t h = ~(base_class::operator()( i )); + return ~h + 0x9e3779b9 + (h << 6) + (h >> 2); + } + }; struct simple_item_counter { size_t m_nCount; @@ -189,17 +213,20 @@ namespace cds_test { return v1.key() < v2.key(); } - template - bool operator ()(const T& v1, const Q& v2 ) const + bool operator ()(const T& v1, int v2 ) const { return v1.key() < v2; } - template - bool operator ()(const Q& v1, const T& v2 ) const + bool operator ()(int v1, const T& v2 ) const { return v1 < v2.key(); } + + bool operator()( int v1, int v2 ) const + { + return v1 < v2; + } }; template @@ -262,11 +289,27 @@ namespace cds_test { }; struct other_less { - template - bool operator()( Q const& lhs, T const& rhs ) const + template + bool operator()( other_item const& lhs, T const& rhs ) const + { + return lhs.key() < rhs.key(); + } + + template + bool operator()( T const& lhs, other_item const& rhs ) const { return lhs.key() < rhs.key(); } + + bool operator()( other_item const& lhs, int rhs ) const + { + return lhs.key() < rhs; + } + + bool operator()( int lhs, other_item const& rhs ) const + { + return lhs < rhs.key(); + } }; struct other_equal_to { @@ -448,11 +491,25 @@ namespace cds_test { s.clear(); + ASSERT_TRUE( s.empty() ); + ASSERT_CONTAINER_SIZE( s, 0 ); + + // clear_and_dispose + for ( auto& i : data ) { + i.clear_stat(); + ASSERT_TRUE( s.insert( i ) ); + } + ASSERT_FALSE( s.empty() ); + ASSERT_CONTAINER_SIZE( s, nSetSize ); + + s.clear_and_dispose( mock_disposer() ); + ASSERT_TRUE( s.empty() ); ASSERT_CONTAINER_SIZE( s, 0 ); for ( auto& i : data ) { EXPECT_EQ( i.nDisposeCount, 1 ); } + } }; diff --git a/test/unit/striped-set/test_intrusive_striped_set.h b/test/unit/striped-set/test_intrusive_striped_set.h new file mode 100644 index 00000000..b0493fd6 --- /dev/null +++ b/test/unit/striped-set/test_intrusive_striped_set.h @@ -0,0 +1,345 @@ +/* + 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_STRIPED_SET_H +#define CDSUNIT_SET_TEST_INTRUSIVE_STRIPED_SET_H + +#include "test_intrusive_set.h" + +#include + +namespace { + namespace ci = cds::intrusive; + + template + class IntrusiveStripedSet : public cds_test::intrusive_set + { + protected: + typedef cds_test::intrusive_set base_class; + + typedef typename ContainerPair::base_item base_item; + typedef typename ContainerPair::member_item member_item; + + typedef typename ContainerPair::base_hook_container base_hook_container; + typedef typename ContainerPair::member_hook_container member_hook_container; + + //void SetUp() + //{} + + //void TearDown() + //{} + }; + + TYPED_TEST_CASE_P( IntrusiveStripedSet ); + +// **************************************************************** +// striped base hook + + TYPED_TEST_P( IntrusiveStripedSet, striped_basehook_compare ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_basehook_less ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >> + > set_type; + + set_type s( 32 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_basehook_cmpmix ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>, + ci::opt::resizing_policy< ci::striped_set::load_factor_resizing< 8 >> + > set_type; + + set_type s( 64 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_basehook_resizing_threshold ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<8>> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_basehook_resizing_threshold_rt ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash2 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<0>> + > set_type; + + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 )); + this->test( s ); + } + +// **************************************************************** +// striped member hook + + TYPED_TEST_P( IntrusiveStripedSet, striped_memberhook_compare ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_memberhook_less ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >> + > set_type; + + set_type s( 32 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_memberhook_cmpmix ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>, + ci::opt::resizing_policy< ci::striped_set::load_factor_resizing< 8 >> + > set_type; + + set_type s( 64 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_memberhook_resizing_threshold ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<8>> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, striped_memberhook_resizing_threshold_rt ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash2 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<0>> + > set_type; + + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 ) ); + this->test( s ); + } + + +// **************************************************************** +// refinable base hook + + TYPED_TEST_P( IntrusiveStripedSet, refinable_basehook_compare ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_basehook_less ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >> + > set_type; + + set_type s( 32 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_basehook_cmpmix ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>, + ci::opt::resizing_policy< ci::striped_set::load_factor_resizing< 8 >> + > set_type; + + set_type s( 64 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_basehook_resizing_threshold ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<8>> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_basehook_resizing_threshold_rt ) + { + typedef ci::StripedSet< + typename TestFixture::base_hook_container, + ci::opt::hash< typename TestFixture::hash2 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::base_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::base_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<0>> + > set_type; + + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 )); + this->test( s ); + } + +// **************************************************************** +// refinable member hook + + TYPED_TEST_P( IntrusiveStripedSet, refinable_memberhook_compare ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_memberhook_less ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >> + > set_type; + + set_type s( 32 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_memberhook_cmpmix ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>, + ci::opt::resizing_policy< ci::striped_set::load_factor_resizing< 8 >> + > set_type; + + set_type s( 64 ); + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_memberhook_resizing_threshold ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash1 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<8>> + > set_type; + + set_type s; + this->test( s ); + } + + TYPED_TEST_P( IntrusiveStripedSet, refinable_memberhook_resizing_threshold_rt ) + { + typedef ci::StripedSet< + typename TestFixture::member_hook_container, + ci::opt::hash< typename TestFixture::hash2 >, + ci::opt::less< typename TestFixture::template less< typename TestFixture::member_item >>, + ci::opt::compare< typename TestFixture::template cmp< typename TestFixture::member_item >>, + ci::opt::resizing_policy< ci::striped_set::single_bucket_size_threshold<0>> + > set_type; + + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 ) ); + this->test( s ); + } + + REGISTER_TYPED_TEST_CASE_P( IntrusiveStripedSet, + striped_basehook_compare, striped_basehook_less, striped_basehook_cmpmix, striped_basehook_resizing_threshold, striped_basehook_resizing_threshold_rt, striped_memberhook_compare, striped_memberhook_less, striped_memberhook_cmpmix, striped_memberhook_resizing_threshold, striped_memberhook_resizing_threshold_rt, refinable_basehook_compare, refinable_basehook_less, refinable_basehook_cmpmix, refinable_basehook_resizing_threshold, refinable_basehook_resizing_threshold_rt, refinable_memberhook_compare, refinable_memberhook_less, refinable_memberhook_cmpmix, refinable_memberhook_resizing_threshold, refinable_memberhook_resizing_threshold_rt + ); + +} // namespace + +#endif // CDSUNIT_SET_TEST_INTRUSIVE_STRIPED_SET_H -- 2.34.1