diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-07-22 19:24:27 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-07-22 19:27:51 +1000 |
commit | 87c64c00286433201e44795128014cbf0966cff3 (patch) | |
tree | b17732e89563f7076d237730c2128ffcc149a276 /sal/qa | |
parent | 0b16b338de40ccb8c53282a2eb8c6cf7a95cc105 (diff) |
osl: give condition tests more descriptive names
Change-Id: Iac83de722e5c3ee350e1588940567fc67a79e045
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/osl/condition/osl_Condition.cxx | 236 |
1 files changed, 118 insertions, 118 deletions
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); |