Merge branch 'ldionne-ldionne-cmake' into dev
[libcds.git] / test / unit / tree / test_intrusive_tree_rcu.h
index ceca126d06a3aabb79954cdac7be30543e64b84b..20c2f3da135826edf5d1fac73bb177ce20a34a9f 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:
 
@@ -25,7 +25,7 @@
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #ifndef CDSUNIT_TREE_TEST_INTRUSIVE_TREE_RCU_H
@@ -56,7 +56,7 @@ namespace cds_test {
 
             base_class::test( t );
 
-            ASSERT_TRUE( t.empty() );
+            ASSERT_TRUE( t.empty());
             ASSERT_CONTAINER_SIZE( t, 0 );
 
             typedef typename Tree::value_type value_type;
@@ -67,10 +67,10 @@ namespace cds_test {
             data.reserve( kSize );
             indices.reserve( kSize );
             for ( size_t key = 0; key < kSize; ++key ) {
-                data.push_back( value_type( static_cast<int>(key) ) );
+                data.push_back( value_type( static_cast<int>(key)));
                 indices.push_back( key );
             }
-            shuffle( indices.begin(), indices.end() );
+            shuffle( indices.begin(), indices.end());
 
             typename Tree::exempt_ptr xp;
 
@@ -82,9 +82,9 @@ namespace cds_test {
                     rcu_lock l;
                     value_type * p = t.get( i );
                     ASSERT_TRUE( p == nullptr );
-                    p = t.get( i.key() );
+                    p = t.get( i.key());
                     ASSERT_TRUE( !p );
-                    p = t.get_with( other_item( i.key() ), other_less() );
+                    p = t.get_with( other_item( i.key()), other_less());
                     ASSERT_TRUE( p == nullptr );
                 }
 
@@ -105,7 +105,7 @@ namespace cds_test {
             for ( auto idx : indices ) {
                 auto& i = data[idx];
                 i.nDisposeCount = 0;
-                ASSERT_TRUE( t.insert( i ) );
+                ASSERT_TRUE( t.insert( i ));
             }
 
             // get/extract
@@ -116,24 +116,24 @@ namespace cds_test {
                     rcu_lock l;
 
                     value_type * p;
-                    EXPECT_EQ( i.nFindCount, 0 );
+                    EXPECT_EQ( i.nFindCount, 0u );
                     p = t.get( i );
                     ASSERT_FALSE( !p );
                     ++p->nFindCount;
-                    EXPECT_EQ( i.nFindCount, 1 );
+                    EXPECT_EQ( i.nFindCount, 1u );
 
-                    p = t.get( i.key() );
+                    p = t.get( i.key());
                     ASSERT_FALSE( !p );
                     ++p->nFindCount;
-                    EXPECT_EQ( i.nFindCount, 2 );
+                    EXPECT_EQ( i.nFindCount, 2u );
 
-                    p = t.get_with( other_item( i.key() ), other_less() );
+                    p = t.get_with( other_item( i.key()), other_less());
                     ASSERT_FALSE( !p );
                     ++p->nFindCount;
-                    EXPECT_EQ( i.nFindCount, 3 );
+                    EXPECT_EQ( i.nFindCount, 3u );
                 }
 
-                EXPECT_EQ( i.nEraseCount, 0 );
+                EXPECT_EQ( i.nEraseCount, 0u );
                 switch ( i.key() % 3 ) {
                 case 0:
                     xp = t.extract( i.key());
@@ -142,40 +142,40 @@ namespace cds_test {
                     xp = t.extract( i );
                     break;
                 case 2:
-                    xp = t.extract_with( other_item( i.key() ), other_less() );
+                    xp = t.extract_with( other_item( i.key()), other_less());
                     break;
                 }
                 ASSERT_FALSE( !xp );
                 ++xp->nEraseCount;
-                EXPECT_EQ( i.nEraseCount, 1 );
+                EXPECT_EQ( i.nEraseCount, 1u );
 
                 xp = t.extract( i );
                 ASSERT_TRUE( !xp );
-                xp = t.extract( i.key() );
+                xp = t.extract( i.key());
                 ASSERT_TRUE( !xp );
-                xp = t.extract_with( other_item( i.key() ), other_less() );
+                xp = t.extract_with( other_item( i.key()), other_less());
                 ASSERT_TRUE( !xp );
             }
 
-            ASSERT_TRUE( t.empty() );
-            ASSERT_CONTAINER_SIZE( t, 0 );
+            ASSERT_TRUE( t.empty());
+            ASSERT_CONTAINER_SIZE( t, 0u );
 
             // Force retiring cycle
             Tree::gc::force_dispose();
             for ( auto& i : data ) {
-                EXPECT_EQ( i.nDisposeCount, 1 );
+                EXPECT_EQ( i.nDisposeCount, 1u );
             }
 
             // extract_min
             for ( auto idx : indices ) {
                 auto& i = data[idx];
                 i.nDisposeCount = 0;
-                ASSERT_TRUE( t.insert( i ) );
+                ASSERT_TRUE( t.insert( i ));
             }
 
             size_t nCount = 0;
             int nKey = -1;
-            while ( !t.empty() ) {
+            while ( !t.empty()) {
                 xp = t.extract_min();
                 ASSERT_FALSE( !xp );
                 EXPECT_EQ( xp->key(), nKey + 1 );
@@ -183,26 +183,26 @@ namespace cds_test {
                 nKey = xp->key();
             }
             xp.release();
-            ASSERT_TRUE( t.empty() );
-            ASSERT_CONTAINER_SIZE( t, 0 );
-            EXPECT_EQ( nCount, data.size() );
+            ASSERT_TRUE( t.empty());
+            ASSERT_CONTAINER_SIZE( t, 0u );
+            EXPECT_EQ( nCount, data.size());
 
             // Force retiring cycle
             Tree::gc::force_dispose();
             for ( auto& i : data ) {
-                EXPECT_EQ( i.nDisposeCount, 1 );
+                EXPECT_EQ( i.nDisposeCount, 1u );
             }
 
             // extract_max
             for ( auto idx : indices ) {
                 auto& i = data[idx];
                 i.nDisposeCount = 0;
-                ASSERT_TRUE( t.insert( i ) );
+                ASSERT_TRUE( t.insert( i ));
             }
 
             nCount = 0;
             nKey = static_cast<int>( data.size());
-            while ( !t.empty() ) {
+            while ( !t.empty()) {
                 xp = t.extract_max();
                 ASSERT_FALSE( !xp );
                 EXPECT_EQ( xp->key(), nKey - 1 );
@@ -210,14 +210,14 @@ namespace cds_test {
                 nKey = xp->key();
             }
             xp.release();
-            ASSERT_TRUE( t.empty() );
-            ASSERT_CONTAINER_SIZE( t, 0 );
-            EXPECT_EQ( nCount, data.size() );
+            ASSERT_TRUE( t.empty());
+            ASSERT_CONTAINER_SIZE( t, 0u );
+            EXPECT_EQ( nCount, data.size());
 
             // Force retiring cycle
             Tree::gc::force_dispose();
             for ( auto& i : data ) {
-                EXPECT_EQ( i.nDisposeCount, 1 );
+                EXPECT_EQ( i.nDisposeCount, 1u );
             }
         }
     };