Splitted up map_insdel_int test to reduce compiling time and memory requirements
authorkhizmax <khizmax@gmail.com>
Wed, 25 Mar 2015 11:55:46 +0000 (14:55 +0300)
committerkhizmax <khizmax@gmail.com>
Wed, 25 Mar 2015 11:55:46 +0000 (14:55 +0300)
12 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_int.h [new file with mode: 0644]
tests/unit/map2/map_insdel_int_bronsonavltree.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_int_cuckoo.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_int_ellentree.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_int_michael.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_int_refinable.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_int_skip.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_int_split.cpp [new file with mode: 0644]
tests/unit/map2/map_insdel_int_striped.cpp [new file with mode: 0644]

index cc319af496d909d90781b48f974cdea821a836c0..ce3f66dd5bb767fa0ad7bff12815d2e5a112b799 100644 (file)
     <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_split.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_func_striped.cpp" />\r
     <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_bronsonavltree.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_cuckoo.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_ellentree.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_michael.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_refinable.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_skip.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_split.cpp" />\r
+    <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_striped.cpp" />\r
     <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
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_func.h" />\r
+    <ClInclude Include="..\..\..\tests\unit\map2\map_insdel_int.h" />\r
   </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
     <ProjectGuid>{CA25BDBF-B354-4597-B6D2-220ABBB0D2F4}</ProjectGuid>\r
index 22bac08fd4831357b988fca4afe609f188750aec..13bc4c00f21b726a13313bf24fd3b408a115b253 100644 (file)
@@ -41,6 +41,14 @@ CDSUNIT_MAP_SOURCES := \
     tests/unit/map2/map_insdel_func_refinable.cpp \
     tests/unit/map2/map_insdel_func_cuckoo.cpp \
     tests/unit/map2/map_insdel_int.cpp \
+    tests/unit/map2/map_insdel_int_michael.cpp \
+    tests/unit/map2/map_insdel_int_split.cpp \
+    tests/unit/map2/map_insdel_int_skip.cpp \
+    tests/unit/map2/map_insdel_int_ellentree.cpp \
+    tests/unit/map2/map_insdel_int_bronsonavltree.cpp \
+    tests/unit/map2/map_insdel_int_striped.cpp \
+    tests/unit/map2/map_insdel_int_refinable.cpp \
+    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_item_string.cpp \
index a6ecc14989d77d6e1848a620f113fd8f4ed3b459..892760c185898d6d0e26d0258d4a0a4fba1903de 100644 (file)
 //$$CDS-header$$
 
-#include "map2/map_types.h"
-#include "cppunit/thread.h"
-
-#include <vector>
+#include "map2/map_insdel_int.h"
 
 namespace map2 {
+    CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_int );
 
-#   define TEST_MAP(X)         void X() { test<MapTypes<key_type, value_type>::X >()    ; }
-#   define TEST_MAP_EXTRACT(X)  TEST_MAP(X)
-#   define TEST_MAP_NOLF(X)    void X() { test_nolf<MapTypes<key_type, value_type>::X >()    ; }
-#   define TEST_MAP_NOLF_EXTRACT(X) TEST_MAP_NOLF(X)
-
-    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;
+    size_t Map_InsDel_int::c_nMapSize = 1000000;
+    size_t Map_InsDel_int::c_nInsertThreadCount = 4;
+    size_t Map_InsDel_int::c_nDeleteThreadCount = 4;
+    size_t Map_InsDel_int::c_nThreadPassCount = 4;
+    size_t Map_InsDel_int::c_nMaxLoadFactor = 8;
+    bool   Map_InsDel_int::c_bPrintGCState = true;
+
+
+    void Map_InsDel_int::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_int: public CppUnitMini::TestCase
+    void Map_InsDel_int::myRun(const char *in_name, bool invert /*= false*/)
     {
-        typedef size_t  key_type;
-        typedef size_t  value_type;
-
-        typedef std::vector<key_type>   key_array;
-        key_array                       m_arrValues;
-
-        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_int&  getTest()
-            {
-                return reinterpret_cast<Map_InsDel_int&>( 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;
-                key_array const& arr = getTest().m_arrValues;
-
-                if ( m_nThreadNo & 1 ) {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
-                            if ( rMap.insert( *it, *it * 8 ) )
-                                ++m_nInsertSuccess;
-                            else
-                                ++m_nInsertFailed;
-                        }
-                    }
-                }
-                else {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
-                            if ( rMap.insert( *it, *it * 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_int&  getTest()
-            {
-                return reinterpret_cast<Map_InsDel_int&>( 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;
-                key_array const& arr = getTest().m_arrValues;
-
-                if ( m_nThreadNo & 1 ) {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
-                            if ( rMap.erase( *it ) )
-                                ++m_nDeleteSuccess;
-                            else
-                                ++m_nDeleteFailed;
-                        }
-                    }
-                }
-                else {
-                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
-                        for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
-                            if ( rMap.erase( *it ) )
-                                ++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;
-
-            m_arrValues.clear();
-            m_arrValues.reserve( c_nMapSize );
-            for ( size_t i = 0; i < c_nMapSize; ++i )
-                m_arrValues.push_back( i );
-            std::random_shuffle( m_arrValues.begin(), m_arrValues.end() );
-
-            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 nItem = 0; nItem < c_nMapSize; ++nItem ) {
-                testMap.erase( nItem );
-            }
-            CPPUNIT_MSG( "   Duration=" << timer.duration() );
-            CPPUNIT_ASSERT_EX( testMap.empty(), ((long long) testMap.size()) );
-
-            additional_check( testMap );
-            print_stat( testMap );
-            additional_cleanup( testMap );
-        }
-
-        template <class MAP>
-        void test()
-        {
-            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()
-        {
-            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 );
-        }
+        setUpParams( m_Cfg.get( "Map_InsDel_int" ));
+
+        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);
+
+        endTestCase();
+    }
 
-#   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_int )
             CDSUNIT_TEST_MichaelMap
             CDSUNIT_TEST_SplitList
@@ -276,8 +51,5 @@ namespace map2 {
             CDSUNIT_TEST_CuckooMap
             CDSUNIT_TEST_StdMap
         CPPUNIT_TEST_SUITE_END()
-
-    };
-
-    CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_int );
+    */
 } // namespace map2
diff --git a/tests/unit/map2/map_insdel_int.h b/tests/unit/map2/map_insdel_int.h
new file mode 100644 (file)
index 0000000..dd1cdf0
--- /dev/null
@@ -0,0 +1,272 @@
+//$$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_EXTRACT(X) TEST_MAP(X)
+#   define TEST_MAP_NOLF(X)    void X() { test_nolf<MapTypes<key_type, value_type>::X >(); }
+#   define TEST_MAP_NOLF_EXTRACT(X) TEST_MAP_NOLF(X)
+
+    class Map_InsDel_int: 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 size_t  key_type;
+        typedef size_t  value_type;
+
+        typedef std::vector<key_type>   key_array;
+        key_array                       m_arrValues;
+
+        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_int&  getTest()
+            {
+                return reinterpret_cast<Map_InsDel_int&>( 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;
+                key_array const& arr = getTest().m_arrValues;
+
+                if ( m_nThreadNo & 1 ) {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
+                            if ( rMap.insert( *it, *it * 8 ) )
+                                ++m_nInsertSuccess;
+                            else
+                                ++m_nInsertFailed;
+                        }
+                    }
+                }
+                else {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
+                            if ( rMap.insert( *it, *it * 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_int&  getTest()
+            {
+                return reinterpret_cast<Map_InsDel_int&>( 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;
+                key_array const& arr = getTest().m_arrValues;
+
+                if ( m_nThreadNo & 1 ) {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
+                            if ( rMap.erase( *it ) )
+                                ++m_nDeleteSuccess;
+                            else
+                                ++m_nDeleteFailed;
+                        }
+                    }
+                }
+                else {
+                    for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
+                        for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
+                            if ( rMap.erase( *it ) )
+                                ++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;
+
+            m_arrValues.clear();
+            m_arrValues.reserve( c_nMapSize );
+            for ( size_t i = 0; i < c_nMapSize; ++i )
+                m_arrValues.push_back( i );
+            std::random_shuffle( m_arrValues.begin(), m_arrValues.end() );
+
+            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 nItem = 0; nItem < c_nMapSize; ++nItem ) {
+                testMap.erase( nItem );
+            }
+            CPPUNIT_MSG( "   Duration=" << timer.duration() );
+            CPPUNIT_ASSERT_EX( testMap.empty(), ((long long) testMap.size()) );
+
+            additional_check( testMap );
+            print_stat( testMap );
+            additional_cleanup( testMap );
+        }
+
+        template <class MAP>
+        void test()
+        {
+            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()
+        {
+            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);
+
+        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_int_bronsonavltree.cpp b/tests/unit/map2/map_insdel_int_bronsonavltree.cpp
new file mode 100644 (file)
index 0000000..e2c4c33
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_BronsonAVLTreeMap )
+        CDSUNIT_TEST_BronsonAVLTreeMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_int_cuckoo.cpp b/tests/unit/map2/map_insdel_int_cuckoo.cpp
new file mode 100644 (file)
index 0000000..f18faff
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_CuckooMap )
+        CDSUNIT_TEST_CuckooMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_int_ellentree.cpp b/tests/unit/map2/map_insdel_int_ellentree.cpp
new file mode 100644 (file)
index 0000000..d026cca
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_EllenBinTreeMap )
+        CDSUNIT_TEST_EllenBinTreeMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_int_michael.cpp b/tests/unit/map2/map_insdel_int_michael.cpp
new file mode 100644 (file)
index 0000000..1f523d4
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_MichaelMap )
+        CDSUNIT_TEST_MichaelMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_int_refinable.cpp b/tests/unit/map2/map_insdel_int_refinable.cpp
new file mode 100644 (file)
index 0000000..956eb42
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_RefinableMap )
+        CDSUNIT_TEST_RefinableMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_int_skip.cpp b/tests/unit/map2/map_insdel_int_skip.cpp
new file mode 100644 (file)
index 0000000..c0b4405
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_SkipListMap )
+        CDSUNIT_TEST_SkipListMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_int_split.cpp b/tests/unit/map2/map_insdel_int_split.cpp
new file mode 100644 (file)
index 0000000..b28f0d6
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_SplitList )
+        CDSUNIT_TEST_SplitList
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2
diff --git a/tests/unit/map2/map_insdel_int_striped.cpp b/tests/unit/map2/map_insdel_int_striped.cpp
new file mode 100644 (file)
index 0000000..fc4644f
--- /dev/null
@@ -0,0 +1,9 @@
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+
+namespace map2 {
+    CPPUNIT_TEST_SUITE_PART( Map_InsDel_int, run_StripedMap )
+        CDSUNIT_TEST_StripedMap
+    CPPUNIT_TEST_SUITE_END_PART()
+} // namespace map2