[Libreoffice-commits] core.git: 3 commits - sal/osl sal/qa

Chris Sherlock chris.sherlock79 at gmail.com
Sat Jul 22 09:28:47 UTC 2017


 sal/osl/w32/conditn.cxx                |   20 --
 sal/qa/osl/condition/osl_Condition.cxx |  264 ++++++++++++++++-----------------
 2 files changed, 129 insertions(+), 155 deletions(-)

New commits:
commit f509b2830d21e8032647e6438054b2594fa2440f
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sat Jul 22 19:27:19 2017 +1000

    osl: get rid of comment cruft in w32 conditn.cxx
    
    Change-Id: I4ef57b561813c28dfbb2e930e4d972953b94f5ba

diff --git a/sal/osl/w32/conditn.cxx b/sal/osl/w32/conditn.cxx
index a6a54961764a..9807eaa95863 100644
--- a/sal/osl/w32/conditn.cxx
+++ b/sal/osl/w32/conditn.cxx
@@ -28,9 +28,6 @@
     as a WIN32 HANDLE (which is also a 32-bit value)
 */
 
-/*****************************************************************************/
-/* osl_createCondition */
-/*****************************************************************************/
 oslCondition SAL_CALL osl_createCondition(void)
 {
     oslCondition Condition;
@@ -44,20 +41,12 @@ oslCondition SAL_CALL osl_createCondition(void)
 
 }
 
-/*****************************************************************************/
-/* osl_destroyCondition */
-/*****************************************************************************/
 void SAL_CALL osl_destroyCondition(oslCondition Condition)
 {
     if(Condition)
-    {
         OSL_VERIFY(CloseHandle(Condition));
-    }
 }
 
-/*****************************************************************************/
-/* osl_setCondition */
-/*****************************************************************************/
 sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
 {
     OSL_ASSERT(Condition);
@@ -65,9 +54,6 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
     return SetEvent(reinterpret_cast<HANDLE>(Condition)) != FALSE;
 }
 
-/*****************************************************************************/
-/* osl_resetCondition */
-/*****************************************************************************/
 sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
 {
     OSL_ASSERT(Condition);
@@ -75,9 +61,6 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
     return ResetEvent(reinterpret_cast<HANDLE>(Condition)) != FALSE;
 }
 
-/*****************************************************************************/
-/* osl_waitCondition */
-/*****************************************************************************/
 oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition,
                                      const TimeValue* pTimeout)
 {
@@ -121,9 +104,6 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition,
     }
 }
 
-/*****************************************************************************/
-/* osl_checkCondition */
-/*****************************************************************************/
 sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition)
 {
     OSL_ASSERT(Condition);
commit 87c64c00286433201e44795128014cbf0966cff3
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sat Jul 22 19:24:27 2017 +1000

    osl: give condition tests more descriptive names
    
    Change-Id: Iac83de722e5c3ee350e1588940567fc67a79e045

diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx
index 326d19121c09..51fbe70e7d7e 100644
--- a/sal/qa/osl/condition/osl_Condition.cxx
+++ b/sal/qa/osl/condition/osl_Condition.cxx
@@ -67,29 +67,29 @@ namespace osl_Condition
     public:
         bool bRes, bRes1;
 
-        void ctors_001( )
+        void ctors_create()
         {
             ::osl::Condition aCond;
-            bRes = aCond.check( );
+            bRes = aCond.check();
 
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a condition its initial check state should be sal_False.",
-                                    !bRes );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: create a condition its initial check state should be sal_False.",
+                                   !bRes );
         }
 
-        void ctors_002( )
+        void ctors_createAndSet()
         {
             ::osl::Condition aCond;
-            aCond.set( );
-            bRes = aCond.check( );
+            aCond.set();
+            bRes = aCond.check();
 
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a condition and set it.",
-                                    bRes );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: create a condition and set it.",
+                                   bRes );
         }
 
-        CPPUNIT_TEST_SUITE( ctors );
-        CPPUNIT_TEST( ctors_001 );
-        CPPUNIT_TEST( ctors_002 );
-        CPPUNIT_TEST_SUITE_END( );
+        CPPUNIT_TEST_SUITE(ctors);
+        CPPUNIT_TEST(ctors_create);
+        CPPUNIT_TEST(ctors_createAndSet);
+        CPPUNIT_TEST_SUITE_END();
     };
 
     /** testing the method:
@@ -100,42 +100,42 @@ namespace osl_Condition
     public:
         bool bRes, bRes1, bRes2;
 
-        void set_001( )
+        void set_createAndSet()
         {
             ::osl::Condition aCond;
-            aCond.set( );
-            bRes = aCond.check( );
+            aCond.set();
+            bRes = aCond.check();
 
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: check state should be sal_True after set.",
-                                    bRes );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: check state should be sal_True after set.",
+                                   bRes );
         }
 
-        void set_002( )
+        void set_threadWaitRelease()
         {
             ::osl::Condition aCond;
-            ConditionThread myThread1( aCond, thread_type_wait );
+            ConditionThread myThread1(aCond, thread_type_wait);
             myThread1.create();
-            bRes = myThread1.isRunning( );
+            bRes = myThread1.isRunning();
 
-            ConditionThread myThread2( aCond, thread_type_set );
+            ConditionThread myThread2(aCond, thread_type_set);
             myThread2.create();
 
-            myThread1.join( );
-            bRes1 = myThread1.isRunning( );
-            bRes2 = aCond.check( );
-            myThread2.join( );
+            myThread1.join();
+            bRes1 = myThread1.isRunning();
+            bRes2 = aCond.check();
+            myThread2.join();
 
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: use one thread to set the condition in order to release another thread.",
+                                   bRes);
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: use one thread to set the condition in order to release another thread.",
+                                   !bRes1);
             CPPUNIT_ASSERT_MESSAGE( "#test comment#: use one thread to set the condition in order to release another thread.",
-                                    bRes );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: use one thread to set the condition in order to release another thread.",
-                                    !bRes1 );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: use one thread to set the condition in order to release another thread.",
-                                    bRes2 );
+                                   bRes2);
         }
 
-        CPPUNIT_TEST_SUITE( set );
-        CPPUNIT_TEST( set_001 );
-        CPPUNIT_TEST( set_002 );
+        CPPUNIT_TEST_SUITE(set);
+        CPPUNIT_TEST(set_createAndSet);
+        CPPUNIT_TEST(set_threadWaitRelease);
         CPPUNIT_TEST_SUITE_END( );
     };
 
@@ -147,46 +147,46 @@ namespace osl_Condition
     public:
         bool bRes, bRes1, bRes2;
 
-        void reset_001( )
+        void reset_resetWaitAndSet()
         {
             ::osl::Condition aCond;
-            aCond.reset( );
+            aCond.reset();
 
-            ConditionThread myThread( aCond, thread_type_wait );
+            ConditionThread myThread(aCond, thread_type_wait);
             myThread.create();
-            bRes = myThread.isRunning( );
-            bRes2 = aCond.check( );
-
-            aCond.set( );
-            myThread.join( );
-            bRes1 = myThread.isRunning( );
-
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: wait will cause a reset thread block, use set to release it.",
-                                    bRes );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: wait will cause a reset thread block, use set to release it.",
-                                    !bRes1 );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: wait will cause a reset thread block, use set to release it.",
-                                    !bRes2 );
+            bRes = myThread.isRunning();
+            bRes2 = aCond.check();
+
+            aCond.set();
+            myThread.join();
+            bRes1 = myThread.isRunning();
+
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: wait will cause a reset thread block, use set to release it.",
+                                   bRes);
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: wait will cause a reset thread block, use set to release it.",
+                                   !bRes1);
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: wait will cause a reset thread block, use set to release it.",
+                                   !bRes2);
         }
 
-        void reset_002( )
+        void reset_resetAndSet()
         {
             ::osl::Condition aCond;
-            aCond.reset( );
-            bRes = aCond.check( );
-            aCond.set( );
-            bRes1 = aCond.check( );
-
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a condition and reset/set it.",
-                                    !bRes );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: create a condition and reset/set it.",
-                                    bRes1 );
+            aCond.reset();
+            bRes = aCond.check();
+            aCond.set();
+            bRes1 = aCond.check();
+
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: create a condition and reset/set it.",
+                                   !bRes );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: create a condition and reset/set it.",
+                                   bRes1 );
         }
 
-        CPPUNIT_TEST_SUITE( reset );
-        CPPUNIT_TEST( reset_001 );
-        CPPUNIT_TEST( reset_002 );
-        CPPUNIT_TEST_SUITE_END( );
+        CPPUNIT_TEST_SUITE(reset);
+        CPPUNIT_TEST(reset_resetWaitAndSet);
+        CPPUNIT_TEST(reset_resetAndSet);
+        CPPUNIT_TEST_SUITE_END();
     };
 
     /** testing the method:
@@ -198,19 +198,19 @@ namespace osl_Condition
         bool bRes, bRes1, bRes2;
         TimeValue *tv1;
 
-        void setUp( ) override
+        void setUp() override
         {
             tv1 = new TimeValue;
             tv1->Seconds = 1;
             tv1->Nanosec = 0;
         }
 
-        void tearDown( ) override
+        void tearDown() override
         {
             delete tv1;
         }
 
-        void wait_001( )
+        void wait_testAllCombos( )
         {
             ::osl::Condition cond1;
             ::osl::Condition cond2;
@@ -231,33 +231,33 @@ namespace osl_Condition
                                     ::osl::Condition::result_timeout, r3 );
         }
 
-        void wait_002( )
+        void wait_timeoutWaits()
         {
             ::osl::Condition aCond;
             ::osl::Condition::Result wRes, wRes1;
 
-            aCond.reset( );
-            bRes = aCond.check( );
-            wRes = aCond.wait( tv1 );
-
-            aCond.set( );
-            wRes1 = aCond.wait( tv1 );
-            bRes1 = aCond.check( );
-
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: wait a condition after set/reset.",
-                                    !bRes );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: wait a condition after set/reset.",
-                                    bRes1 );
-            CPPUNIT_ASSERT_EQUAL_MESSAGE( "#test comment#: wait a condition after set/reset.",
-                                    ::osl::Condition::result_timeout, wRes );
-            CPPUNIT_ASSERT_EQUAL_MESSAGE( "#test comment#: wait a condition after set/reset.",
-                                    ::osl::Condition::result_ok, wRes1 );
+            aCond.reset();
+            bRes = aCond.check();
+            wRes = aCond.wait(tv1);
+
+            aCond.set();
+            wRes1 = aCond.wait(tv1);
+            bRes1 = aCond.check();
+
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: wait a condition after set/reset.",
+                                   !bRes );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: wait a condition after set/reset.",
+                                   bRes1 );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE("#test comment#: wait a condition after set/reset.",
+                                   ::osl::Condition::result_timeout, wRes );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE("#test comment#: wait a condition after set/reset.",
+                                   ::osl::Condition::result_ok, wRes1 );
         }
 
-        CPPUNIT_TEST_SUITE( wait );
-        CPPUNIT_TEST( wait_001 );
-        CPPUNIT_TEST( wait_002 );
-        CPPUNIT_TEST_SUITE_END( );
+        CPPUNIT_TEST_SUITE(wait);
+        CPPUNIT_TEST(wait_testAllCombos);
+        CPPUNIT_TEST(wait_timeoutWaits);
+        CPPUNIT_TEST_SUITE_END();
     };
 
     /** testing the method:
@@ -268,46 +268,46 @@ namespace osl_Condition
     public:
         bool bRes, bRes1, bRes2;
 
-        void check_001( )
+        void check_checkStates()
         {
             ::osl::Condition aCond;
 
-            aCond.reset( );
-            bRes = aCond.check( );
-            aCond.set( );
-            bRes1 = aCond.check( );
+            aCond.reset();
+            bRes = aCond.check();
+            aCond.set();
+            bRes1 = aCond.check();
 
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: check the condition states.",
-                                    !bRes );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: check the condition states.",
-                                    bRes1 );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: check the condition states.",
+                                   !bRes );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: check the condition states.",
+                                   bRes1 );
         }
 
-        void check_002( )
+        void check_threadedCheckStates( )
         {
             ::osl::Condition aCond;
-            aCond.reset( );
-
-            ConditionThread myThread( aCond, thread_type_set );
-            myThread.create( );
-            myThread.join( );
-            bRes = aCond.check( );
-
-            ConditionThread myThread1( aCond, thread_type_reset );
-            myThread1.create( );
-            myThread1.join( );
-            bRes1 = aCond.check( );
-
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: use threads to set/reset Condition and check it in main routine.",
-                                    bRes );
-            CPPUNIT_ASSERT_MESSAGE( "#test comment#: use threads to set/reset Condition and check it in main routine.",
-                                    !bRes1 );
+            aCond.reset();
+
+            ConditionThread myThread(aCond, thread_type_set);
+            myThread.create();
+            myThread.join();
+            bRes = aCond.check();
+
+            ConditionThread myThread1(aCond, thread_type_reset);
+            myThread1.create();
+            myThread1.join();
+            bRes1 = aCond.check();
+
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: use threads to set/reset Condition and check it in main routine.",
+                                   bRes );
+            CPPUNIT_ASSERT_MESSAGE("#test comment#: use threads to set/reset Condition and check it in main routine.",
+                                   !bRes1 );
         }
 
-        CPPUNIT_TEST_SUITE( check );
-        CPPUNIT_TEST( check_001 );
-        CPPUNIT_TEST( check_002 );
-        CPPUNIT_TEST_SUITE_END( );
+        CPPUNIT_TEST_SUITE(check);
+        CPPUNIT_TEST(check_checkStates);
+        CPPUNIT_TEST(check_threadedCheckStates);
+        CPPUNIT_TEST_SUITE_END();
     };
 
     CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::ctors);
commit 0b16b338de40ccb8c53282a2eb8c6cf7a95cc105
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sat Jul 22 18:53:12 2017 +1000

    osl: condition qa remove extraneous comments
    
    Change-Id: I2db888e3260543563d8c6ea5b0575e46e98df9d7

diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx
index 6d0245d2905b..326d19121c09 100644
--- a/sal/qa/osl/condition/osl_Condition.cxx
+++ b/sal/qa/osl/condition/osl_Condition.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-// include files
-
 #include <osl_Condition_Const.h>
 #include <stdlib.h>
 
@@ -59,11 +57,8 @@ protected:
     }
 };
 
-// test code start here
-
 namespace osl_Condition
 {
-
     /** testing the method:
         Condition()
     */
@@ -95,7 +90,7 @@ namespace osl_Condition
         CPPUNIT_TEST( ctors_001 );
         CPPUNIT_TEST( ctors_002 );
         CPPUNIT_TEST_SUITE_END( );
-    }; // class ctors
+    };
 
     /** testing the method:
         void set()
@@ -142,7 +137,7 @@ namespace osl_Condition
         CPPUNIT_TEST( set_001 );
         CPPUNIT_TEST( set_002 );
         CPPUNIT_TEST_SUITE_END( );
-    }; // class set
+    };
 
     /** testing the method:
         void reset()
@@ -192,7 +187,7 @@ namespace osl_Condition
         CPPUNIT_TEST( reset_001 );
         CPPUNIT_TEST( reset_002 );
         CPPUNIT_TEST_SUITE_END( );
-    }; // class reset
+    };
 
     /** testing the method:
         Result wait(const TimeValue *pTimeout = 0)
@@ -208,7 +203,6 @@ namespace osl_Condition
             tv1 = new TimeValue;
             tv1->Seconds = 1;
             tv1->Nanosec = 0;
-
         }
 
         void tearDown( ) override
@@ -264,7 +258,7 @@ namespace osl_Condition
         CPPUNIT_TEST( wait_001 );
         CPPUNIT_TEST( wait_002 );
         CPPUNIT_TEST_SUITE_END( );
-    }; // class wait
+    };
 
     /** testing the method:
         sal_Bool check()
@@ -314,13 +308,13 @@ namespace osl_Condition
         CPPUNIT_TEST( check_001 );
         CPPUNIT_TEST( check_002 );
         CPPUNIT_TEST_SUITE_END( );
-    }; // class check
+    };
 
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::ctors);
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::set);
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::reset);
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::wait);
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::check);
+    CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::ctors);
+    CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::set);
+    CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::reset);
+    CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::wait);
+    CPPUNIT_TEST_SUITE_REGISTRATION(osl_Condition::check);
 
 } // namespace osl_Condition
 


More information about the Libreoffice-commits mailing list