Adds check for sequential map test case
authorPeizhao Ou <peizhaoo@uci.edu>
Thu, 25 Jan 2018 07:08:53 +0000 (23:08 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Thu, 25 Jan 2018 07:08:53 +0000 (23:08 -0800)
test/stress/sequential/sequential-map/insdelfind/map_insdelfind.h

index 8d69276..3eeaa53 100644 (file)
@@ -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);
             }
         };