Refactored Set_InsDel_string MT-test
authorkhizmax <libcds.dev@gmail.com>
Sat, 12 Sep 2015 16:09:09 +0000 (19:09 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sat, 12 Sep 2015 16:09:09 +0000 (19:09 +0300)
17 files changed:
projects/Win/vc12/unit-set-insdel.vcxproj
projects/Win/vc12/unit-set-insdel.vcxproj.filters
projects/source.unit.set.mk
tests/unit/set2/CMakeLists.txt
tests/unit/set2/set_defs.h
tests/unit/set2/set_insdel_func.h
tests/unit/set2/set_insdel_string.cpp
tests/unit/set2/set_insdel_string.h
tests/unit/set2/set_insdel_string_cuckoo.cpp
tests/unit/set2/set_insdel_string_ellentree.cpp
tests/unit/set2/set_insdel_string_michael.cpp
tests/unit/set2/set_insdel_string_refinable.cpp [deleted file]
tests/unit/set2/set_insdel_string_skip.cpp
tests/unit/set2/set_insdel_string_split.cpp
tests/unit/set2/set_insdel_string_std.cpp
tests/unit/set2/set_insdel_string_striped.cpp
tests/unit/set2/set_type_std.h

index 3b1a81727ca0ea51dcd321923fb55d3a58e836d9..b4bd97fec92945e95c887cc54c257a13196df8d6 100644 (file)
@@ -54,7 +54,6 @@
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_cuckoo.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_ellentree.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_michael.cpp" />\r
-    <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_refinable.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_skip.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_split.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_std.cpp" />\r
index 1e4acd1445fcfe1b4ff577171f79202440d77bf2..9dd1ddb5f4e6bed7df4ca0336db81ddc92b7037e 100644 (file)
@@ -31,9 +31,6 @@
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_michael.cpp">\r
       <Filter>set_insdel_string</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_refinable.cpp">\r
-      <Filter>set_insdel_string</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\..\tests\unit\set2\set_insdel_string_skip.cpp">\r
       <Filter>set_insdel_string</Filter>\r
     </ClCompile>\r
index e0980921bfe8ac8f00f79c4cb8c02266a2bc6dec..bcd4f3ff937e6ee3eb4fe2c17046b144aa855d29 100644 (file)
@@ -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 \
index a72e69f7e8ca20be165cf39de86b0df1e7048cbf..c375a3fdf07ef074da06f13bf75920ccaa2b328d 100644 (file)
@@ -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
index 9df4c917fc2799641828fed94ccba14c501a9a14..5412a9680f8b65a26c089de60a2bf1074b7a3187 100644 (file)
@@ -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  \
     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)\
     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 \
     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 \
     CPPUNIT_TEST(EllenBinTreeSet_rcu_gpt_stat)\
     CDSUNIT_TEST_EllenBinTreeSet_RCU_signal
 
-
+//********************************************************************
+// StripedSet
 
 #define CDSUNIT_DECLARE_StripedSet_common \
     TEST_CASE( tag_StripedSet, StripedSet_list) \
     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) \
index f20cbe7720cfc5c04fea027d909b94b7686ec326..ad8e0a747932ad96c0ff05284846e5b024cbd027 100644 (file)
@@ -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 )
index a0a2a669b4ad77108a833f2b4fa5220aafab8f24..f84adffbb2df5cde5b6b2a6f66a29c004aa49dc8 100644 (file)
@@ -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
index fb3a01a0c23581097d1e96ff49bea1250c083af6..6e818f8082d9800012dd703e8b70892d326bbb2c 100644 (file)
@@ -7,20 +7,25 @@
 
 namespace set2 {
 
-#   define TEST_SET(IMPL, C, X)          void C::X() { test<set_type<IMPL, key_type, value_type>::X >(); }
-#   define TEST_SET_EXTRACT(IMPL, C, X)  void C::X() { test_extract<set_type<IMPL, key_type, value_type>::X >(); }
-#   define TEST_SET_NOLF(IMPL, C, X)     void C::X() { test_nolf<set_type<IMPL, key_type, value_type>::X >(); }
-#   define TEST_SET_NOLF_EXTRACT(IMPL, C, X) void C::X() { test_nolf_extract<set_type<IMPL, key_type, value_type>::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<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& 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 <class Set>
-        void do_test( size_t nLoadFactor )
-        {
-            CPPUNIT_MSG( "Load factor=" << nLoadFactor );
-
-            Set  testSet( c_nMapSize, nLoadFactor );
-            do_test_with( testSet );
-        }
-
-        template <class Set>
-        void do_test_extract( size_t nLoadFactor )
-        {
-            CPPUNIT_MSG( "Load factor=" << nLoadFactor );
-
-            Set  testSet( c_nMapSize, nLoadFactor );
-            do_test_extract_with( testSet );
-        }
-
-        template <class Set>
-        void do_test_with( Set& testSet )
+        void do_test( Set& testSet )
         {
             typedef Inserter<Set>       InserterThread;
             typedef Deleter<Set>        DeleterThread;
@@ -391,7 +385,7 @@ namespace set2 {
         }
 
         template <class Set>
-        void do_test_extract_with( Set& testSet )
+        void do_test_extract( Set& testSet )
         {
             typedef Inserter<Set>       InserterThread;
             typedef Deleter<Set>        DeleterThread;
@@ -456,88 +450,63 @@ namespace set2 {
         }
 
         template <class Set>
-        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<Set>( 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 <class Set>
-        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<Set>( 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 <class Set>
-        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 <class Set>
-        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
index ee7219c24d5314216c1549e86bd4366dc5051756..190fdb03e6731df776763ed41ad03f2c66ef4404 100644 (file)
@@ -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<typename set_type< TAG, key_type, value_type>::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
index e05d42b2038f66ae65194eef730e718c27d6be98..c7bed1499d3df9cb0c098390937d6f63b9452f6e 100644 (file)
@@ -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<typename set_type< TAG, key_type, value_type>::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
index 7c45b807cbde7cc1e2ee09067df40c44fb970ff7..b533b6ee378b711869b20da903dbdbf206932445 100644 (file)
@@ -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<typename set_type< TAG, key_type, value_type>::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 (file)
index 33c2a0d..0000000
+++ /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
index 562cba269df85f76c98a5433922d0658821b681d..48afc860fe7aa1b0b0b57b5b099ef2a30ead1f6c 100644 (file)
@@ -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<typename set_type< TAG, key_type, value_type>::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
index d851e9b2a41bcdce81bdeb59bbf7c59c072263d4..78a3ae03d90330f43e58e669c37f538dee5b7467 100644 (file)
@@ -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<typename set_type< TAG, key_type, value_type>::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
index b383122c51753e49e4b5177299286c7439bc4c16..286fa6323d693beff3212a8b6b6f1255d743c265 100644 (file)
@@ -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<typename set_type< TAG, key_type, value_type>::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
index e478bdf34b35192617d75fa50863792ce18231ba..47a5d6b7e0025af64421ed4855e710ed9aefc3c3 100644 (file)
@@ -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<typename set_type< TAG, key_type, value_type>::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
index 047381819da3d0c1c617f9afa643de811957ebff..d359537b51872b31ae041688819d2166d2cc1a79 100644 (file)
@@ -11,7 +11,7 @@
 
 namespace set2 {
 
-    struct std_implementation_tag;
+    struct tag_StdSet;
 
     template <typename Value, typename Hash, typename Less, typename EqualTo, typename Lock,
         class Alloc = typename CDS_DEFAULT_ALLOCATOR::template rebind<Value>::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 <class Config>
+        StdHashSet( Config const& )
         {}
 
         template <typename Key>
@@ -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 <typename Value, typename Less, typename Lock,
@@ -115,9 +119,9 @@ namespace set2 {
         typedef std::set<Value, Less, Alloc> 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 <class Config>
+        StdSet( Config const& )
         {}
 
         template <typename Key>
@@ -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 <typename Key, typename Val>
-    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;
     };