Splitted up map_insdel_string test to reduce compiling time and memory requirements
authorkhizmax <khizmax@gmail.com>
Wed, 25 Mar 2015 12:16:47 +0000 (15:16 +0300)
committerkhizmax <khizmax@gmail.com>
Wed, 25 Mar 2015 12:16:47 +0000 (15:16 +0300)
14 files changed:
projects/Win/vc12/unit-map-insdel.vcxproj
projects/source.unit.map.mk
tests/unit/map2/map_insdel_int.cpp
tests/unit/map2/map_insdel_string.cpp
tests/unit/map2/map_insdel_string.h [new file with mode: 0644]
tests/unit/map2/map_insdel_string_bronsonavltree.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_cuckoo.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_ellentree.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_michael.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_refinable.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_skip.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_split.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_std.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_string_striped.cpp [new file with mode: 0644]

index ce3f66dd5bb767fa0ad7bff12815d2e5a112b799..efb997715c1f3682d70ec069be3293ab29982928 100644 (file)
     <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_item_int.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_item_string.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_bronsonavltree.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_cuckoo.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_ellentree.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_michael.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_refinable.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_skip.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_split.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_std.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_striped.cpp" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_func.h" />\r
     <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_int.h" />\r
+    <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_string.h" />\r
   </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
     <ProjectGuid>{CA25BDBF-B354-4597-B6D2-220ABBB0D2F4}</ProjectGuid>\r
index 13bc4c00f21b726a13313bf24fd3b408a115b253..7fc6d53b5ec45e83e074ce9ea69751a21137bc85 100644 (file)
@@ -51,6 +51,15 @@ CDSUNIT_MAP_SOURCES := \
     tests/unit/map2/map_insdel_int_cuckoo.cpp \
     tests/unit/map2/map_insdel_item_int.cpp \
     tests/unit/map2/map_insdel_string.cpp \
+    tests/unit/map2/map_insdel_string_michael.cpp \
+    tests/unit/map2/map_insdel_string_split.cpp \
+    tests/unit/map2/map_insdel_string_skip.cpp \
+    tests/unit/map2/map_insdel_string_ellentree.cpp \
+    tests/unit/map2/map_insdel_string_bronsonavltree.cpp \
+    tests/unit/map2/map_insdel_string_striped.cpp \
+    tests/unit/map2/map_insdel_string_refinable.cpp \
+    tests/unit/map2/map_insdel_string_cuckoo.cpp \
+    tests/unit/map2/map_insdel_string_std.cpp \
     tests/unit/map2/map_insdel_item_string.cpp \
     tests/unit/map2/map_insdelfind.cpp \
     tests/unit/map2/map_delodd.cpp \
index 892760c185898d6d0e26d0258d4a0a4fba1903de..42e053cf1c86d4b87f5020a9bfbfd22b7effd66c 100644 (file)
@@ -37,19 +37,4 @@ namespace map2 {
 
         endTestCase();
     }
-
-
-    /*
-        CPPUNIT_TEST_SUITE( Map_InsDel_int )
-            CDSUNIT_TEST_MichaelMap
-            CDSUNIT_TEST_SplitList
-            CDSUNIT_TEST_SkipListMap
-            CDSUNIT_TEST_EllenBinTreeMap
-            CDSUNIT_TEST_BronsonAVLTreeMap
-            CDSUNIT_TEST_StripedMap
-            CDSUNIT_TEST_RefinableMap
-            CDSUNIT_TEST_CuckooMap
-            CDSUNIT_TEST_StdMap
-        CPPUNIT_TEST_SUITE_END()
-    */
 } // namespace map2
index 6fab9045e1c78812c49e0cb0c7c16c766544de34..7be437c29cad51d61285e674aa8cca0373593610 100644 (file)
 //$$CDS-header$$
 
-#include "map2/map_types.h"
-#include "cppunit/thread.h"
-
-#include <vector>
+#include "map2/map_insdel_string.h"
 
 namespace map2 {
+    CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_string );
 
-#   define TEST_MAP(X)         void X() { test<MapTypes<key_type, value_type>::X >()    ; }
-#   define TEST_MAP_NOLF(X)    void X() { test_nolf<MapTypes<key_type, value_type>::X >()    ; }
-#   define TEST_MAP_EXTRACT(X)  TEST_MAP(X)
-#   define TEST_MAP_NOLF_EXTRACT(X) TEST_MAP_NOLF(X)
+    size_t Map_InsDel_string::c_nMapSize = 1000000;
+    size_t Map_InsDel_string::c_nInsertThreadCount = 4;
+    size_t Map_InsDel_string::c_nDeleteThreadCount = 4;
+    size_t Map_InsDel_string::c_nThreadPassCount = 4;
+    size_t Map_InsDel_string::c_nMaxLoadFactor = 8;
+    bool   Map_InsDel_string::c_bPrintGCState = true;
 
-    namespace {
-        static size_t  c_nMapSize = 1000000    ;  // map size
-        static size_t  c_nInsertThreadCount = 4;  // count of insertion thread
-        static size_t  c_nDeleteThreadCount = 4;  // count of deletion thread
-        static size_t  c_nThreadPassCount = 4  ;  // pass count for each thread
-        static size_t  c_nMaxLoadFactor = 8    ;  // maximum load factor
-        static bool    c_bPrintGCState = true;
+    void Map_InsDel_string::setUpParams( const CppUnitMini::TestCfg& cfg ) 
+    {
+        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", c_bPrintGCState );
     }
 
-    class Map_InsDel_string: public CppUnitMini::TestCase
+    void Map_InsDel_string::myRun(const char *in_name, bool invert /*= false*/)
     {
-        typedef std::string key_type;
-        typedef size_t      value_type;
-
-        const std::vector<std::string> *  m_parrString;
-
-        template <class MAP>
-        class Inserter: public CppUnitMini::TestThread
-        {
-            MAP&     m_Map;
-
-            virtual Inserter *    clone()
-            {
-                return new Inserter( *this );
-            }
-        public:
-            size_t  m_nInsertSuccess;
-            size_t  m_nInsertFailed;
-
-        public:
-            Inserter( CppUnitMini::ThreadPool& pool, MAP& rMap )
-                : CppUnitMini::TestThread( pool )
-                , m_Map( rMap )
-            {}
-            Inserter( Inserter& src )
-                : CppUnitMini::TestThread( src )
-                , m_Map( src.m_Map )
-            {}
-
-            Map_InsDel_string&  getTest()
-            {
-                return reinterpret_cast<Map_InsDel_string&>( m_Pool.m_Test );
-            }
-
-            virtual void init() { cds::threading::Manager::attachThread()   ; }
-            virtual void fini() { cds::threading::Manager::detachThread()   ; }
-
-            virtual void test()
-            {
-                MAP& rMap = m_Map;
-
-                m_nInsertSuccess =
-                    m_nInsertFailed = 0;
-
-                const std::vector<std::string>& arrString = *getTest().m_parrString;
-                size_t nArrSize = arrString.size();
-
-                if ( m_nThreadNo & 1 ) {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) {
-                            if ( rMap.insert( arrString[nItem % nArrSize], nItem * 8 ) )
-                                ++m_nInsertSuccess;
-                            else
-                                ++m_nInsertFailed;
-                        }
-                    }
-                }
-                else {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) {
-                            if ( rMap.insert( arrString[nItem % nArrSize], nItem * 8 ) )
-                                ++m_nInsertSuccess;
-                            else
-                                ++m_nInsertFailed;
-                        }
-                    }
-                }
-            }
-        };
-
-        template <class MAP>
-        class Deleter: public CppUnitMini::TestThread
-        {
-            MAP&     m_Map;
-
-            virtual Deleter *    clone()
-            {
-                return new Deleter( *this );
-            }
-        public:
-            size_t  m_nDeleteSuccess;
-            size_t  m_nDeleteFailed;
-
-        public:
-            Deleter( CppUnitMini::ThreadPool& pool, MAP& rMap )
-                : CppUnitMini::TestThread( pool )
-                , m_Map( rMap )
-            {}
-            Deleter( Deleter& src )
-                : CppUnitMini::TestThread( src )
-                , m_Map( src.m_Map )
-            {}
-
-            Map_InsDel_string&  getTest()
-            {
-                return reinterpret_cast<Map_InsDel_string&>( m_Pool.m_Test );
-            }
-
-            virtual void init() { cds::threading::Manager::attachThread()   ; }
-            virtual void fini() { cds::threading::Manager::detachThread()   ; }
-
-            virtual void test()
-            {
-                MAP& rMap = m_Map;
-
-                m_nDeleteSuccess =
-                    m_nDeleteFailed = 0;
-
-                const std::vector<std::string>& arrString = *getTest().m_parrString;
-                size_t nArrSize = arrString.size();
-
-                if ( m_nThreadNo & 1 ) {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) {
-                            if ( rMap.erase( arrString[nItem % nArrSize] ) )
-                                ++m_nDeleteSuccess;
-                            else
-                                ++m_nDeleteFailed;
-                        }
-                    }
-                }
-                else {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) {
-                            if ( rMap.erase( arrString[nItem % nArrSize] ) )
-                                ++m_nDeleteSuccess;
-                            else
-                                ++m_nDeleteFailed;
-                        }
-                    }
-                }
-            }
-        };
-
-    protected:
-
-        template <class MAP>
-        void do_test( MAP& testMap )
-        {
-            typedef Inserter<MAP>       InserterThread;
-            typedef Deleter<MAP>        DeleterThread;
-            cds::OS::Timer    timer;
-
-            CppUnitMini::ThreadPool pool( *this );
-            pool.add( new InserterThread( pool, testMap ), c_nInsertThreadCount );
-            pool.add( new DeleterThread( pool, testMap ), c_nDeleteThreadCount );
-            pool.run();
-            CPPUNIT_MSG( "   Duration=" << pool.avgDuration() );
-
-            size_t nInsertSuccess = 0;
-            size_t nInsertFailed = 0;
-            size_t nDeleteSuccess = 0;
-            size_t nDeleteFailed = 0;
-            for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
-                InserterThread * pThread = dynamic_cast<InserterThread *>( *it );
-                if ( pThread ) {
-                    nInsertSuccess += pThread->m_nInsertSuccess;
-                    nInsertFailed += pThread->m_nInsertFailed;
-                }
-                else {
-                    DeleterThread * p = static_cast<DeleterThread *>( *it );
-                    nDeleteSuccess += p->m_nDeleteSuccess;
-                    nDeleteFailed += p->m_nDeleteFailed;
-                }
-            }
-
-            CPPUNIT_MSG( "    Totals: Ins succ=" << nInsertSuccess
-                << " Del succ=" << nDeleteSuccess << "\n"
-                      << "          : Ins fail=" << nInsertFailed
-                << " Del fail=" << nDeleteFailed
-                << " Map size=" << testMap.size()
-                );
-
-            check_before_cleanup( testMap );
-
-            CPPUNIT_MSG( "  Clear map (single-threaded)..." );
-            timer.reset();
-            for ( size_t i = 0; i < m_parrString->size(); ++i )
-                testMap.erase( (*m_parrString)[i] );
-            CPPUNIT_MSG( "   Duration=" << timer.duration() );
-            CPPUNIT_CHECK( testMap.empty() );
-
-            additional_check( testMap );
-            print_stat( testMap );
-            additional_cleanup( testMap );
-        }
-
-        template <class MAP>
-        void test()
-        {
-            m_parrString = &CppUnitMini::TestCase::getTestStrings();
-
-            CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
-                << " delete=" << c_nDeleteThreadCount
-                << " pass count=" << c_nThreadPassCount
-                << " map size=" << c_nMapSize
-                );
-
-            for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
-                CPPUNIT_MSG( "Load factor=" << nLoadFactor );
-                MAP  testMap( c_nMapSize, nLoadFactor );
-                do_test( testMap );
-                if ( c_bPrintGCState )
-                    print_gc_state();
-            }
-        }
-
-        template <class MAP>
-        void test_nolf()
-        {
-            m_parrString = &CppUnitMini::TestCase::getTestStrings();
-
-            CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
-                << " delete=" << c_nDeleteThreadCount
-                << " pass count=" << c_nThreadPassCount
-                << " map size=" << c_nMapSize
-                );
-
-            MAP testMap;
-            do_test( testMap );
-            if ( c_bPrintGCState )
-                print_gc_state();
-        }
-
-        void setUpParams( const CppUnitMini::TestCfg& cfg ) {
-            c_nInsertThreadCount = cfg.getULong("InsertThreadCount", 4 );
-            c_nDeleteThreadCount = cfg.getULong("DeleteThreadCount", 4 );
-            c_nThreadPassCount = cfg.getULong("ThreadPassCount", 4 );
-            c_nMapSize = cfg.getULong("MapSize", 1000000 );
-            c_nMaxLoadFactor = cfg.getULong("MaxLoadFactor", 8 );
-            c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
-        }
-
-#   include "map2/map_defs.h"
-        CDSUNIT_DECLARE_MichaelMap
-        CDSUNIT_DECLARE_SplitList
-        CDSUNIT_DECLARE_SkipListMap
-        CDSUNIT_DECLARE_EllenBinTreeMap
-        CDSUNIT_DECLARE_BronsonAVLTreeMap
-        CDSUNIT_DECLARE_StripedMap
-        CDSUNIT_DECLARE_RefinableMap
-        CDSUNIT_DECLARE_CuckooMap
-        CDSUNIT_DECLARE_StdMap
-
-        CPPUNIT_TEST_SUITE( Map_InsDel_string )
-            CDSUNIT_TEST_MichaelMap
-            CDSUNIT_TEST_SplitList
-            CDSUNIT_TEST_SkipListMap
-            CDSUNIT_TEST_EllenBinTreeMap
-            CDSUNIT_TEST_BronsonAVLTreeMap
-            CDSUNIT_TEST_StripedMap
-            CDSUNIT_TEST_RefinableMap
-            CDSUNIT_TEST_CuckooMap
-            CDSUNIT_TEST_StdMap
-        CPPUNIT_TEST_SUITE_END()
-
-    };
-
-    CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_string );
+        setUpParams( m_Cfg.get( "Map_InsDel_string" ));
+
+        run_MichaelMap(in_name, invert);
+        run_SplitList(in_name, invert);
+        run_SkipListMap(in_name, invert);
+        run_EllenBinTreeMap(in_name, invert);
+        run_BronsonAVLTreeMap(in_name, invert);
+        run_StripedMap(in_name, invert);
+        run_RefinableMap(in_name, invert);
+        run_CuckooMap(in_name, invert);
+        run_StdMap(in_name, invert);
+
+        endTestCase();
+    }
 } // namespace map2
diff --git a/tests/unit/map2/map_insdel_string.h b/tests/unit/map2/map_insdel_string.h
new file mode 100644 (file)
index 0000000..334b291
--- /dev/null
@@ -0,0 +1,274 @@
+//$$CDS-header$$
+
+#include "map2/map_types.h"
+#include "cppunit/thread.h"
+
+#include <vector>
+
+namespace map2 {
+
+#   define TEST_MAP(X)         void X() { test<MapTypes<key_type, value_type>::X >()    ; }
+#   define TEST_MAP_NOLF(X)    void X() { test_nolf<MapTypes<key_type, value_type>::X >()    ; }
+#   define TEST_MAP_EXTRACT(X)  TEST_MAP(X)
+#   define TEST_MAP_NOLF_EXTRACT(X) TEST_MAP_NOLF(X)
+
+    class Map_InsDel_string: public CppUnitMini::TestCase
+    {
+        static size_t  c_nMapSize;            // map 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;
+
+        typedef CppUnitMini::TestCase Base;
+        typedef std::string key_type;
+        typedef size_t      value_type;
+
+        const std::vector<std::string> *  m_parrString;
+
+        template <class MAP>
+        class Inserter: public CppUnitMini::TestThread
+        {
+            MAP&     m_Map;
+
+            virtual Inserter *    clone()
+            {
+                return new Inserter( *this );
+            }
+        public:
+            size_t  m_nInsertSuccess;
+            size_t  m_nInsertFailed;
+
+        public:
+            Inserter( CppUnitMini::ThreadPool& pool, MAP& rMap )
+                : CppUnitMini::TestThread( pool )
+                , m_Map( rMap )
+            {}
+            Inserter( Inserter& src )
+                : CppUnitMini::TestThread( src )
+                , m_Map( src.m_Map )
+            {}
+
+            Map_InsDel_string&  getTest()
+            {
+                return reinterpret_cast<Map_InsDel_string&>( m_Pool.m_Test );
+            }
+
+            virtual void init() { cds::threading::Manager::attachThread()   ; }
+            virtual void fini() { cds::threading::Manager::detachThread()   ; }
+
+            virtual void test()
+            {
+                MAP& rMap = m_Map;
+
+                m_nInsertSuccess =
+                    m_nInsertFailed = 0;
+
+                const std::vector<std::string>& arrString = *getTest().m_parrString;
+                size_t nArrSize = arrString.size();
+
+                if ( m_nThreadNo & 1 ) {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) {
+                            if ( rMap.insert( arrString[nItem % nArrSize], nItem * 8 ) )
+                                ++m_nInsertSuccess;
+                            else
+                                ++m_nInsertFailed;
+                        }
+                    }
+                }
+                else {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) {
+                            if ( rMap.insert( arrString[nItem % nArrSize], nItem * 8 ) )
+                                ++m_nInsertSuccess;
+                            else
+                                ++m_nInsertFailed;
+                        }
+                    }
+                }
+            }
+        };
+
+        template <class MAP>
+        class Deleter: public CppUnitMini::TestThread
+        {
+            MAP&     m_Map;
+
+            virtual Deleter *    clone()
+            {
+                return new Deleter( *this );
+            }
+        public:
+            size_t  m_nDeleteSuccess;
+            size_t  m_nDeleteFailed;
+
+        public:
+            Deleter( CppUnitMini::ThreadPool& pool, MAP& rMap )
+                : CppUnitMini::TestThread( pool )
+                , m_Map( rMap )
+            {}
+            Deleter( Deleter& src )
+                : CppUnitMini::TestThread( src )
+                , m_Map( src.m_Map )
+            {}
+
+            Map_InsDel_string&  getTest()
+            {
+                return reinterpret_cast<Map_InsDel_string&>( m_Pool.m_Test );
+            }
+
+            virtual void init() { cds::threading::Manager::attachThread()   ; }
+            virtual void fini() { cds::threading::Manager::detachThread()   ; }
+
+            virtual void test()
+            {
+                MAP& rMap = m_Map;
+
+                m_nDeleteSuccess =
+                    m_nDeleteFailed = 0;
+
+                const std::vector<std::string>& arrString = *getTest().m_parrString;
+                size_t nArrSize = arrString.size();
+
+                if ( m_nThreadNo & 1 ) {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) {
+                            if ( rMap.erase( arrString[nItem % nArrSize] ) )
+                                ++m_nDeleteSuccess;
+                            else
+                                ++m_nDeleteFailed;
+                        }
+                    }
+                }
+                else {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) {
+                            if ( rMap.erase( arrString[nItem % nArrSize] ) )
+                                ++m_nDeleteSuccess;
+                            else
+                                ++m_nDeleteFailed;
+                        }
+                    }
+                }
+            }
+        };
+
+    protected:
+
+        template <class MAP>
+        void do_test( MAP& testMap )
+        {
+            typedef Inserter<MAP>       InserterThread;
+            typedef Deleter<MAP>        DeleterThread;
+            cds::OS::Timer    timer;
+
+            CppUnitMini::ThreadPool pool( *this );
+            pool.add( new InserterThread( pool, testMap ), c_nInsertThreadCount );
+            pool.add( new DeleterThread( pool, testMap ), c_nDeleteThreadCount );
+            pool.run();
+            CPPUNIT_MSG( "   Duration=" << pool.avgDuration() );
+
+            size_t nInsertSuccess = 0;
+            size_t nInsertFailed = 0;
+            size_t nDeleteSuccess = 0;
+            size_t nDeleteFailed = 0;
+            for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
+                InserterThread * pThread = dynamic_cast<InserterThread *>( *it );
+                if ( pThread ) {
+                    nInsertSuccess += pThread->m_nInsertSuccess;
+                    nInsertFailed += pThread->m_nInsertFailed;
+                }
+                else {
+                    DeleterThread * p = static_cast<DeleterThread *>( *it );
+                    nDeleteSuccess += p->m_nDeleteSuccess;
+                    nDeleteFailed += p->m_nDeleteFailed;
+                }
+            }
+
+            CPPUNIT_MSG( "    Totals: Ins succ=" << nInsertSuccess
+                << " Del succ=" << nDeleteSuccess << "\n"
+                      << "          : Ins fail=" << nInsertFailed
+                << " Del fail=" << nDeleteFailed
+                << " Map size=" << testMap.size()
+                );
+
+            check_before_cleanup( testMap );
+
+            CPPUNIT_MSG( "  Clear map (single-threaded)..." );
+            timer.reset();
+            for ( size_t i = 0; i < m_parrString->size(); ++i )
+                testMap.erase( (*m_parrString)[i] );
+            CPPUNIT_MSG( "   Duration=" << timer.duration() );
+            CPPUNIT_CHECK( testMap.empty() );
+
+            additional_check( testMap );
+            print_stat( testMap );
+            additional_cleanup( testMap );
+        }
+
+        template <class MAP>
+        void test()
+        {
+            m_parrString = &CppUnitMini::TestCase::getTestStrings();
+
+            CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
+                << " delete=" << c_nDeleteThreadCount
+                << " pass count=" << c_nThreadPassCount
+                << " map size=" << c_nMapSize
+                );
+
+            for ( size_t nLoadFactor = 1; nLoadFactor <= c_nMaxLoadFactor; nLoadFactor *= 2 ) {
+                CPPUNIT_MSG( "Load factor=" << nLoadFactor );
+                MAP  testMap( c_nMapSize, nLoadFactor );
+                do_test( testMap );
+                if ( c_bPrintGCState )
+                    print_gc_state();
+            }
+        }
+
+        template <class MAP>
+        void test_nolf()
+        {
+            m_parrString = &CppUnitMini::TestCase::getTestStrings();
+
+            CPPUNIT_MSG( "Thread count: insert=" << c_nInsertThreadCount
+                << " delete=" << c_nDeleteThreadCount
+                << " pass count=" << c_nThreadPassCount
+                << " map size=" << c_nMapSize
+                );
+
+            MAP testMap;
+            do_test( testMap );
+            if ( c_bPrintGCState )
+                print_gc_state();
+        }
+
+        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_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_SplitList
+        CDSUNIT_DECLARE_SkipListMap
+        CDSUNIT_DECLARE_EllenBinTreeMap
+        CDSUNIT_DECLARE_BronsonAVLTreeMap
+        CDSUNIT_DECLARE_StripedMap
+        CDSUNIT_DECLARE_RefinableMap
+        CDSUNIT_DECLARE_CuckooMap
+        CDSUNIT_DECLARE_StdMap
+    };
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_bronsonavltree.cpp b/tests/unit/map2/map_insdel_string_bronsonavltree.cpp
new file mode 100644 (file)
index 0000000..89fe877
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_BronsonAVLTreeMap )
+        CDSUNIT_TEST_BronsonAVLTreeMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_cuckoo.cpp b/tests/unit/map2/map_insdel_string_cuckoo.cpp
new file mode 100644 (file)
index 0000000..a6b218b
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_CuckooMap )
+        CDSUNIT_TEST_CuckooMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_ellentree.cpp b/tests/unit/map2/map_insdel_string_ellentree.cpp
new file mode 100644 (file)
index 0000000..8fbeeb2
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_EllenBinTreeMap )
+        CDSUNIT_TEST_EllenBinTreeMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_michael.cpp b/tests/unit/map2/map_insdel_string_michael.cpp
new file mode 100644 (file)
index 0000000..b679209
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_MichaelMap )
+        CDSUNIT_TEST_MichaelMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_refinable.cpp b/tests/unit/map2/map_insdel_string_refinable.cpp
new file mode 100644 (file)
index 0000000..0dcd44f
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_RefinableMap )
+        CDSUNIT_TEST_RefinableMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_skip.cpp b/tests/unit/map2/map_insdel_string_skip.cpp
new file mode 100644 (file)
index 0000000..2cfcbf6
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_SkipListMap )
+        CDSUNIT_TEST_SkipListMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_split.cpp b/tests/unit/map2/map_insdel_string_split.cpp
new file mode 100644 (file)
index 0000000..be6342d
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_SplitList )
+        CDSUNIT_TEST_SplitList
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_std.cpp b/tests/unit/map2/map_insdel_string_std.cpp
new file mode 100644 (file)
index 0000000..f7a7e2b
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_StdMap )
+        CDSUNIT_TEST_StdMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_string_striped.cpp b/tests/unit/map2/map_insdel_string_striped.cpp
new file mode 100644 (file)
index 0000000..2c772fc
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_string.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_string, run_StripedMap )
+        CDSUNIT_TEST_StripedMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2