From 7b0f5e673d74d470aca76788c40c919ad2acbf94 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 29 Aug 2015 16:35:02 +0300 Subject: [PATCH] Refactored MapDelOdd MT-test --- cds/container/michael_map_nogc.h | 2 +- projects/Win/vc12/unit-map-delodd.vcxproj | 3 - projects/source.unit.map.mk | 1 - tests/unit/map2/CMakeLists.txt | 1 - tests/unit/map2/map_delodd.h | 87 +------------------ .../map2/map_delodd_multilevel_hashmap.cpp | 12 --- tests/unit/map2/map_type_michael.h | 2 - tests/unit/map2/map_type_multilevel_hashmap.h | 4 +- 8 files changed, 6 insertions(+), 106 deletions(-) delete mode 100644 tests/unit/map2/map_delodd_multilevel_hashmap.cpp diff --git a/cds/container/michael_map_nogc.h b/cds/container/michael_map_nogc.h index 7ed7747c..737578ca 100644 --- a/cds/container/michael_map_nogc.h +++ b/cds/container/michael_map_nogc.h @@ -435,7 +435,7 @@ namespace cds { namespace container { and returns an iterator pointed to item found and \ref end() otherwise */ template - iterator find( K const& key ) + iterator contains( K const& key ) { bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.contains( key ); diff --git a/projects/Win/vc12/unit-map-delodd.vcxproj b/projects/Win/vc12/unit-map-delodd.vcxproj index 61c48744..8fd3aa35 100644 --- a/projects/Win/vc12/unit-map-delodd.vcxproj +++ b/projects/Win/vc12/unit-map-delodd.vcxproj @@ -56,9 +56,6 @@ false - - true - true diff --git a/projects/source.unit.map.mk b/projects/source.unit.map.mk index 98b927fb..abbe9446 100644 --- a/projects/source.unit.map.mk +++ b/projects/source.unit.map.mk @@ -90,7 +90,6 @@ CDSUNIT_MAP_SOURCES := \ tests/unit/map2/map_delodd_michael.cpp \ tests/unit/map2/map_delodd_bronsonavltree.cpp \ tests/unit/map2/map_delodd_ellentree.cpp \ - tests/unit/map2/map_delodd_multilevel_hashmap.cpp \ tests/unit/map2/map_delodd_split.cpp \ tests/unit/map2/map_delodd_skip.cpp \ tests/unit/map2/map_delodd_cuckoo.cpp \ diff --git a/tests/unit/map2/CMakeLists.txt b/tests/unit/map2/CMakeLists.txt index 96887a5d..9cd5700c 100644 --- a/tests/unit/map2/CMakeLists.txt +++ b/tests/unit/map2/CMakeLists.txt @@ -91,7 +91,6 @@ set(CDSUNIT_MAP_SOURCES map_delodd_michael.cpp map_delodd_bronsonavltree.cpp map_delodd_ellentree.cpp - map_delodd_multilevel_hashmap.cpp map_delodd_split.cpp map_delodd_skip.cpp map_delodd_cuckoo.cpp diff --git a/tests/unit/map2/map_delodd.h b/tests/unit/map2/map_delodd.h index 836c10c7..e30824fd 100644 --- a/tests/unit/map2/map_delodd.h +++ b/tests/unit/map2/map_delodd.h @@ -6,12 +6,6 @@ namespace map2 { -//# define TEST_MAP(IMPL, C, X) void C::X() { test::X >(); } -//# define TEST_MAP_DEFAULT_CONSTRUCTIBLE(IMPL, C, X) void C::X() { test_default_constructible::X >(); } -//# define TEST_MAP_EXTRACT(IMPL, C, X) void C::X() { test_extract::X >(); } -//# define TEST_MAP_NOLF(IMPL, C, X) void C::X() { test_nolf::X >(); } -//# define TEST_MAP_NOLF_EXTRACT(IMPL, C, X) void C::X() { test_nolf_extract::X >(); } - # define TEST_CASE(TAG, X) void X(); namespace { @@ -654,68 +648,6 @@ namespace map2 { additional_cleanup( testMap ); } - //template - //void test() - //{ - // CPPUNIT_MSG( "Insert thread count=" << c_nInsThreadCount - // << " delete thread count=" << c_nDelThreadCount - // << " set size=" << c_nMapSize - // ); - - // for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) { - // CPPUNIT_MSG( "Load factor=" << nLoadFactor ); - // do_test( nLoadFactor ); - // if ( c_bPrintGCState ) - // print_gc_state(); - // } - //} - - //template - //void test_extract() - //{ - // CPPUNIT_MSG( "Thread count: insert=" << c_nInsThreadCount - // << ", delete=" << c_nDelThreadCount - // << ", extract=" << c_nExtractThreadCount - // << "; set size=" << c_nMapSize - // ); - - // for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) { - // CPPUNIT_MSG( "Load factor=" << nLoadFactor ); - // do_test_extract( nLoadFactor ); - // if ( c_bPrintGCState ) - // print_gc_state(); - // } - //} - - //template - //void test_nolf() - //{ - // CPPUNIT_MSG( "Insert thread count=" << c_nInsThreadCount - // << " delete thread count=" << c_nDelThreadCount - // << " set size=" << c_nMapSize - // ); - - // Map s; - // do_test_with( s ); - // if ( c_bPrintGCState ) - // print_gc_state(); - //} - - //template - //void test_nolf_extract() - //{ - // CPPUNIT_MSG( "Thread count: insert=" << c_nInsThreadCount - // << ", delete=" << c_nDelThreadCount - // << ", extract=" << c_nExtractThreadCount - // << "; set size=" << c_nMapSize - // ); - - // Map s; - // do_test_extract_with( s ); - // if ( c_bPrintGCState ) - // print_gc_state(); - //} - template void run_test() { @@ -756,26 +688,15 @@ namespace map2 { void setUpParams( const CppUnitMini::TestCfg& cfg ); - //void run_MichaelMap(const char *in_name, bool invert = false); - //void run_SplitList(const char *in_name, bool invert = false); - ////void run_StripedMap(const char *in_name, bool invert = false); - ////void run_RefinableMap(const char *in_name, bool invert = false); - //void run_CuckooMap(const char *in_name, bool invert = false); - //void run_SkipListMap(const char *in_name, bool invert = false); - //void run_EllenBinTreeMap(const char *in_name, bool invert = false); - //void run_BronsonAVLTreeMap(const char *in_name, bool invert = false); - //void run_MultiLevelHashMap(const char *in_name, bool invert = false); - ////void run_StdMap(const char *in_name, bool invert = false); - - //virtual void myRun(const char *in_name, bool invert = false); - # include "map2/map_defs.h" CDSUNIT_DECLARE_MichaelMap - CDSUNIT_DECLARE_MultiLevelHashMap + + // This test is not suitable for MultiLevelHashMap + //CDSUNIT_DECLARE_MultiLevelHashMap CPPUNIT_TEST_SUITE(Map_DelOdd) CDSUNIT_TEST_MichaelMap - //CDSUNIT_TEST_MultiLevelHashMap + //CDSUNIT_TEST_MultiLevelHashMap // the test is not suitable CPPUNIT_TEST_SUITE_END(); //CDSUNIT_DECLARE_MichaelMap diff --git a/tests/unit/map2/map_delodd_multilevel_hashmap.cpp b/tests/unit/map2/map_delodd_multilevel_hashmap.cpp deleted file mode 100644 index 8cdf9795..00000000 --- a/tests/unit/map2/map_delodd_multilevel_hashmap.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//$$CDS-header$$ - -#include "map2/map_delodd.h" -#include "map2/map_type_multilevel_hashmap.h" - -#undef TEST_CASE -#define TEST_CASE(TAG, X) void Map_DelOdd::X() { run_test::X>(); } -#include "map2/map_defs.h" - -namespace map2 { - CDSUNIT_DECLARE_MultiLevelHashMap -} // namespace map2 diff --git a/tests/unit/map2/map_type_michael.h b/tests/unit/map2/map_type_michael.h index 095c5b73..76d8fcda 100644 --- a/tests/unit/map2/map_type_michael.h +++ b/tests/unit/map2/map_type_michael.h @@ -25,8 +25,6 @@ namespace map2 { // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = true; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true; - static CDS_CONSTEXPR bool const c_erase_with_supported = true; - static CDS_CONSTEXPR bool const c_extract_with_supported = true; }; struct tag_MichaelHashMap; diff --git a/tests/unit/map2/map_type_multilevel_hashmap.h b/tests/unit/map2/map_type_multilevel_hashmap.h index 0e0b10fc..2c25a8e9 100644 --- a/tests/unit/map2/map_type_multilevel_hashmap.h +++ b/tests/unit/map2/map_type_multilevel_hashmap.h @@ -25,14 +25,12 @@ namespace map2 { // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = true; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; - static CDS_CONSTEXPR bool const c_erase_with_supported = false; - static CDS_CONSTEXPR bool const c_extract_with_supported = false; }; struct tag_MultiLevelHashMap; template - struct map_type< map2::tag_MultiLevelHashMap, Key, Value >: public map_type_base< Key, Value > + struct map_type< tag_MultiLevelHashMap, Key, Value >: public map_type_base< Key, Value > { typedef map_type_base< Key, Value > base_class; typedef typename base_class::compare compare; -- 2.34.1