1 //------------------------------------------------------------------------------ 2 // IsWatchedTest.cpp 3 // 4 //------------------------------------------------------------------------------ 5 6 // Standard Includes ----------------------------------------------------------- 7 8 // System Includes ------------------------------------------------------------- 9 10 // Project Includes ------------------------------------------------------------ 11 12 // Local Includes -------------------------------------------------------------- 13 #include "IsWatchedTest.h" 14 15 // Local Defines --------------------------------------------------------------- 16 17 // Globals --------------------------------------------------------------------- 18 19 //------------------------------------------------------------------------------ 20 /** 21 IsWatched() 22 @case No added watchers 23 @results Returns false 24 */ 25 void TIsWatchedTest::IsWatched1() 26 { 27 CPPUNIT_ASSERT(!fHandler.IsWatched()); 28 } 29 //------------------------------------------------------------------------------ 30 /** 31 IsWatched() 32 @case Add then remove watcher 33 @results Returns true after add, returns false after remove 34 @note Original implementation fails this test. Either the removal 35 doesn't happen (unlikely) or some list-within-a-list doesn't 36 get removed when there's nothing in it anymore. 37 */ 38 void TIsWatchedTest::IsWatched2() 39 { 40 BHandler Watcher; 41 fHandler.StartWatching(&Watcher, '1234'); 42 CPPUNIT_ASSERT(fHandler.IsWatched() == true); 43 44 fHandler.StopWatching(&Watcher, '1234'); 45 #ifndef TEST_R5 46 CPPUNIT_ASSERT(fHandler.IsWatched() == false); 47 #endif 48 } 49 //------------------------------------------------------------------------------ 50 Test* TIsWatchedTest::Suite() 51 { 52 TestSuite* SuiteOfTests = new TestSuite("BHandler::IsWatched"); 53 54 ADD_TEST4(BHandler, SuiteOfTests, TIsWatchedTest, IsWatched1); 55 ADD_TEST4(BHandler, SuiteOfTests, TIsWatchedTest, IsWatched2); 56 57 return SuiteOfTests; 58 } 59 //------------------------------------------------------------------------------ 60 61 /* 62 * $Log $ 63 * 64 * $Id $ 65 * 66 */ 67 68 69