From af52bfcc69828d943832fd360ead519640188e51 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sat, 12 Sep 2015 19:09:09 +0300 Subject: [PATCH] Refactored Set_InsDel_string MT-test --- projects/Win/vc12/unit-set-insdel.vcxproj | 1 - .../Win/vc12/unit-set-insdel.vcxproj.filters | 3 - projects/source.unit.set.mk | 3 +- tests/unit/set2/CMakeLists.txt | 3 +- tests/unit/set2/set_defs.h | 25 ++- tests/unit/set2/set_insdel_func.h | 1 + tests/unit/set2/set_insdel_string.cpp | 32 +--- tests/unit/set2/set_insdel_string.h | 180 ++++++++---------- tests/unit/set2/set_insdel_string_cuckoo.cpp | 10 +- .../unit/set2/set_insdel_string_ellentree.cpp | 10 +- tests/unit/set2/set_insdel_string_michael.cpp | 10 +- .../unit/set2/set_insdel_string_refinable.cpp | 12 -- tests/unit/set2/set_insdel_string_skip.cpp | 10 +- tests/unit/set2/set_insdel_string_split.cpp | 10 +- tests/unit/set2/set_insdel_string_std.cpp | 10 +- tests/unit/set2/set_insdel_string_striped.cpp | 11 +- tests/unit/set2/set_type_std.h | 22 ++- 17 files changed, 165 insertions(+), 188 deletions(-) delete mode 100644 tests/unit/set2/set_insdel_string_refinable.cpp diff --git a/projects/Win/vc12/unit-set-insdel.vcxproj b/projects/Win/vc12/unit-set-insdel.vcxproj index 3b1a8172..b4bd97fe 100644 --- a/projects/Win/vc12/unit-set-insdel.vcxproj +++ b/projects/Win/vc12/unit-set-insdel.vcxproj @@ -54,7 +54,6 @@ - diff --git a/projects/Win/vc12/unit-set-insdel.vcxproj.filters b/projects/Win/vc12/unit-set-insdel.vcxproj.filters index 1e4acd14..9dd1ddb5 100644 --- a/projects/Win/vc12/unit-set-insdel.vcxproj.filters +++ b/projects/Win/vc12/unit-set-insdel.vcxproj.filters @@ -31,9 +31,6 @@ set_insdel_string - - set_insdel_string - set_insdel_string diff --git a/projects/source.unit.set.mk b/projects/source.unit.set.mk index e0980921..bcd4f3ff 100644 --- a/projects/source.unit.set.mk +++ b/projects/source.unit.set.mk @@ -8,10 +8,9 @@ CDSUNIT_SET_SOURCES := \ tests/unit/set2/set_insdel_func_split.cpp \ tests/unit/set2/set_insdel_func_striped.cpp \ tests/unit/set2/set_insdel_string.cpp \ - tests/unit/set2/set_insdel_string_michael.cpp \ tests/unit/set2/set_insdel_string_cuckoo.cpp \ tests/unit/set2/set_insdel_string_ellentree.cpp \ - tests/unit/set2/set_insdel_string_refinable.cpp \ + tests/unit/set2/set_insdel_string_michael.cpp \ tests/unit/set2/set_insdel_string_skip.cpp \ tests/unit/set2/set_insdel_string_split.cpp \ tests/unit/set2/set_insdel_string_striped.cpp \ diff --git a/tests/unit/set2/CMakeLists.txt b/tests/unit/set2/CMakeLists.txt index a72e69f7..c375a3fd 100644 --- a/tests/unit/set2/CMakeLists.txt +++ b/tests/unit/set2/CMakeLists.txt @@ -9,10 +9,9 @@ set(CDSUNIT_SET_SOURCES set_insdel_func_split.cpp set_insdel_func_striped.cpp set_insdel_string.cpp - set_insdel_string_michael.cpp set_insdel_string_cuckoo.cpp set_insdel_string_ellentree.cpp - set_insdel_string_refinable.cpp + set_insdel_string_michael.cpp set_insdel_string_skip.cpp set_insdel_string_split.cpp set_insdel_string_striped.cpp diff --git a/tests/unit/set2/set_defs.h b/tests/unit/set2/set_defs.h index 9df4c917..5412a968 100644 --- a/tests/unit/set2/set_defs.h +++ b/tests/unit/set2/set_defs.h @@ -4,13 +4,18 @@ #define CDSUNIT_SET_DEFS_H #define CDSUNIT_DECLARE_StdSet \ - TEST_CASE(StdSet_Spin) \ - TEST_CASE(StdHashSet_Spin) + TEST_CASE( tag_StdSet, StdSet_Spin) \ + TEST_CASE( tag_StdSet, StdSet_Mutex) \ + TEST_CASE( tag_StdSet, StdHashSet_Spin) #define CDSUNIT_TEST_StdSet \ CPPUNIT_TEST(StdSet_Spin) \ + CPPUNIT_TEST(StdSet_Mutex) \ CPPUNIT_TEST(StdHashSet_Spin) +//******************************************************************** +// MichaelHashSet + #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED # define CDSUNIT_DECLARE_MichaelSet_RCU_signal \ TEST_CASE(tag_MichaelHashSet, MichaelSet_RCU_SHB_cmp_stdAlloc) \ @@ -83,6 +88,8 @@ CPPUNIT_TEST(MichaelSet_Lazy_RCU_GPT_less_michaelAlloc) \ CDSUNIT_TEST_MichaelSet_RCU_signal +//******************************************************************** +// SplitListSet #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED # define CDSUNIT_DECLARE_SplitList_RCU_signal \ @@ -268,6 +275,8 @@ CPPUNIT_TEST(SplitList_Lazy_RCU_GPT_st_less_stat)\ CDSUNIT_TEST_SplitList_RCU_signal +//******************************************************************** +// CuckooSet #define CDSUNIT_DECLARE_CuckooSet \ TEST_CASE(tag_CuckooSet, CuckooStripedSet_list_unord)\ @@ -321,7 +330,8 @@ CPPUNIT_TEST(CuckooRefinableSet_vector_ord_stat) \ CPPUNIT_TEST(CuckooRefinableSet_vector_ord_storehash) - +//******************************************************************** +// SkipListSet #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED # define CDSUNIT_DECLARE_SkipListSet_RCU_signal \ @@ -395,6 +405,8 @@ CPPUNIT_TEST(SkipListSet_rcu_gpt_cmp_xorshift_stat)\ CDSUNIT_TEST_SkipListSet_RCU_signal +//******************************************************************** +// EllenBinTreeSet #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED # define CDSUNIT_DECLARE_EllenBinTreeSet_RCU_signal \ @@ -445,7 +457,8 @@ CPPUNIT_TEST(EllenBinTreeSet_rcu_gpt_stat)\ CDSUNIT_TEST_EllenBinTreeSet_RCU_signal - +//******************************************************************** +// StripedSet #define CDSUNIT_DECLARE_StripedSet_common \ TEST_CASE( tag_StripedSet, StripedSet_list) \ @@ -536,6 +549,10 @@ TEST_CASE( tag_StripedSet, RefinableSet_rational_hashset) \ TEST_CASE( tag_StripedSet, RefinableSet_rational_boost_unordered_set) + +//******************************************************************** +// RefinableSet + #define CDSUNIT_TEST_RefinableSet_common \ CPPUNIT_TEST(RefinableSet_list) \ CPPUNIT_TEST(RefinableSet_vector) \ diff --git a/tests/unit/set2/set_insdel_func.h b/tests/unit/set2/set_insdel_func.h index f20cbe77..ad8e0a74 100644 --- a/tests/unit/set2/set_insdel_func.h +++ b/tests/unit/set2/set_insdel_func.h @@ -515,6 +515,7 @@ namespace set2 { if ( Set::c_bLoadFactorDepended ) { for ( c_nLoadFactor = 1; c_nLoadFactor <= c_nMaxLoadFactor; c_nLoadFactor *= 2 ) { + CPPUNIT_MSG(" LoadFactor = " << c_nLoadFactor ); Set s( *this ); do_test( s ); if ( c_bPrintGCState ) diff --git a/tests/unit/set2/set_insdel_string.cpp b/tests/unit/set2/set_insdel_string.cpp index a0a2a669..f84adffb 100644 --- a/tests/unit/set2/set_insdel_string.cpp +++ b/tests/unit/set2/set_insdel_string.cpp @@ -5,36 +5,22 @@ namespace set2 { CPPUNIT_TEST_SUITE_REGISTRATION( Set_InsDel_string ); - size_t Set_InsDel_string::c_nMapSize = 1000000; - size_t Set_InsDel_string::c_nInsertThreadCount = 4; - size_t Set_InsDel_string::c_nDeleteThreadCount = 4; - size_t Set_InsDel_string::c_nThreadPassCount = 4; - size_t Set_InsDel_string::c_nMaxLoadFactor = 8; - bool Set_InsDel_string::c_bPrintGCState = true; - void Set_InsDel_string::setUpParams( const CppUnitMini::TestCfg& cfg ) { + c_nSetSize = cfg.getSizeT("MapSize", c_nSetSize ); c_nInsertThreadCount = cfg.getSizeT("InsertThreadCount", c_nInsertThreadCount ); c_nDeleteThreadCount = cfg.getSizeT("DeleteThreadCount", c_nDeleteThreadCount ); c_nThreadPassCount = cfg.getSizeT("ThreadPassCount", c_nThreadPassCount ); - c_nMapSize = cfg.getSizeT("MapSize", c_nMapSize ); c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor ); - c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true ); - } - - void Set_InsDel_string::myRun(const char *in_name, bool invert /*= false*/) - { - setUpParams( m_Cfg.get( "Map_InsDel_string" )); + c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState ); - run_MichaelSet(in_name, invert); - run_SplitList(in_name, invert); - run_SkipListSet(in_name, invert); - run_EllenBinTreeSet(in_name, invert); - run_StripedSet(in_name, invert); - run_RefinableSet(in_name, invert); - run_CuckooSet(in_name, invert); - run_StdSet(in_name, invert); + c_nCuckooInitialSize = cfg.getSizeT("CuckooInitialSize", c_nCuckooInitialSize ); + c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize ); + c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold ); - endTestCase(); + if ( c_nInsertThreadCount == 0 ) + c_nInsertThreadCount = std::thread::hardware_concurrency(); + if ( c_nDeleteThreadCount == 0 ) + c_nDeleteThreadCount = std::thread::hardware_concurrency(); } } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string.h b/tests/unit/set2/set_insdel_string.h index fb3a01a0..6e818f80 100644 --- a/tests/unit/set2/set_insdel_string.h +++ b/tests/unit/set2/set_insdel_string.h @@ -7,20 +7,25 @@ namespace set2 { -# define TEST_SET(IMPL, C, X) void C::X() { test::X >(); } -# define TEST_SET_EXTRACT(IMPL, C, X) void C::X() { test_extract::X >(); } -# define TEST_SET_NOLF(IMPL, C, X) void C::X() { test_nolf::X >(); } -# define TEST_SET_NOLF_EXTRACT(IMPL, C, X) void C::X() { test_nolf_extract::X >(); } +#define TEST_CASE(TAG, X) void X(); class Set_InsDel_string: public CppUnitMini::TestCase { - static size_t c_nMapSize; // set size - static size_t c_nInsertThreadCount; // count of insertion thread - static size_t c_nDeleteThreadCount; // count of deletion thread - static size_t c_nThreadPassCount; // pass count for each thread - static size_t c_nMaxLoadFactor; // maximum load factor - static bool c_bPrintGCState; + public: + size_t c_nSetSize = 1000000; // set size + size_t c_nInsertThreadCount = 4; // count of insertion thread + size_t c_nDeleteThreadCount = 4; // count of deletion thread + size_t c_nThreadPassCount = 4; // pass count for each thread + size_t c_nMaxLoadFactor = 8; // maximum load factor + bool c_bPrintGCState = true; + size_t c_nCuckooInitialSize = 1024;// initial size for CuckooSet + size_t c_nCuckooProbesetSize = 16; // CuckooSet probeset size (only for list-based probeset) + size_t c_nCuckooProbesetThreshold = 0; // CUckooSet probeset threshold (0 - use default) + + size_t c_nLoadFactor = 2; + + private: typedef CppUnitMini::TestCase Base; typedef std::string key_type; typedef size_t value_type; @@ -68,10 +73,12 @@ namespace set2 { const std::vector& arrString = *getTest().m_parrString; size_t nArrSize = arrString.size(); + size_t const nSetSize = getTest().c_nSetSize; + size_t const nPassCount = getTest().c_nThreadPassCount; if ( m_nThreadNo & 1 ) { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = 0; nItem < nSetSize; ++nItem ) { if ( rSet.insert( keyval_type(arrString[nItem % nArrSize], nItem * 8) ) ) ++m_nInsertSuccess; else @@ -80,8 +87,8 @@ namespace set2 { } } else { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = nSetSize; nItem > 0; --nItem ) { if ( rSet.insert( keyval_type( arrString[nItem % nArrSize], nItem * 8) ) ) ++m_nInsertSuccess; else @@ -132,10 +139,12 @@ namespace set2 { const std::vector& arrString = *getTest().m_parrString; size_t nArrSize = arrString.size(); + size_t const nSetSize = getTest().c_nSetSize; + size_t const nPassCount = getTest().c_nThreadPassCount; if ( m_nThreadNo & 1 ) { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = 0; nItem < nSetSize; ++nItem ) { if ( rSet.erase( arrString[nItem % nArrSize] ) ) ++m_nDeleteSuccess; else @@ -144,8 +153,8 @@ namespace set2 { } } else { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = nSetSize; nItem > 0; --nItem ) { if ( rSet.erase( arrString[nItem % nArrSize] ) ) ++m_nDeleteSuccess; else @@ -198,10 +207,12 @@ namespace set2 { const std::vector& arrString = *getTest().m_parrString; size_t nArrSize = arrString.size(); + size_t const nSetSize = getTest().c_nSetSize; + size_t const nPassCount = getTest().c_nThreadPassCount; if ( m_nThreadNo & 1 ) { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = 0; nItem < nSetSize; ++nItem ) { gp = rSet.extract( arrString[nItem % nArrSize]); if ( gp ) ++m_nDeleteSuccess; @@ -212,8 +223,8 @@ namespace set2 { } } else { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = nSetSize; nItem > 0; --nItem ) { gp = rSet.extract( arrString[nItem % nArrSize]); if ( gp ) ++m_nDeleteSuccess; @@ -268,10 +279,12 @@ namespace set2 { const std::vector& arrString = *getTest().m_parrString; size_t nArrSize = arrString.size(); + size_t const nSetSize = getTest().c_nSetSize; + size_t const nPassCount = getTest().c_nThreadPassCount; if ( m_nThreadNo & 1 ) { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = 0; nItem < nSetSize; ++nItem ) { if ( Set::c_bExtractLockExternal ) { { typename Set::rcu_lock l; @@ -294,8 +307,8 @@ namespace set2 { } } else { - for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { - for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) { + for ( size_t nPass = 0; nPass < nPassCount; ++nPass ) { + for ( size_t nItem = nSetSize; nItem > 0; --nItem ) { if ( Set::c_bExtractLockExternal ) { { typename Set::rcu_lock l; @@ -321,27 +334,8 @@ namespace set2 { }; protected: - template - void do_test( size_t nLoadFactor ) - { - CPPUNIT_MSG( "Load factor=" << nLoadFactor ); - - Set testSet( c_nMapSize, nLoadFactor ); - do_test_with( testSet ); - } - - template - void do_test_extract( size_t nLoadFactor ) - { - CPPUNIT_MSG( "Load factor=" << nLoadFactor ); - - Set testSet( c_nMapSize, nLoadFactor ); - do_test_extract_with( testSet ); - } - - template - void do_test_with( Set& testSet ) + void do_test( Set& testSet ) { typedef Inserter InserterThread; typedef Deleter DeleterThread; @@ -391,7 +385,7 @@ namespace set2 { } template - void do_test_extract_with( Set& testSet ) + void do_test_extract( Set& testSet ) { typedef Inserter InserterThread; typedef Deleter DeleterThread; @@ -456,88 +450,63 @@ namespace set2 { } template - void test() + void run_test() { m_parrString = &CppUnitMini::TestCase::getTestStrings(); CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount << " delete=" << c_nDeleteThreadCount << " pass count=" << c_nThreadPassCount - << " set size=" << c_nMapSize + << " set size=" << c_nSetSize ); - for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) { - do_test( nLoadFactor ); + if ( Set::c_bLoadFactorDepended ) { + for ( c_nLoadFactor = 1; c_nLoadFactor <= c_nMaxLoadFactor; c_nLoadFactor *= 2 ) { + CPPUNIT_MSG(" LoadFactor = " << c_nLoadFactor ); + Set s( *this ); + do_test( s ); + if ( c_bPrintGCState ) + print_gc_state(); + } + } + else { + Set s( *this ); + do_test( s ); if ( c_bPrintGCState ) print_gc_state(); } } template - void test_extract() + void run_test_extract() { m_parrString = &CppUnitMini::TestCase::getTestStrings(); CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount << " delete=" << c_nDeleteThreadCount << " pass count=" << c_nThreadPassCount - << " set size=" << c_nMapSize + << " set size=" << c_nSetSize ); - for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) { - do_test_extract( nLoadFactor ); + if ( Set::c_bLoadFactorDepended ) { + for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) { + CPPUNIT_MSG(" LoadFactor = " << c_nLoadFactor ); + Set s( *this ); + do_test_extract( s ); + if ( c_bPrintGCState ) + print_gc_state(); + } + } + else { + Set s( *this ); + do_test_extract( s ); if ( c_bPrintGCState ) print_gc_state(); } } - template - void test_nolf() - { - m_parrString = &CppUnitMini::TestCase::getTestStrings(); - - CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount - << " delete=" << c_nDeleteThreadCount - << " pass count=" << c_nThreadPassCount - << " set size=" << c_nMapSize - ); - - Set s; - do_test_with( s ); - if ( c_bPrintGCState ) - print_gc_state(); - } - - template - void test_nolf_extract() - { - m_parrString = &CppUnitMini::TestCase::getTestStrings(); - - CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount - << " delete=" << c_nDeleteThreadCount - << " pass count=" << c_nThreadPassCount - << " set size=" << c_nMapSize - ); - - Set s; - do_test_extract_with( s ); - if ( c_bPrintGCState ) - print_gc_state(); - } - void setUpParams( const CppUnitMini::TestCfg& cfg ); - void run_MichaelSet(const char *in_name, bool invert = false); - void run_SplitList(const char *in_name, bool invert = false); - void run_SkipListSet(const char *in_name, bool invert = false); - void run_CuckooSet(const char *in_name, bool invert = false); - void run_StripedSet(const char *in_name, bool invert = false); - void run_RefinableSet(const char *in_name, bool invert = false); - void run_EllenBinTreeSet(const char *in_name, bool invert = false); - void run_StdSet(const char *in_name, bool invert = false); - - virtual void myRun(const char *in_name, bool invert = false); - # include "set2/set_defs.h" CDSUNIT_DECLARE_MichaelSet CDSUNIT_DECLARE_SplitList @@ -547,5 +516,16 @@ namespace set2 { CDSUNIT_DECLARE_SkipListSet CDSUNIT_DECLARE_EllenBinTreeSet CDSUNIT_DECLARE_StdSet + + CPPUNIT_TEST_SUITE_(Set_InsDel_func, "Map_InsDel_func") + CDSUNIT_TEST_MichaelSet + CDSUNIT_TEST_SplitList + CDSUNIT_TEST_SkipListSet + CDSUNIT_TEST_EllenBinTreeSet + CDSUNIT_TEST_StripedSet + CDSUNIT_TEST_RefinableSet + CDSUNIT_TEST_CuckooSet + CDSUNIT_TEST_StdSet + CPPUNIT_TEST_SUITE_END(); }; } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_cuckoo.cpp b/tests/unit/set2/set_insdel_string_cuckoo.cpp index ee7219c2..190fdb03 100644 --- a/tests/unit/set2/set_insdel_string_cuckoo.cpp +++ b/tests/unit/set2/set_insdel_string_cuckoo.cpp @@ -3,10 +3,10 @@ #include "set2/set_insdel_string.h" #include "set2/set_type_cuckoo.h" -namespace set2 { - CDSUNIT_DEFINE_CuckooSet( cc::cuckoo::implementation_tag, Set_InsDel_string ) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Set_InsDel_string::X() { run_test::X>(); } +#include "set2/set_defs.h" - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_CuckooSet ) - CDSUNIT_TEST_CuckooSet - CPPUNIT_TEST_SUITE_END_PART() +namespace set2 { + CDSUNIT_DECLARE_CuckooSet } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_ellentree.cpp b/tests/unit/set2/set_insdel_string_ellentree.cpp index e05d42b2..c7bed149 100644 --- a/tests/unit/set2/set_insdel_string_ellentree.cpp +++ b/tests/unit/set2/set_insdel_string_ellentree.cpp @@ -3,10 +3,10 @@ #include "set2/set_insdel_string.h" #include "set2/set_type_ellen_bintree.h" -namespace set2 { - CDSUNIT_DEFINE_EllenBinTreeSet( cc::ellen_bintree::implementation_tag, Set_InsDel_string ) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Set_InsDel_string::X() { run_test_extract::X>(); } +#include "set2/set_defs.h" - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_EllenBinTreeSet ) - CDSUNIT_TEST_EllenBinTreeSet - CPPUNIT_TEST_SUITE_END_PART() +namespace set2 { + CDSUNIT_DECLARE_EllenBinTreeSet } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_michael.cpp b/tests/unit/set2/set_insdel_string_michael.cpp index 7c45b807..b533b6ee 100644 --- a/tests/unit/set2/set_insdel_string_michael.cpp +++ b/tests/unit/set2/set_insdel_string_michael.cpp @@ -3,10 +3,10 @@ #include "set2/set_insdel_string.h" #include "set2/set_type_michael.h" -namespace set2 { - CDSUNIT_DEFINE_MichaelSet( cc::michael_set::implementation_tag, Set_InsDel_string ) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Set_InsDel_string::X() { run_test_extract::X>(); } +#include "set2/set_defs.h" - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_MichaelSet ) - CDSUNIT_TEST_MichaelSet - CPPUNIT_TEST_SUITE_END_PART() +namespace set2 { + CDSUNIT_DECLARE_MichaelSet } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_refinable.cpp b/tests/unit/set2/set_insdel_string_refinable.cpp deleted file mode 100644 index 33c2a0d0..00000000 --- a/tests/unit/set2/set_insdel_string_refinable.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//$$CDS-header$$ - -#include "set2/set_insdel_string.h" -#include "set2/set_type_striped.h" - -namespace set2 { - CDSUNIT_DEFINE_RefinableSet( cc::striped_set::implementation_tag, Set_InsDel_string ) - - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_RefinableSet ) - CDSUNIT_TEST_RefinableSet - CPPUNIT_TEST_SUITE_END_PART() -} // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_skip.cpp b/tests/unit/set2/set_insdel_string_skip.cpp index 562cba26..48afc860 100644 --- a/tests/unit/set2/set_insdel_string_skip.cpp +++ b/tests/unit/set2/set_insdel_string_skip.cpp @@ -3,10 +3,10 @@ #include "set2/set_insdel_string.h" #include "set2/set_type_skip_list.h" -namespace set2 { - CDSUNIT_DEFINE_SkipListSet(cc::skip_list::implementation_tag, Set_InsDel_string) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Set_InsDel_string::X() { run_test_extract::X>(); } +#include "set2/set_defs.h" - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_SkipListSet ) - CDSUNIT_TEST_SkipListSet - CPPUNIT_TEST_SUITE_END_PART() +namespace set2 { + CDSUNIT_DECLARE_SkipListSet } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_split.cpp b/tests/unit/set2/set_insdel_string_split.cpp index d851e9b2..78a3ae03 100644 --- a/tests/unit/set2/set_insdel_string_split.cpp +++ b/tests/unit/set2/set_insdel_string_split.cpp @@ -3,10 +3,10 @@ #include "set2/set_insdel_string.h" #include "set2/set_type_split_list.h" -namespace set2 { - CDSUNIT_DEFINE_SplitList(cc::split_list::implementation_tag, Set_InsDel_string) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Set_InsDel_string::X() { run_test_extract::X>(); } +#include "set2/set_defs.h" - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_SplitList ) - CDSUNIT_TEST_SplitList - CPPUNIT_TEST_SUITE_END_PART() +namespace set2 { + CDSUNIT_DECLARE_SplitList } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_std.cpp b/tests/unit/set2/set_insdel_string_std.cpp index b383122c..286fa632 100644 --- a/tests/unit/set2/set_insdel_string_std.cpp +++ b/tests/unit/set2/set_insdel_string_std.cpp @@ -3,10 +3,10 @@ #include "set2/set_insdel_string.h" #include "set2/set_type_std.h" -namespace set2 { - CDSUNIT_DEFINE_StdSet(std_implementation_tag, Set_InsDel_string) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Set_InsDel_string::X() { run_test::X>(); } +#include "set2/set_defs.h" - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_StdSet ) - CDSUNIT_TEST_StdSet - CPPUNIT_TEST_SUITE_END_PART() +namespace set2 { + CDSUNIT_DECLARE_StdSet } // namespace set2 diff --git a/tests/unit/set2/set_insdel_string_striped.cpp b/tests/unit/set2/set_insdel_string_striped.cpp index e478bdf3..47a5d6b7 100644 --- a/tests/unit/set2/set_insdel_string_striped.cpp +++ b/tests/unit/set2/set_insdel_string_striped.cpp @@ -3,10 +3,11 @@ #include "set2/set_insdel_string.h" #include "set2/set_type_striped.h" -namespace set2 { - CDSUNIT_DEFINE_StripedSet( cc::striped_set::implementation_tag, Set_InsDel_string ) +#undef TEST_CASE +#define TEST_CASE(TAG, X) void Set_InsDel_string::X() { run_test::X>(); } +#include "set2/set_defs.h" - CPPUNIT_TEST_SUITE_PART( Set_InsDel_string, run_StripedSet ) - CDSUNIT_TEST_StripedSet - CPPUNIT_TEST_SUITE_END_PART() +namespace set2 { + CDSUNIT_DECLARE_StripedSet + CDSUNIT_DECLARE_RefinableSet } // namespace set2 diff --git a/tests/unit/set2/set_type_std.h b/tests/unit/set2/set_type_std.h index 04738181..d359537b 100644 --- a/tests/unit/set2/set_type_std.h +++ b/tests/unit/set2/set_type_std.h @@ -11,7 +11,7 @@ namespace set2 { - struct std_implementation_tag; + struct tag_StdSet; template ::other @@ -36,9 +36,9 @@ namespace set2 { public: typedef typename base_class::value_type value_type; - typedef std_implementation_tag implementation_tag; - StdHashSet( size_t /*nSetSize*/, size_t /*nLoadFactor*/ ) + template + StdHashSet( Config const& ) {} template @@ -103,6 +103,10 @@ namespace set2 { } std::ostream& dump( std::ostream& stm ) { return stm; } + + // for testing + static CDS_CONSTEXPR bool const c_bExtractSupported = false; + static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; }; template base_class; public: typedef typename base_class::key_type value_type; - typedef std_implementation_tag implementation_tag; - StdSet( size_t /*nMapSize*/, size_t /*nLoadFactor*/ ) + template + StdSet( Config const& ) {} template @@ -183,10 +187,14 @@ namespace set2 { } std::ostream& dump( std::ostream& stm ) { return stm; } + + // for testing + static CDS_CONSTEXPR bool const c_bExtractSupported = false; + static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; }; template - struct set_type< std_implementation_tag, Key, Val >: public set_type_base< Key, Val > + struct set_type< tag_StdSet, Key, Val >: public set_type_base< Key, Val > { typedef set_type_base< Key, Val > base_class; typedef typename base_class::key_val key_val; @@ -195,9 +203,11 @@ namespace set2 { typedef typename base_class::equal_to equal_to; typedef StdSet< key_val, less, cds::sync::spin > StdSet_Spin; + typedef StdSet< key_val, less, std::mutex > StdSet_Mutex; typedef StdSet< key_val, less, lock::NoLock> StdSet_NoLock; typedef StdHashSet< key_val, hash, less, equal_to, cds::sync::spin > StdHashSet_Spin; + typedef StdHashSet< key_val, hash, less, equal_to, std::mutex > StdHashSet_Mutex; typedef StdHashSet< key_val, hash, less, equal_to, lock::NoLock > StdHashSet_NoLock; }; -- 2.34.1