[CI] Changed CMake scripts for tests
[libcds.git] / test / unit / list / test_kv_iterable_list.h
index d97f27c6e9855e9348ee9220fe630f96083cea3b..9fcefda7fd5bd0cfb7a8b6b8b9f6289f253e9840 100644 (file)
@@ -1,11 +1,11 @@
 /*
     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/
-    
+
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
@@ -57,9 +57,9 @@ namespace cds_test {
                 s.nKey = 0;
             }
 
-            int key() const 
-            { 
-                return nKey; 
+            int key() const
+            {
+                return nKey;
             }
         };
 
@@ -99,7 +99,7 @@ namespace cds_test {
             }
         };
 
-        struct cmp 
+        struct cmp
         {
             int operator()( key_type const& lhs, key_type const& rhs ) const
             {
@@ -158,7 +158,6 @@ namespace cds_test {
 
             static const size_t nSize = 20;
             typedef typename List::key_type    list_key_type;
-            typedef typename List::mapped_type list_mapped_type;
             typedef typename List::value_type  list_value_type;
             struct key_val {
                 int key;
@@ -172,7 +171,7 @@ namespace cds_test {
             }
             shuffle( arr, arr + nSize );
 
-            ASSERT_TRUE( l.empty() );
+            ASSERT_TRUE( l.empty());
             ASSERT_CONTAINER_SIZE( l, 0 );
 
             // insert/find
@@ -183,7 +182,7 @@ namespace cds_test {
                 EXPECT_FALSE( l.find( i.key, []( list_value_type& ) {} ));
                 EXPECT_FALSE( l.find( key_type( i.key ), []( list_value_type& ) {} ));
                 EXPECT_FALSE( l.find_with( other_key( i.key ), other_less(), []( list_value_type& ) {} ));
-                EXPECT_TRUE( l.find( i.key ) == l.end() );
+                EXPECT_TRUE( l.find( i.key ) == l.end());
                 EXPECT_TRUE( l.find_with( other_key( i.key ), other_less()) == l.end());
 
                 switch ( i.key % 6 ) {
@@ -237,7 +236,7 @@ namespace cds_test {
 
                     case 4:
                         {
-                            auto pair = l.update( i.key, []( list_value_type& n, list_value_type* old ) {
+                            auto pair = l.update( i.key, []( list_value_type&, list_value_type* ) {
                                 ASSERT_TRUE( false );
                             }, false );
                             EXPECT_FALSE( pair.first );
@@ -276,7 +275,7 @@ namespace cds_test {
                             ret = l.upsert( i.key, i.val );
                             EXPECT_TRUE( ret.first );
                             EXPECT_TRUE( ret.second );
-                            EXPECT_TRUE( l.contains( i.key ) );
+                            EXPECT_TRUE( l.contains( i.key ));
 
                             ret = l.upsert( i.key, i.key * 12 );
                             EXPECT_TRUE( ret.first );
@@ -291,7 +290,7 @@ namespace cds_test {
                 EXPECT_TRUE( l.contains( i.key ));
                 EXPECT_TRUE( l.contains( list_key_type(i.key)));
                 EXPECT_TRUE( l.contains( other_key( i.key ), other_less()));
-                EXPECT_TRUE( l.find( i.key, []( list_value_type& n  ) { 
+                EXPECT_TRUE( l.find( i.key, []( list_value_type& n  ) {
                     n.second.val = n.first.nKey;
                 } ));
                 EXPECT_TRUE( l.find( i.key, []( list_value_type& n ) {
@@ -310,17 +309,17 @@ namespace cds_test {
                 EXPECT_TRUE( pair.first );
                 EXPECT_FALSE( pair.second );
 
-                EXPECT_FALSE( l.find( i.key ) == l.end() );
+                EXPECT_FALSE( l.find( i.key ) == l.end());
                 EXPECT_EQ( l.find( i.key )->first.nKey, i.key );
                 EXPECT_EQ( l.find( i.key )->second.val, i.key * 3 );
-                EXPECT_FALSE( l.find_with( other_key( i.key ), other_less() ) == l.end() );
+                EXPECT_FALSE( l.find_with( other_key( i.key ), other_less()) == l.end());
                 EXPECT_EQ( l.find_with( other_key( i.key ), other_less())->first.nKey, i.key );
                 EXPECT_EQ( l.find_with( other_key( i.key ), other_less())->second.val, i.key * 3 );
 
-                EXPECT_FALSE( l.empty() );
+                EXPECT_FALSE( l.empty());
             }
 
-            ASSERT_FALSE( l.empty() );
+            ASSERT_FALSE( l.empty());
             EXPECT_CONTAINER_SIZE( l, nSize );
 
             // erase
@@ -353,19 +352,19 @@ namespace cds_test {
                 EXPECT_FALSE( l.find_with( other_key( i.key ), other_less(), []( list_value_type& ) {} ));
             }
 
-            ASSERT_TRUE( l.empty() );
+            ASSERT_TRUE( l.empty());
             EXPECT_CONTAINER_SIZE( l, 0 );
 
             // clear test
-            for ( auto& i : arr ) 
+            for ( auto& i : arr )
                 EXPECT_TRUE( l.insert( i.key, i.val ));
 
-            ASSERT_FALSE( l.empty() );
+            ASSERT_FALSE( l.empty());
             EXPECT_CONTAINER_SIZE( l, nSize );
 
             l.clear();
 
-            ASSERT_TRUE( l.empty() );
+            ASSERT_TRUE( l.empty());
             EXPECT_CONTAINER_SIZE( l, 0 );
 
             // empty list iterator test
@@ -398,7 +397,7 @@ namespace cds_test {
             }
             shuffle( arr, arr + nSize );
 
-            ASSERT_TRUE( l.empty() );
+            ASSERT_TRUE( l.empty());
             ASSERT_CONTAINER_SIZE( l, 0 );
 
             for ( auto& i : arr )
@@ -406,8 +405,8 @@ namespace cds_test {
 
             int key = 0;
             for ( auto& it : l ) {
-                EXPECT_EQ( key, it.first.key() );
-                EXPECT_EQ( it.second.val, it.first.key() );
+                EXPECT_EQ( key, it.first.key());
+                EXPECT_EQ( it.second.val, it.first.key());
                 it.second.val = it.first.key() * 10;
                 ++key;
             }
@@ -415,7 +414,7 @@ namespace cds_test {
 
             key = 0;
             for ( auto it = l.cbegin(); it != l.cend(); ++it ) {
-                EXPECT_EQ( key, it->first.key() );
+                EXPECT_EQ( key, it->first.key());
                 EXPECT_EQ( it->first.key() * 10, it->second.val );
                 ++key;
             }
@@ -423,7 +422,7 @@ namespace cds_test {
 
             key = 0;
             for ( auto it = l.begin(); it != l.end(); ++it ) {
-                EXPECT_EQ( key, it->first.key() );
+                EXPECT_EQ( key, it->first.key());
                 EXPECT_EQ( it->first.key() * 10, it->second.val );
                 it->second.val = it->first.key() * 2;
                 ++key;
@@ -440,7 +439,7 @@ namespace cds_test {
             EXPECT_EQ( static_cast<size_t>(key), nSize );
 
             l.clear();
-            ASSERT_TRUE( l.empty() );
+            ASSERT_TRUE( l.empty());
             EXPECT_CONTAINER_SIZE( l, 0 );
         }
     };