X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=blobdiff_plain;f=test%2Fstress%2Fqueue%2Fpush.cpp;h=398ca66b197631ba53e1d9ec31310c5093461a2e;hp=fc205b93f2461dc2e89184a9ca7a1b416d98a506;hb=HEAD;hpb=0562a3d00f16e24ad7e30e3137663b153322a4ca diff --git a/test/stress/queue/push.cpp b/test/stress/queue/push.cpp index fc205b93..398ca66b 100644 --- a/test/stress/queue/push.cpp +++ b/test/stress/queue/push.cpp @@ -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,10 +25,11 @@ 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. */ #include "queue_type.h" +#include "../misc/common.h" // Multi-threaded queue test for push operation namespace { @@ -43,12 +44,12 @@ namespace { { size_t nNo; - value_type() - : nNo( 0 ) + value_type() + : nNo( 0 ) {} - value_type( size_t n ) - : nNo( n ) + value_type( size_t n ) + : nNo( n ) {} }; @@ -95,20 +96,20 @@ namespace { }; public: - static void SetUpTestCase() - { - cds_test::config const& cfg = get_config( "queue_push" ); - + static void SetUpTestCase() + { + cds_test::config const& cfg = get_config( "queue_push" ); + s_nThreadCount = cfg.get_size_t( "ThreadCount", s_nThreadCount ); s_nQueueSize = cfg.get_size_t( "QueueSize", s_nQueueSize ); - if ( s_nThreadCount == 0 ) + if ( s_nThreadCount == 0u ) s_nThreadCount = 1; - if ( s_nQueueSize == 0 ) + if ( s_nQueueSize == 0u ) s_nQueueSize = 1000; - } - - //static void TearDownTestCase(); + } + + //static void TearDownTestCase(); protected: template @@ -135,7 +136,7 @@ namespace { propout() << std::make_pair( "duration", duration ); - analyze( q ); + DEBUG(analyze( q )); propout() << q.statistics(); } @@ -148,9 +149,9 @@ namespace { for ( size_t i = 0; i < pool.size(); ++i ) { Producer& thread = static_cast&>(pool.get( i )); - EXPECT_EQ( thread.m_nPushError, 0 ) << " producer thread " << i; + EXPECT_EQ( thread.m_nPushError, 0u ) << " producer thread " << i; } - EXPECT_TRUE( !q.empty() ); + EXPECT_TRUE( !q.empty()); std::unique_ptr< uint8_t[] > arr( new uint8_t[s_nQueueSize] ); memset( arr.get(), 0, sizeof(arr[0]) * s_nQueueSize ); @@ -173,10 +174,7 @@ namespace { CDSSTRESS_MoirQueue( queue_push ) CDSSTRESS_BasketQueue( queue_push ) CDSSTRESS_OptimsticQueue( queue_push ) - CDSSTRESS_FCQueue( queue_push ) - CDSSTRESS_FCDeque( queue_push ) CDSSTRESS_RWQueue( queue_push ) - CDSSTRESS_StdQueue( queue_push ) #undef CDSSTRESS_Queue_F #define CDSSTRESS_Queue_F( test_fixture, type_name ) \ @@ -187,7 +185,6 @@ namespace { test( queue ); \ } - CDSSTRESS_TsigasQueue( queue_push ) CDSSTRESS_VyukovQueue( queue_push ) #undef CDSSTRESS_Queue_F @@ -245,8 +242,19 @@ namespace { CDSSTRESS_SegmentedQueue( segmented_queue_push ) +#ifdef CDSTEST_GTEST_INSTANTIATE_TEST_CASE_P_HAS_4TH_ARG + static std::string get_test_parameter_name( testing::TestParamInfo const& p ) + { + return std::to_string( p.param ); + } INSTANTIATE_TEST_CASE_P( SQ, segmented_queue_push, - ::testing::ValuesIn( segmented_queue_push::get_test_parameters())); + ::testing::ValuesIn( segmented_queue_push::get_test_parameters()), get_test_parameter_name ); +#else + INSTANTIATE_TEST_CASE_P( SQ, + segmented_queue_push, + ::testing::ValuesIn( segmented_queue_push::get_test_parameters())); +#endif + } // namespace