1//------------------------------------------------------------------------------ 2// LooperForThreadTest.cpp 3// 4//------------------------------------------------------------------------------ 5 6// Standard Includes ----------------------------------------------------------- 7 8// System Includes ------------------------------------------------------------- 9#include <Looper.h> 10 11// Project Includes ------------------------------------------------------------ 12 13// Local Includes -------------------------------------------------------------- 14#include "LooperForThreadTest.h" 15 16// Local Defines --------------------------------------------------------------- 17 18// Globals --------------------------------------------------------------------- 19 20//------------------------------------------------------------------------------ 21/** 22 LooperForThread(thread_id) 23 @case tid is valid 24 */ 25void TLooperForThreadTest::LooperForThreadTest1() 26{ 27 BLooper* Looper = new BLooper; 28 thread_id tid = Looper->Run(); 29 CPPUNIT_ASSERT(Looper == BLooper::LooperForThread(tid)); 30 Looper->Lock(); 31 Looper->Quit(); 32} 33//------------------------------------------------------------------------------ 34/** 35 LooperForThread(thread_id) 36 @case tid is not valid 37 */ 38void TLooperForThreadTest::LooperForThreadTest2() 39{ 40 CPPUNIT_ASSERT(BLooper::LooperForThread(find_thread(NULL)) == NULL); 41} 42//------------------------------------------------------------------------------ 43#ifdef ADD_TEST 44#undef ADD_TEST 45#endif 46#define ADD_TEST(__test_name__) \ 47 ADD_TEST4(BLooper, suite, TLooperForThreadTest, __test_name__) 48TestSuite* TLooperForThreadTest::Suite() 49{ 50 TestSuite* suite = new TestSuite("BLooper::LooperForTest(thread_id)"); 51 52 ADD_TEST(LooperForThreadTest1); 53 ADD_TEST(LooperForThreadTest2); 54 55 return suite; 56} 57//------------------------------------------------------------------------------ 58 59/* 60 * $Log $ 61 * 62 * $Id $ 63 * 64 */ 65 66