From: Peizhao Ou Date: Thu, 25 Jan 2018 07:08:53 +0000 (-0800) Subject: Adds check for sequential map test case X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=51849d173edb10d300192e8812cb179468fdb2a0;p=libcds.git Adds check for sequential map test case --- diff --git a/test/stress/sequential/sequential-map/insdelfind/map_insdelfind.h b/test/stress/sequential/sequential-map/insdelfind/map_insdelfind.h index 8d692766..3eeaa532 100644 --- a/test/stress/sequential/sequential-map/insdelfind/map_insdelfind.h +++ b/test/stress/sequential/sequential-map/insdelfind/map_insdelfind.h @@ -133,6 +133,8 @@ namespace map { Map& rMap = m_Map; size_t pass_count = Map_InsDelFind::s_nPassCount; + size_t nInsertedNum = 0; + size_t nUninsertedNum = 0; for (size_t count = 0; count < pass_count; count++) { bool shouldUpdate = true; for (size_t i = 0; i < s_nMapSize; ++i) { @@ -140,6 +142,7 @@ namespace map { size_t n = i; // Insert if (i % s_nInsertPercentage == 1) { + nInsertedNum++; if (!shouldUpdate) { if (rMap.insert(n, n)) ++m_nInsertSuccess; @@ -153,6 +156,8 @@ namespace map { ++m_nInsertFailed; shouldUpdate = false; } + } else { + nUninsertedNum++; } // Find if (rMap.contains(n)) @@ -170,6 +175,10 @@ namespace map { } } } + EXPECT_EQ(nInsertedNum, m_nFindSuccess); + EXPECT_EQ(nUninsertedNum, m_nFindFailed); + EXPECT_EQ(m_nDeleteSuccess, nInsertedNum); + EXPECT_EQ(m_nDeleteFailed, 0); } };