formatting
[libcds.git] / test / stress / queue / intrusive_push_pop.cpp
index 1429d99631760d18a5c2d1596d95b3939d054e5a..2db3c5396d750903635b1750ab1eda2f3f320d17 100644 (file)
@@ -1,7 +1,7 @@
 /*
     This file is a part of libcds - Concurrent Data Structures library
 
 /*
     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/
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
@@ -175,7 +175,7 @@ namespace {
                     }
                     else {
                         ++m_nPopEmpty;
                     }
                     else {
                         ++m_nPopEmpty;
-                        if ( s_nProducerCount.load( atomics::memory_order_acquire ) == 0 && m_Queue.empty() )
+                        if ( s_nProducerCount.load( atomics::memory_order_acquire ) == 0 && m_Queue.empty())
                             break;
                     }
                 }
                             break;
                     }
                 }
@@ -221,11 +221,10 @@ namespace {
         void analyze( Queue& testQueue, size_t /*nLeftOffset*/, size_t nRightOffset )
         {
             typedef Consumer<Queue> Reader;
         void analyze( Queue& testQueue, size_t /*nLeftOffset*/, size_t nRightOffset )
         {
             typedef Consumer<Queue> Reader;
-            typedef Producer<Queue> Writer;
             typedef typename Reader::const_data_iterator    ReaderIterator;
 
             size_t nPostTestPops = 0;
             typedef typename Reader::const_data_iterator    ReaderIterator;
 
             size_t nPostTestPops = 0;
-            while ( testQueue.pop() )
+            while ( testQueue.pop())
                 ++nPostTestPops;
 
             size_t nTotalPops = 0;
                 ++nPostTestPops;
 
             size_t nTotalPops = 0;
@@ -272,7 +271,7 @@ namespace {
 
             size_t nQueueSize = s_nThreadPushCount * s_nWriterThreadCount;
             EXPECT_EQ( nTotalPops + nPostTestPops, nQueueSize );
 
             size_t nQueueSize = s_nThreadPushCount * s_nWriterThreadCount;
             EXPECT_EQ( nTotalPops + nPostTestPops, nQueueSize );
-            EXPECT_TRUE( testQueue.empty() );
+            EXPECT_TRUE( testQueue.empty());
 
             // Test that all items have been popped
             // Test FIFO order
 
             // Test that all items have been popped
             // Test FIFO order
@@ -294,7 +293,7 @@ namespace {
                     for ( it = arrReaders[nReader]->m_WriterData[nWriter].begin(); it != itEnd; ++it )
                         arrData.push_back( *it );
                 }
                     for ( it = arrReaders[nReader]->m_WriterData[nWriter].begin(); it != itEnd; ++it )
                         arrData.push_back( *it );
                 }
-                std::sort( arrData.begin(), arrData.end() );
+                std::sort( arrData.begin(), arrData.end());
                 for ( size_t i=1; i < arrData.size(); ++i ) {
                     if ( arrData[i-1] + 1 != arrData[i] ) {
                         EXPECT_EQ( arrData[i-1] + 1,  arrData[i] ) << "Writer " << nWriter << ": [" << (i-1) << "]=" << arrData[i-1]
                 for ( size_t i=1; i < arrData.size(); ++i ) {
                     if ( arrData[i-1] + 1 != arrData[i] ) {
                         EXPECT_EQ( arrData[i-1] + 1,  arrData[i] ) << "Writer " << nWriter << ": [" << (i-1) << "]=" << arrData[i-1]
@@ -437,8 +436,6 @@ namespace {
         test( q, arrValue, 0, 0 ); \
     }
 
         test( q, arrValue, 0, 0 ); \
     }
 
-    CDSSTRESS_QUEUE_F( TsigasCycleQueue_dyn )
-    CDSSTRESS_QUEUE_F( TsigasCycleQueue_dyn_ic )
     CDSSTRESS_QUEUE_F( VyukovMPMCCycleQueue_dyn )
     CDSSTRESS_QUEUE_F( VyukovMPMCCycleQueue_dyn_ic )
 #undef CDSSTRESS_QUEUE_F
     CDSSTRESS_QUEUE_F( VyukovMPMCCycleQueue_dyn )
     CDSSTRESS_QUEUE_F( VyukovMPMCCycleQueue_dyn_ic )
 #undef CDSSTRESS_QUEUE_F
@@ -512,8 +509,21 @@ namespace {
     //CDSSTRESS_QUEUE_F( SegmentedQueue_DHP_mutex_padding )
     CDSSTRESS_QUEUE_F( SegmentedQueue_DHP_mutex_stat )
 
     //CDSSTRESS_QUEUE_F( SegmentedQueue_DHP_mutex_padding )
     CDSSTRESS_QUEUE_F( SegmentedQueue_DHP_mutex_stat )
 
+
+#ifdef CDSTEST_GTEST_INSTANTIATE_TEST_CASE_P_HAS_4TH_ARG
+    static std::string get_test_parameter_name( testing::TestParamInfo<size_t> const& p )
+    {
+        return std::to_string( p.param );
+    }
+
     INSTANTIATE_TEST_CASE_P( SQ,
         intrusive_segmented_queue_push_pop,
     INSTANTIATE_TEST_CASE_P( SQ,
         intrusive_segmented_queue_push_pop,
-        ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters() ) );
+        ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters()), get_test_parameter_name );
+#else
+    INSTANTIATE_TEST_CASE_P( SQ,
+        intrusive_segmented_queue_push_pop,
+        ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters()));
+#endif
+
 
 } // namespace
 
 } // namespace