From 0ce9aef5212c3da6ed903b14d8d90f7ebadf8fb4 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 3 Apr 2016 21:56:22 +0300 Subject: [PATCH] Migrated FeldmanHashMap uni tests to gtest framework --- projects/Win/vc14/gtest-map.vcxproj | 6 + projects/Win/vc14/gtest-map.vcxproj.filters | 18 ++ test/unit/map/CMakeLists.txt | 5 + test/unit/map/feldman_hashset_rcu_gpb.cpp | 41 +++ test/unit/map/feldman_hashset_rcu_gpi.cpp | 41 +++ test/unit/map/feldman_hashset_rcu_gpt.cpp | 41 +++ test/unit/map/feldman_hashset_rcu_shb.cpp | 45 ++++ test/unit/map/feldman_hashset_rcu_sht.cpp | 45 ++++ test/unit/map/test_feldman_hashmap_rcu.h | 282 ++++++++++++++++++++ 9 files changed, 524 insertions(+) create mode 100644 test/unit/map/feldman_hashset_rcu_gpb.cpp create mode 100644 test/unit/map/feldman_hashset_rcu_gpi.cpp create mode 100644 test/unit/map/feldman_hashset_rcu_gpt.cpp create mode 100644 test/unit/map/feldman_hashset_rcu_shb.cpp create mode 100644 test/unit/map/feldman_hashset_rcu_sht.cpp create mode 100644 test/unit/map/test_feldman_hashmap_rcu.h diff --git a/projects/Win/vc14/gtest-map.vcxproj b/projects/Win/vc14/gtest-map.vcxproj index f9dc23e9..c4a25c3c 100644 --- a/projects/Win/vc14/gtest-map.vcxproj +++ b/projects/Win/vc14/gtest-map.vcxproj @@ -30,6 +30,11 @@ + + + + + @@ -193,6 +198,7 @@ + diff --git a/projects/Win/vc14/gtest-map.vcxproj.filters b/projects/Win/vc14/gtest-map.vcxproj.filters index 4ecf4ea5..46d394f8 100644 --- a/projects/Win/vc14/gtest-map.vcxproj.filters +++ b/projects/Win/vc14/gtest-map.vcxproj.filters @@ -156,6 +156,21 @@ Source Files\FeldmanHashMap + + Source Files\FeldmanHashMap + + + Source Files\FeldmanHashMap + + + Source Files\FeldmanHashMap + + + Source Files\FeldmanHashMap + + + Source Files\FeldmanHashMap + @@ -197,5 +212,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/test/unit/map/CMakeLists.txt b/test/unit/map/CMakeLists.txt index aa9e8b02..d4a4565a 100644 --- a/test/unit/map/CMakeLists.txt +++ b/test/unit/map/CMakeLists.txt @@ -4,6 +4,11 @@ set(CDSGTEST_MAP_SOURCES ../main.cpp feldman_hashmap_hp.cpp feldman_hashmap_dhp.cpp + feldman_hashset_rcu_gpb.cpp + feldman_hashset_rcu_gpi.cpp + feldman_hashset_rcu_gpt.cpp + feldman_hashset_rcu_shb.cpp + feldman_hashset_rcu_sht.cpp michael_lazy_hp.cpp michael_lazy_dhp.cpp michael_lazy_nogc.cpp diff --git a/test/unit/map/feldman_hashset_rcu_gpb.cpp b/test/unit/map/feldman_hashset_rcu_gpb.cpp new file mode 100644 index 00000000..e27a5aa9 --- /dev/null +++ b/test/unit/map/feldman_hashset_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_feldman_hashmap_rcu.h" + +namespace { + + typedef cds::urcu::general_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, FeldmanHashMap, rcu_implementation ); diff --git a/test/unit/map/feldman_hashset_rcu_gpi.cpp b/test/unit/map/feldman_hashset_rcu_gpi.cpp new file mode 100644 index 00000000..1848c7e1 --- /dev/null +++ b/test/unit/map/feldman_hashset_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_feldman_hashmap_rcu.h" + +namespace { + + typedef cds::urcu::general_instant<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, FeldmanHashMap, rcu_implementation ); diff --git a/test/unit/map/feldman_hashset_rcu_gpt.cpp b/test/unit/map/feldman_hashset_rcu_gpt.cpp new file mode 100644 index 00000000..112abca6 --- /dev/null +++ b/test/unit/map/feldman_hashset_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_feldman_hashmap_rcu.h" + +namespace { + + typedef cds::urcu::general_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, FeldmanHashMap, rcu_implementation ); diff --git a/test/unit/map/feldman_hashset_rcu_shb.cpp b/test/unit/map/feldman_hashset_rcu_shb.cpp new file mode 100644 index 00000000..7ebee527 --- /dev/null +++ b/test/unit/map/feldman_hashset_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_feldman_hashmap_rcu.h" + +namespace { + + typedef cds::urcu::signal_buffered<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, FeldmanHashMap, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/map/feldman_hashset_rcu_sht.cpp b/test/unit/map/feldman_hashset_rcu_sht.cpp new file mode 100644 index 00000000..c6709491 --- /dev/null +++ b/test/unit/map/feldman_hashset_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_feldman_hashmap_rcu.h" + +namespace { + + typedef cds::urcu::signal_threaded<> rcu_implementation; + +} // namespace + +INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, FeldmanHashMap, rcu_implementation ); + +#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED diff --git a/test/unit/map/test_feldman_hashmap_rcu.h b/test/unit/map/test_feldman_hashmap_rcu.h new file mode 100644 index 00000000..3d464b1e --- /dev/null +++ b/test/unit/map/test_feldman_hashmap_rcu.h @@ -0,0 +1,282 @@ +/* + 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_MAP_TEST_FELDMAN_HASHMAP_RCU_H +#define CDSUNIT_MAP_TEST_FELDMAN_HASHMAP_RCU_H + +#include "test_feldman_hashmap.h" +#include + +namespace { + + template + class FeldmanHashMap: public cds_test::feldman_hashmap + { + typedef cds_test::feldman_hashmap base_class; + + protected: + typedef cds::urcu::gc rcu_type; + + template + void test( Map& m ) + { + // Precondition: map is empty + // Postcondition: map is empty + + base_class::test( m ); + + ASSERT_TRUE( m.empty()); + ASSERT_CONTAINER_SIZE( m, 0 ); + + typedef typename Map::value_type map_pair; + typedef typename Map::rcu_lock rcu_lock; + typedef typename Map::exempt_ptr exempt_ptr; + + size_t const kkSize = base_class::kSize; + + std::vector arrKeys; + for ( int i = 0; i < static_cast(kkSize); ++i ) + arrKeys.push_back( key_type( i )); + shuffle( arrKeys.begin(), arrKeys.end()); + + std::vector< value_type > arrVals; + for ( size_t i = 0; i < kkSize; ++i ) { + value_type val; + val.nVal = static_cast( i ); + val.strVal = std::to_string( i ); + arrVals.push_back( val ); + } + + for ( auto const& i : arrKeys ) + ASSERT_TRUE( m.insert( i ) ); + ASSERT_FALSE( m.empty() ); + ASSERT_CONTAINER_SIZE( m, kkSize ); + + // iterators + { + rcu_lock l; + size_t nCount = 0; + for ( auto it = m.begin(); it != m.end(); ++it ) { + EXPECT_EQ( it->second.nVal, 0 ); + it->second.nVal = it->first.nKey * 2; + ++nCount; + } + EXPECT_EQ( nCount, kkSize ); + + nCount = 0; + for ( auto it = m.cbegin(); it != m.cend(); ++it ) { + EXPECT_EQ( it->second.nVal, it->first.nKey * 2 ); + ++nCount; + } + EXPECT_EQ( nCount, kkSize ); + + nCount = 0; + for ( auto it = m.rbegin(); it != m.rend(); ++it ) { + EXPECT_EQ( it->second.nVal, it->first.nKey * 2 ); + it->second.nVal = it->first.nKey * 4; + ++nCount; + } + EXPECT_EQ( nCount, kkSize ); + + nCount = 0; + for ( auto it = m.crbegin(); it != m.crend(); ++it ) { + EXPECT_EQ( it->second.nVal, it->first.nKey * 4 ); + ++nCount; + } + EXPECT_EQ( nCount, kkSize ); + } + + // get/extract + exempt_ptr xp; + + for ( auto const& i : arrKeys ) { + value_type const& val = arrVals.at( i.nKey ); + + { + rcu_lock l; + map_pair * p = m.get( i.nKey ); + ASSERT_FALSE( p == nullptr ); + EXPECT_EQ( p->first.nKey, i.nKey ); + + p = m.get( i ); + ASSERT_FALSE( p == nullptr ); + EXPECT_EQ( p->first.nKey, i.nKey ); + + p = m.get( val.strVal ); + ASSERT_FALSE( p == nullptr ); + EXPECT_EQ( p->first.nKey, i.nKey ); + } + + switch ( i.nKey % 3 ) { + case 0: + xp = m.extract( i.nKey ); + break; + case 1: + xp = m.extract( i ); + break; + case 2: + xp = m.extract( val.strVal ); + break; + } + ASSERT_FALSE( !xp ); + ASSERT_EQ( xp->first.nKey, i.nKey ); + + { + rcu_lock l; + + map_pair * p = m.get( i.nKey ); + EXPECT_TRUE( p == nullptr ); + p = m.get( i ); + EXPECT_TRUE( p == nullptr ); + } + } + ASSERT_TRUE( m.empty() ); + ASSERT_CONTAINER_SIZE( m, 0 ); + } + + void SetUp() + { + RCU::Construct(); + cds::threading::Manager::attachThread(); + } + + void TearDown() + { + cds::threading::Manager::detachThread(); + RCU::Destruct(); + } + }; + + TYPED_TEST_CASE_P( FeldmanHashMap ); + + TYPED_TEST_P( FeldmanHashMap, defaulted ) + { + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + + typedef cc::FeldmanHashMap< rcu_type, key_type, value_type > map_type; + + map_type m; + this->test( m ); + } + + TYPED_TEST_P( FeldmanHashMap, compare ) + { + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + + typedef cc::FeldmanHashMap< rcu_type, key_type, value_type, + typename cc::feldman_hashmap::make_traits< + cds::opt::compare< typename TestFixture::cmp > + >::type + > map_type; + + map_type m( 4, 5 ); + this->test( m ); + } + + TYPED_TEST_P( FeldmanHashMap, less ) + { + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + + typedef cc::FeldmanHashMap< rcu_type, key_type, value_type, + typename cc::feldman_hashmap::make_traits< + cds::opt::less< typename TestFixture::less > + >::type + > map_type; + + map_type m( 3, 2 ); + this->test( m ); + } + + TYPED_TEST_P( FeldmanHashMap, cmpmix ) + { + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + + typedef cc::FeldmanHashMap< rcu_type, key_type, value_type, + typename cc::feldman_hashmap::make_traits< + cds::opt::less< typename TestFixture::less > + , cds::opt::compare< typename TestFixture::cmp > + >::type + > map_type; + + map_type m( 4, 4 ); + this->test( m ); + } + + TYPED_TEST_P( FeldmanHashMap, backoff ) + { + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + + struct map_traits: public cc::feldman_hashmap::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::atomicity::item_counter item_counter; + typedef cds::backoff::yield back_off; + }; + typedef cc::FeldmanHashMap< rcu_type, key_type, value_type, map_traits > map_type; + + map_type m( 8, 2 ); + this->test( m ); + } + + TYPED_TEST_P( FeldmanHashMap, stat ) + { + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + + struct map_traits: public cc::feldman_hashmap::traits + { + typedef cds::backoff::yield back_off; + typedef cc::feldman_hashmap::stat<> stat; + }; + typedef cc::FeldmanHashMap< rcu_type, key_type, value_type, map_traits > map_type; + + map_type m( 1, 1 ); + this->test( m ); + } + + // 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( FeldmanHashMap, + defaulted, compare, less, cmpmix, backoff, stat + ); +} // namespace + +#endif // #ifndef CDSUNIT_MAP_TEST_FELDMAN_HASHMAP_RCU_H -- 2.34.1