Removed trailing spaces
[libcds.git] / test / unit / map / test_michael_iterable_hp.h
index 0bf59321a277dfa9b80376a2603c8d03606f08f5..c5c860375403c89d7eab3b6ee62867481794c8e2 100644 (file)
@@ -1,7 +1,7 @@
 /*
     This file is a part of libcds - Concurrent Data Structures library
 
-    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
@@ -51,7 +51,6 @@ namespace cds_test {
             EXPECT_TRUE( m.empty());
             EXPECT_CONTAINER_SIZE( m, 0 );
 
-            typedef typename Map::value_type map_pair;
             size_t const kkSize = base_class::kSize;
 
             std::vector<key_type> arrKeys;
@@ -68,8 +67,8 @@ namespace cds_test {
             }
 
             for ( auto const& i : arrKeys )
-                EXPECT_TRUE( m.insert( i ) );
-            EXPECT_FALSE( m.empty() );
+                EXPECT_TRUE( m.insert( i ));
+            EXPECT_FALSE( m.empty());
             EXPECT_CONTAINER_SIZE( m, kkSize );
 
             // iterators
@@ -129,10 +128,23 @@ namespace cds_test {
                 ASSERT_TRUE( !gp );
                 gp = m.get( i );
                 ASSERT_TRUE( !gp );
-                gp = m.get_with( other_item( i.nKey ), other_less() );
+                gp = m.get_with( other_item( i.nKey ), other_less());
                 ASSERT_TRUE( !gp );
             }
-            EXPECT_TRUE( m.empty() );
+            EXPECT_TRUE( m.empty());
+            EXPECT_CONTAINER_SIZE( m, 0u );
+
+            // erase_at()
+            for ( auto const& i : arrKeys )
+                EXPECT_TRUE( m.insert( i ));
+            EXPECT_FALSE( m.empty());
+            EXPECT_CONTAINER_SIZE( m, kkSize );
+
+            for ( auto it = m.begin(); it != m.end(); ++it ) {
+                EXPECT_TRUE( m.erase_at( it ));
+                EXPECT_FALSE( m.erase_at( it ));
+            }
+            EXPECT_TRUE( m.empty());
             EXPECT_CONTAINER_SIZE( m, 0u );
         }
     };