From 94ddd906ca421b8df083fc7ca0e6455ed9a3091f Mon Sep 17 00:00:00 2001 From: khizmax Date: Tue, 7 Apr 2015 18:04:09 +0300 Subject: [PATCH] Changed map_delodd test --- tests/unit/map2/map_delodd.cpp | 12 ++++++++---- tests/unit/map2/map_delodd.h | 12 ++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/unit/map2/map_delodd.cpp b/tests/unit/map2/map_delodd.cpp index c65467ab..8ddb4e98 100644 --- a/tests/unit/map2/map_delodd.cpp +++ b/tests/unit/map2/map_delodd.cpp @@ -27,10 +27,14 @@ namespace map2 { c_nDelThreadCount = cds::OS::topology::processor_count() - c_nExtractThreadCount; } - m_arrData.resize( c_nMapSize ); - for ( size_t i = 0; i < c_nMapSize; ++i ) - m_arrData[i] = i; - std::random_shuffle( m_arrData.begin(), m_arrData.end() ); + m_arrInsert.resize( c_nMapSize ); + m_arrRemove.resize( c_nMapSize ); + for ( size_t i = 0; i < c_nMapSize; ++i ) { + m_arrInsert[i] = i; + m_arrRemove[i] = i; + } + std::random_shuffle( m_arrInsert.begin(), m_arrInsert.end() ); + std::random_shuffle( m_arrRemove.begin(), m_arrRemove.end() ); } void Map_DelOdd::myRun(const char *in_name, bool invert /*= false*/) diff --git a/tests/unit/map2/map_delodd.h b/tests/unit/map2/map_delodd.h index cd1e2707..56e2afc1 100644 --- a/tests/unit/map2/map_delodd.h +++ b/tests/unit/map2/map_delodd.h @@ -127,7 +127,8 @@ namespace map2 { static size_t c_nMaxLoadFactor; // maximum load factor static bool c_bPrintGCState; - std::vector m_arrData; + std::vector m_arrInsert; + std::vector m_arrRemove; protected: typedef CppUnitMini::TestCase Base; @@ -187,7 +188,7 @@ namespace map2 { m_nInsertSuccess = m_nInsertFailed = 0; - std::vector& arrData = getTest().m_arrData; + std::vector& arrData = getTest().m_arrInsert; for ( size_t i = 0; i < arrData.size(); ++i ) { if ( rMap.insert( key_type( arrData[i], m_nThreadNo ))) ++m_nInsertSuccess; @@ -278,7 +279,7 @@ namespace map2 { m_nDeleteFailed = 0; for ( size_t pass = 0; pass < 2; pass++ ) { - std::vector& arrData = getTest().m_arrData; + std::vector& arrData = getTest().m_arrRemove; if ( m_nThreadNo & 1 ) { for ( size_t k = 0; k < c_nInsThreadCount; ++k ) { for ( size_t i = 0; i < arrData.size(); ++i ) { @@ -353,7 +354,7 @@ namespace map2 { typename Map::guarded_ptr gp; for ( size_t pass = 0; pass < 2; ++pass ) { - std::vector& arrData = getTest().m_arrData; + std::vector& arrData = getTest().m_arrRemove; if ( m_nThreadNo & 1 ) { for ( size_t k = 0; k < c_nInsThreadCount; ++k ) { for ( size_t i = 0; i < arrData.size(); ++i ) { @@ -430,7 +431,7 @@ namespace map2 { typename Map::exempt_ptr xp; - std::vector& arrData = getTest().m_arrData; + std::vector& arrData = getTest().m_arrRemove; if ( m_nThreadNo & 1 ) { for ( size_t k = 0; k < c_nInsThreadCount; ++k ) { for ( size_t i = 0; i < arrData.size(); ++i ) { @@ -637,7 +638,6 @@ namespace map2 { additional_cleanup( testMap ); } - template void test() { -- 2.34.1