Updated copyright
[libcds.git] / test / stress / set / iteration / set_iteration.h
index 5cb8d1e86301a5f81f8bb63437923eb97a3e88dc..2be247d3349d562b4867ca9eba1059c25294b18b 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:
 
@@ -403,13 +403,17 @@ namespace set {
                 Set& rSet = m_Set;
 
                 Set_Iteration& fixture = pool().template fixture<Set_Iteration>();
-                while ( !fixture.all_modifiers_done() ) {
+                while ( !fixture.all_modifiers_done()) {
                     ++m_nPassCount;
                     typename Set::iterator it;
                     typename Set::iterator itEnd;
                     itEnd = rSet.end();
                     for ( it = rSet.begin(); it != itEnd; ++it ) {
+#if CDS_BUILD_BITS == 64
                         it->val.hash = CityHash64( it->key.c_str(), it->key.length());
+#else
+                        it->val.hash = std::hash<std::string>()( it->key );
+#endif
                         ++m_nVisitCount;
                     }
                 }
@@ -449,11 +453,15 @@ namespace set {
                 Set& rSet = m_Set;
 
                 Set_Iteration& fixture = pool().template fixture<Set_Iteration>();
-                while ( !fixture.all_modifiers_done() ) {
+                while ( !fixture.all_modifiers_done()) {
                     ++m_nPassCount;
                     typename Set::rcu_lock l;
                     for ( auto it = rSet.begin(); it != rSet.end(); ++it ) {
-                        it->val.hash = CityHash64( it->key.c_str(), it->key.length() );
+#if CDS_BUILD_BITS == 64
+                        it->val.hash = CityHash64( it->key.c_str(), it->key.length());
+#else
+                        it->val.hash = std::hash<std::string>()(it->key);
+#endif
                         ++m_nVisitCount;
                     }
                 }
@@ -492,7 +500,7 @@ namespace set {
             size_t nIteratorVisitCount = 0;
             for ( size_t i = 0; i < pool.size(); ++i ) {
                 cds_test::thread& thr = pool.get( i );
-                switch ( thr.type() ) {
+                switch ( thr.type()) {
                 case insert_thread:
                     {
                         InserterThread& inserter = static_cast<InserterThread&>( thr );
@@ -526,10 +534,10 @@ namespace set {
                 << std::make_pair( "delete_failed", nDeleteFailed )
                 << std::make_pair( "iterator_pass_count", nIteratorPassCount )
                 << std::make_pair( "iterator_visit_count", nIteratorVisitCount )
-                << std::make_pair( "final_set_size", testSet.size() );
+                << std::make_pair( "final_set_size", testSet.size());
 
             testSet.clear();
-            EXPECT_TRUE( testSet.empty() );
+            EXPECT_TRUE( testSet.empty());
 
             additional_check( testSet );
             print_stat( propout(), testSet );
@@ -575,7 +583,7 @@ namespace set {
             size_t nIteratorVisitCount = 0;
             for ( size_t i = 0; i < pool.size(); ++i ) {
                 cds_test::thread& thr = pool.get( i );
-                switch ( thr.type() ) {
+                switch ( thr.type()) {
                 case insert_thread:
                     {
                         InserterThread& inserter = static_cast<InserterThread&>(thr);
@@ -618,10 +626,10 @@ namespace set {
                 << std::make_pair( "extract_failed", nExtractFailed )
                 << std::make_pair( "iterator_pass_count", nIteratorPassCount )
                 << std::make_pair( "iterator_visit_count", nIteratorVisitCount )
-                << std::make_pair( "final_set_size", testSet.size() );
+                << std::make_pair( "final_set_size", testSet.size());
 
             testSet.clear();
-            EXPECT_TRUE( testSet.empty() );
+            EXPECT_TRUE( testSet.empty());
 
             additional_check( testSet );
             print_stat( propout(), testSet );