Removed redundant spaces
[libcds.git] / test / stress / stack / intrusive_stack_push_pop.h
index 58538e172148507d6103ba701feb9b43a6c7f1b4..4a2c33a2444fb56a440a1a49154430cca356ea1c 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 "intrusive_stack_type.h"
@@ -107,14 +107,14 @@ namespace cds_test {
             virtual void test()
             {
                 m_nPushError = 0;
-                memset( m_arrPush, 0, sizeof( m_arrPush ) );
+                memset( m_arrPush, 0, sizeof( m_arrPush ));
 
                 size_t i = 0;
                 for ( typename Stack::value_type * p = m_pStart; p < m_pEnd; ++p, ++i ) {
                     p->nProducer = id();
                     size_t no;
                     p->nNo.store( no = i % c_nValArraySize, atomics::memory_order_release );
-                    if ( m_Stack.push( *p ) )
+                    if ( m_Stack.push( *p ))
                         ++m_arrPush[no];
                     else
                         ++m_nPushError;
@@ -161,15 +161,15 @@ namespace cds_test {
                 m_nPopEmpty = 0;
                 m_nPopCount = 0;
                 m_nDirtyPop = 0;
-                memset( m_arrPop, 0, sizeof( m_arrPop ) );
+                memset( m_arrPop, 0, sizeof( m_arrPop ));
 
-                while ( !(s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_Stack.empty()) ) {
+                while ( !(s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_Stack.empty())) {
                     typename Stack::value_type * p = m_Stack.pop();
                     if ( p ) {
                         p->nConsumer = id();
                         ++m_nPopCount;
                         size_t no = p->nNo.load( atomics::memory_order_acquire );
-                        if ( no < sizeof( m_arrPop ) / sizeof( m_arrPop[0] ) )
+                        if ( no < sizeof( m_arrPop ) / sizeof( m_arrPop[0] ))
                             ++m_arrPop[no];
                         else
                             ++m_nDirtyPop;
@@ -193,12 +193,13 @@ namespace cds_test {
             T * get() const { return m_pArr.get(); }
         };
 
-    protected:
+    public:
         static void SetUpTestCase();
         //static void TearDownTestCase();
 
+    protected:
         template <class Stack>
-        void analyze( Stack& stack )
+        void analyze( Stack& /*stack*/ )
         {
             cds_test::thread_pool& pool = get_pool();
 
@@ -206,7 +207,7 @@ namespace cds_test {
             size_t nPopEmpty = 0;
             size_t nPopCount = 0;
             size_t arrVal[c_nValArraySize];
-            memset( arrVal, 0, sizeof( arrVal ) );
+            memset( arrVal, 0, sizeof( arrVal ));
             size_t nDirtyPop = 0;
 
             for ( size_t threadNo = 0; threadNo < pool.size(); ++threadNo ) {
@@ -229,11 +230,11 @@ namespace cds_test {
             }
 
             EXPECT_EQ( nPopCount, s_nStackSize );
-            EXPECT_EQ( nDirtyPop, 0 );
-            EXPECT_EQ( nPushError, 0 );
+            EXPECT_EQ( nDirtyPop, 0u );
+            EXPECT_EQ( nPushError, 0u );
 
             for ( size_t i = 0; i < sizeof( arrVal ) / sizeof( arrVal[0] ); ++i ) {
-                EXPECT_EQ( arrVal[i], 0 ) << "i=" << i;
+                EXPECT_EQ( arrVal[i], 0u ) << "i=" << i;
             }
 
             propout() << std::make_pair( "push_count", s_nStackSize )
@@ -241,7 +242,7 @@ namespace cds_test {
                 << std::make_pair( "pop_count", nPopCount )
                 << std::make_pair( "pop_empty", nPopEmpty )
                 << std::make_pair( "dirty_pop", nDirtyPop )
-                ;
+;
 
         }
 
@@ -273,7 +274,7 @@ namespace cds_test {
             propout() << std::make_pair( "producer_thread_count", s_nPushThreadCount )
                 << std::make_pair( "consumer_thread_count", s_nPopThreadCount )
                 << std::make_pair( "push_count", nPushCount * s_nPushThreadCount )
-                ;
+;
 
             std::chrono::milliseconds duration = pool.run();
 
@@ -293,4 +294,4 @@ namespace cds_test {
             propout() << stack.statistics();
         }
     };
-} // namespace cds_test
\ No newline at end of file
+} // namespace cds_test