Fixed minor gcc warnings
[libcds.git] / test / stress / queue / push_pop.cpp
index 5720172d5dc24a57b5a65822e42c5b28fd096b28..52ac53da8798ae83af60cb29038aa7be947a785d 100644 (file)
@@ -5,7 +5,7 @@
 
     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.
 */
 
 #include "queue_type.h"
@@ -174,10 +174,9 @@ namespace {
                         else
                             ++m_nBadWriter;
                     }
-                    else
+                    else {
                         ++m_nPopEmpty;
 
-                    if ( m_Queue.empty() ) {
                         if ( s_nProducerDone.load() >= nTotalWriters ) {
                             if ( m_Queue.empty() )
                                 break;
@@ -220,7 +219,7 @@ namespace {
                     nTotalPops += consumer.m_nPopped;
                     nPopFalse += consumer.m_nPopEmpty;
                     arrConsumer.push_back( &consumer );
-                    EXPECT_EQ( consumer.m_nBadWriter, 0 ) << "consumer_thread_no " << i;
+                    EXPECT_EQ( consumer.m_nBadWriter, 0u ) << "consumer_thread_no " << i;
 
                     size_t nPopped = 0;
                     for ( size_t n = 0; n < s_nProducerThreadCount; ++n )
@@ -233,7 +232,7 @@ namespace {
 
                     Producer& producer = static_cast<Producer&>( thr );
                     nPushFailed += producer.m_nPushFailed;
-                    EXPECT_EQ( producer.m_nPushFailed, 0 ) << "producer_thread_no " << i;
+                    EXPECT_EQ( producer.m_nPushFailed, 0u ) << "producer_thread_no " << i;
                 }
             }
             EXPECT_EQ( nTotalPops, nPoppedItems );
@@ -300,23 +299,23 @@ namespace {
         }
 
     public:
-        static void SetUpTestCase()\r
-        {\r
-            cds_test::config const& cfg = get_config( "queue_push_pop" );\r
-\r
+        static void SetUpTestCase()
+        {
+            cds_test::config const& cfg = get_config( "queue_push_pop" );
+
             s_nConsumerThreadCount = cfg.get_size_t( "ConsumerCount", s_nConsumerThreadCount );
             s_nProducerThreadCount = cfg.get_size_t( "ProducerCount", s_nProducerThreadCount );
             s_nQueueSize = cfg.get_size_t( "QueueSize", s_nQueueSize );
 
-            if ( s_nConsumerThreadCount == 0 )
+            if ( s_nConsumerThreadCount == 0u )
                 s_nConsumerThreadCount = 1;
-            if ( s_nProducerThreadCount == 0 )
+            if ( s_nProducerThreadCount == 0u )
                 s_nProducerThreadCount = 1;
-            if ( s_nQueueSize == 0 )
+            if ( s_nQueueSize == 0u )
                 s_nQueueSize = 1000;
-        }\r
-\r
-        //static void TearDownTestCase();\r
+        }
+
+        //static void TearDownTestCase();
     };
 
     CDSSTRESS_MSQueue( queue_push_pop )
@@ -329,9 +328,10 @@ namespace {
     CDSSTRESS_StdQueue( queue_push_pop )
 
 #undef CDSSTRESS_Queue_F
-#define CDSSTRESS_Queue_F( test_fixture, type_name ) \
+#define CDSSTRESS_Queue_F( test_fixture, type_name, level ) \
     TEST_F( test_fixture, type_name ) \
     { \
+        if ( !check_detail_level( level )) return; \
         typedef queue::Types< value_type >::type_name queue_type; \
         queue_type queue( s_nQueueSize ); \
         test( queue ); \
@@ -389,9 +389,10 @@ namespace {
         }
     };
 
-#define CDSSTRESS_Queue_F( test_fixture, type_name ) \
+#define CDSSTRESS_Queue_F( test_fixture, type_name, level ) \
     TEST_P( test_fixture, type_name ) \
     { \
+        if ( !check_detail_level( level )) return; \
         typedef typename queue::Types<value_type>::type_name queue_type; \
         test< queue_type >(); \
     }