Added BMessenger::IsTargetLocal() test cases.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@263 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2002-07-16 23:34:40 +00:00
parent 8e4f7c25a8
commit 4f139d7754
3 changed files with 86 additions and 3 deletions
@@ -59,3 +59,16 @@ case 2: from is properly initialized to a local target =>
BMessenger(const char *signature, team_id team, status_t *result)
TODO
bool IsTargetLocal() const
case 1: this is uninitialized =>
should return false.
case 2: this is initialized to local target with preferred handler =>
should return true.
case 3: this is initialized to local target with specific handler =>
should return true.
case 4: this is initialized to local target with preferred handler =>
should return false.
case 5: this is initialized to remote target with specific handler =>
should return false.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

+68 -2
View File
@@ -29,9 +29,71 @@
//------------------------------------------------------------------------------
/*
bool IsTargetLocal() const
@case 1 this is uninitialized
@results should return false.
*/
void TargetTester::Test1()
void TargetTester::IsTargetLocalTest1()
{
BMessenger messenger;
CHK(messenger.IsTargetLocal() == false);
}
/*
bool IsTargetLocal() const
@case 2 this is initialized to local target with preferred handler
@results should return true.
*/
void TargetTester::IsTargetLocalTest2()
{
status_t result = B_OK;
BLooper *looper = new BLooper;
looper->Run();
LooperQuitter quitter(looper);
BMessenger messenger(NULL, looper, &result);
CHK(messenger.IsTargetLocal() == true);
}
/*
bool IsTargetLocal() const
@case 3 this is initialized to local target with specific handler
@results should return true.
*/
void TargetTester::IsTargetLocalTest3()
{
// create looper and handler
status_t result = B_OK;
BLooper *looper = new BLooper;
looper->Run();
LooperQuitter quitter(looper);
BHandler *handler = new BHandler;
HandlerDeleter deleter(handler);
CHK(looper->Lock());
looper->AddHandler(handler);
looper->Unlock();
// create the messenger and do the checks
BMessenger messenger(handler, NULL, &result);
CHK(messenger.IsTargetLocal() == true);
}
/*
bool IsTargetLocal() const
@case 4 this is initialized to remote target with preferred handler
@results should return false.
*/
void TargetTester::IsTargetLocalTest4()
{
// TODO: Implement.
}
/*
bool IsTargetLocal() const
@case 5 this is initialized to remote target with specific handler
@results should return false.
*/
void TargetTester::IsTargetLocalTest5()
{
// TODO: Implement.
}
@@ -39,7 +101,11 @@ Test* TargetTester::Suite()
{
TestSuite* SuiteOfTests = new TestSuite;
ADD_TEST(SuiteOfTests, TargetTester, Test1);
ADD_TEST(SuiteOfTests, TargetTester, IsTargetLocalTest1);
ADD_TEST(SuiteOfTests, TargetTester, IsTargetLocalTest2);
ADD_TEST(SuiteOfTests, TargetTester, IsTargetLocalTest3);
ADD_TEST(SuiteOfTests, TargetTester, IsTargetLocalTest4);
ADD_TEST(SuiteOfTests, TargetTester, IsTargetLocalTest5);
return SuiteOfTests;
}
+5 -1
View File
@@ -25,7 +25,11 @@ class TargetTester : public TestCase
TargetTester() {;}
TargetTester(std::string name) : TestCase(name) {;}
void Test1();
void IsTargetLocalTest1();
void IsTargetLocalTest2();
void IsTargetLocalTest3();
void IsTargetLocalTest4();
void IsTargetLocalTest5();
static Test* Suite();
};