Added tests for BMessenger::LockTargetWithTimeout(), the assignment operator and the comparisson operators == and !=. < has still to be done.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@342 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,6 +13,9 @@ CommonTestLib libapptest.so
|
|||||||
MessengerTest.cpp
|
MessengerTest.cpp
|
||||||
BMessengerTester.cpp
|
BMessengerTester.cpp
|
||||||
LockTargetTester.cpp
|
LockTargetTester.cpp
|
||||||
|
LockTargetWithTimeoutTester.cpp
|
||||||
|
MessengerAssignmentTester.cpp
|
||||||
|
MessengerComparissonTester.cpp
|
||||||
TargetTester.cpp
|
TargetTester.cpp
|
||||||
|
|
||||||
: <boot!home!config!lib>libopenbeos.so
|
: <boot!home!config!lib>libopenbeos.so
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ case 4: this is initialized to remote target with preferred handler,
|
|||||||
case 5: this is initialized to remote target with specific handler,
|
case 5: this is initialized to remote target with specific handler,
|
||||||
looper is NULL =>
|
looper is NULL =>
|
||||||
should return NULL.
|
should return NULL.
|
||||||
other cases in included in BMessenger(...)
|
other cases included in BMessenger(...) cases
|
||||||
|
|
||||||
bool LockTarget() const
|
bool LockTarget() const
|
||||||
case 1: this is uninitialized =>
|
case 1: this is uninitialized =>
|
||||||
@@ -111,3 +111,74 @@ case 7: this is initialized to remote target with specific handler,
|
|||||||
should not lock the looper and return false.
|
should not lock the looper and return false.
|
||||||
|
|
||||||
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
case 1: this is uninitialized =>
|
||||||
|
should return B_BAD_VALUE.
|
||||||
|
case 2: this is initialized to local target with preferred handler,
|
||||||
|
looper is not locked =>
|
||||||
|
should lock the looper and return B_OK.
|
||||||
|
case 3: this is initialized to local target with specific handler,
|
||||||
|
looper is not locked =>
|
||||||
|
should lock the looper and return B_OK.
|
||||||
|
case 4: this is initialized to local target with preferred handler,
|
||||||
|
looper is locked by another thread, timeout is 100ms =>
|
||||||
|
should block until the looper is unlocked (after 50ms), lock it
|
||||||
|
and return B_OK.
|
||||||
|
case 5: this is initialized to local target with preferred handler,
|
||||||
|
looper is locked by another thread, timeout is 25ms =>
|
||||||
|
should block for 25ms, not until the looper is unlocked (after 50ms),
|
||||||
|
should return B_TIMED_OUT.
|
||||||
|
case 6: this is initialized to local target with specific handler,
|
||||||
|
looper is locked by another thread, timeout is 100ms =>
|
||||||
|
should block until the looper is unlocked (after 50ms), lock it
|
||||||
|
and return B_OK.
|
||||||
|
case 7: this is initialized to local target with specific handler,
|
||||||
|
looper is locked by another thread, timeout is 25ms =>
|
||||||
|
should block for 25ms, not until the looper is unlocked (after 50ms),
|
||||||
|
should return B_TIMED_OUT.
|
||||||
|
case 8: this is initialized to remote target with preferred handler,
|
||||||
|
looper is not locked =>
|
||||||
|
should not lock the looper and return B_BAD_VALUE.
|
||||||
|
case 9: this is initialized to remote target with specific handler,
|
||||||
|
looper is not locked =>
|
||||||
|
should not lock the looper and return B_BAD_VALUE.
|
||||||
|
|
||||||
|
bool IsValid() const
|
||||||
|
included in BMessenger(...) cases
|
||||||
|
|
||||||
|
team_id Team() const
|
||||||
|
included in BMessenger(...) cases
|
||||||
|
|
||||||
|
BMessenger &operator=(const BMessenger &from)
|
||||||
|
case 1: from is uninitialized =>
|
||||||
|
IsValid() and IsTargetLocal() should return false
|
||||||
|
Target() should return NULL and NULL for looper.
|
||||||
|
Team() should return -1.
|
||||||
|
case 2: from is properly initialized to a local target (preferred handler) =>
|
||||||
|
IsValid() and IsTargetLocal() should return true
|
||||||
|
Target() should return the same values as for from.
|
||||||
|
Team() should return this team.
|
||||||
|
case 3: from is properly initialized to a local target (specific handler) =>
|
||||||
|
IsValid() and IsTargetLocal() should return true
|
||||||
|
Target() should return the same values as for from.
|
||||||
|
Team() should return this team.
|
||||||
|
|
||||||
|
bool operator==(const BMessenger &other) const
|
||||||
|
case 1: this and other are uninitialized =>
|
||||||
|
should return true.
|
||||||
|
case 2: this is initialized, other is uninitialized, and vice versa =>
|
||||||
|
should return false.
|
||||||
|
case 3: this and other are initialized, different cases:
|
||||||
|
- same object => true
|
||||||
|
- different objects same target => true
|
||||||
|
- looper preferred handler vs. same looper but the looper itself as
|
||||||
|
handler => false
|
||||||
|
- looper preferred handler vs. other looper preferred handler => false
|
||||||
|
- looper preferred handler vs. other looper specific handler => false
|
||||||
|
- local looper vs. remote looper => false
|
||||||
|
|
||||||
|
bool operator!=(const BMessenger &a, const BMessenger &b)
|
||||||
|
included in == cases
|
||||||
|
|
||||||
|
bool operator<(const BMessenger &a, const BMessenger &b)
|
||||||
|
TODO
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 7.5 KiB |
@@ -0,0 +1,384 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// LockTargetWithTimeoutTester.cpp
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Standard Includes -----------------------------------------------------------
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// System Includes -------------------------------------------------------------
|
||||||
|
#include <be/app/Message.h>
|
||||||
|
#include <be/kernel/OS.h>
|
||||||
|
|
||||||
|
#include <Handler.h>
|
||||||
|
#include <Looper.h>
|
||||||
|
#include <Messenger.h>
|
||||||
|
|
||||||
|
// Project Includes ------------------------------------------------------------
|
||||||
|
#include <TestUtils.h>
|
||||||
|
#include <ThreadedTestCaller.h>
|
||||||
|
#include <cppunit/TestSuite.h>
|
||||||
|
|
||||||
|
// Local Includes --------------------------------------------------------------
|
||||||
|
#include "Helpers.h"
|
||||||
|
#include "LockTargetWithTimeoutTester.h"
|
||||||
|
|
||||||
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
|
||||||
|
// Globals ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
LockTargetWithTimeoutTester::LockTargetWithTimeoutTester()
|
||||||
|
: BThreadedTestCase(),
|
||||||
|
fHandler(NULL),
|
||||||
|
fLooper(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
LockTargetWithTimeoutTester::LockTargetWithTimeoutTester(std::string name)
|
||||||
|
: BThreadedTestCase(name),
|
||||||
|
fHandler(NULL),
|
||||||
|
fLooper(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
LockTargetWithTimeoutTester::~LockTargetWithTimeoutTester()
|
||||||
|
{
|
||||||
|
if (fLooper) {
|
||||||
|
fLooper->Lock();
|
||||||
|
if (fHandler) {
|
||||||
|
fLooper->RemoveHandler(fHandler);
|
||||||
|
delete fHandler;
|
||||||
|
}
|
||||||
|
fLooper->Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 1 this is uninitialized
|
||||||
|
@results should return B_BAD_VALUE.
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest1()
|
||||||
|
{
|
||||||
|
BMessenger messenger;
|
||||||
|
CHK(messenger.LockTargetWithTimeout(0) == B_BAD_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 2 this is initialized to local target with preferred handler,
|
||||||
|
looper is not locked
|
||||||
|
@results should lock the looper and return B_OK.
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest2()
|
||||||
|
{
|
||||||
|
status_t result = B_OK;
|
||||||
|
BLooper *looper = new BLooper;
|
||||||
|
looper->Run();
|
||||||
|
LooperQuitter quitter(looper);
|
||||||
|
BMessenger messenger(NULL, looper, &result);
|
||||||
|
CHK(messenger.LockTargetWithTimeout(0) == B_OK);
|
||||||
|
CHK(looper->IsLocked() == true);
|
||||||
|
looper->Unlock();
|
||||||
|
CHK(looper->IsLocked() == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 3 this is initialized to local target with specific handler,
|
||||||
|
looper is not locked
|
||||||
|
@results should lock the looper and return B_OK.
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest3()
|
||||||
|
{
|
||||||
|
// 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.LockTargetWithTimeout(0) == B_OK);
|
||||||
|
CHK(looper->IsLocked() == true);
|
||||||
|
looper->Unlock();
|
||||||
|
CHK(looper->IsLocked() == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 4 this is initialized to local target with preferred handler,
|
||||||
|
looper is locked by another thread, timeout is 100ms
|
||||||
|
@results should block until the looper is unlocked (after 50ms),
|
||||||
|
lock it and return B_OK.
|
||||||
|
@thread A - locks the looper
|
||||||
|
- waits 100ms
|
||||||
|
- unlocks the looper
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest4A()
|
||||||
|
{
|
||||||
|
CHK(fLooper->Lock() == true);
|
||||||
|
snooze(100000);
|
||||||
|
fLooper->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 4 this is initialized to local target with preferred handler,
|
||||||
|
looper is locked by another thread, timeout is 100ms
|
||||||
|
@results should block until the looper is unlocked (after 50ms),
|
||||||
|
lock it and return B_OK.
|
||||||
|
@thread B - waits 50ms (until thread A has acquired the looper lock)
|
||||||
|
- tries to lock the looper via messenger and blocks
|
||||||
|
- acquires the lock successfully after 50ms
|
||||||
|
- unlocks the looper
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest4B()
|
||||||
|
{
|
||||||
|
enum { JITTER = 10000 }; // Maybe critical on slow machines.
|
||||||
|
snooze(50000);
|
||||||
|
BMessenger messenger(NULL, fLooper);
|
||||||
|
bigtime_t time = system_time();
|
||||||
|
CHK(messenger.LockTargetWithTimeout(100000) == B_OK);
|
||||||
|
time = system_time() - time - 50000;
|
||||||
|
CHK(fLooper->IsLocked() == true);
|
||||||
|
fLooper->Unlock();
|
||||||
|
CHK(fLooper->IsLocked() == false);
|
||||||
|
CHK(time > -JITTER && time < JITTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 5 this is initialized to local target with preferred handler,
|
||||||
|
looper is locked by another thread, timeout is 25ms
|
||||||
|
@results should block for 25ms, not until the looper is unlocked
|
||||||
|
(after 50ms), should return B_TIMED_OUT.
|
||||||
|
@thread A - locks the looper
|
||||||
|
- waits 100ms
|
||||||
|
- unlocks the looper
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest5A()
|
||||||
|
{
|
||||||
|
CHK(fLooper->Lock() == true);
|
||||||
|
snooze(100000);
|
||||||
|
fLooper->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 5 this is initialized to local target with preferred handler,
|
||||||
|
looper is locked by another thread, timeout is 25ms
|
||||||
|
@results should block for 25ms, not until the looper is unlocked
|
||||||
|
(after 50ms), should return B_TIMED_OUT.
|
||||||
|
@thread B - waits 50ms (until thread A has acquired the looper lock)
|
||||||
|
- tries to lock the looper via messenger and blocks
|
||||||
|
- times out after 25ms
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest5B()
|
||||||
|
{
|
||||||
|
enum { JITTER = 10000 }; // Maybe critical on slow machines.
|
||||||
|
snooze(50000);
|
||||||
|
BMessenger messenger(NULL, fLooper);
|
||||||
|
bigtime_t time = system_time();
|
||||||
|
CHK(messenger.LockTargetWithTimeout(25000) == B_TIMED_OUT);
|
||||||
|
time = system_time() - time - 25000;
|
||||||
|
CHK(fLooper->IsLocked() == false);
|
||||||
|
CHK(time > -JITTER && time < JITTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 6 this is initialized to local target with specific handler,
|
||||||
|
looper is locked by another thread, timeout is 100ms
|
||||||
|
@results should block until the looper is unlocked (after 50ms),
|
||||||
|
lock it and return B_OK.
|
||||||
|
@thread A - locks the looper
|
||||||
|
- waits 100ms
|
||||||
|
- unlocks the looper
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest6A()
|
||||||
|
{
|
||||||
|
CHK(fLooper->Lock() == true);
|
||||||
|
snooze(100000);
|
||||||
|
fLooper->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 6 this is initialized to local target with specific handler,
|
||||||
|
looper is locked by another thread, timeout is 100ms
|
||||||
|
@results should block until the looper is unlocked (after 50ms),
|
||||||
|
lock it and return B_OK.
|
||||||
|
@thread B - waits 50ms (until thread A has acquired the looper lock)
|
||||||
|
- tries to lock the looper via messenger and blocks
|
||||||
|
- acquires the lock successfully after 50ms
|
||||||
|
- unlocks the looper
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest6B()
|
||||||
|
{
|
||||||
|
enum { JITTER = 10000 }; // Maybe critical on slow machines.
|
||||||
|
snooze(50000);
|
||||||
|
BMessenger messenger(fHandler, NULL);
|
||||||
|
bigtime_t time = system_time();
|
||||||
|
CHK(messenger.LockTargetWithTimeout(100000) == B_OK);
|
||||||
|
time = system_time() - time - 50000;
|
||||||
|
CHK(fLooper->IsLocked() == true);
|
||||||
|
fLooper->Unlock();
|
||||||
|
CHK(fLooper->IsLocked() == false);
|
||||||
|
CHK(time > -JITTER && time < JITTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 7 this is initialized to local target with specific handler,
|
||||||
|
looper is locked by another thread, timeout is 25ms
|
||||||
|
@results should block for 25ms, not until the looper is unlocked
|
||||||
|
(after 50ms), should return B_TIMED_OUT.
|
||||||
|
@thread A - locks the looper
|
||||||
|
- waits 100ms
|
||||||
|
- unlocks the looper
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest7A()
|
||||||
|
{
|
||||||
|
CHK(fLooper->Lock() == true);
|
||||||
|
snooze(100000);
|
||||||
|
fLooper->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 7 this is initialized to local target with specific handler,
|
||||||
|
looper is locked by another thread, timeout is 25ms
|
||||||
|
@results should block for 25ms, not until the looper is unlocked
|
||||||
|
(after 50ms), should return B_TIMED_OUT.
|
||||||
|
@thread B - waits 50ms (until thread A has acquired the looper lock)
|
||||||
|
- tries to lock the looper via messenger and blocks
|
||||||
|
- times out after 25ms
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest7B()
|
||||||
|
{
|
||||||
|
enum { JITTER = 10000 }; // Maybe critical on slow machines.
|
||||||
|
snooze(50000);
|
||||||
|
BMessenger messenger(fHandler, NULL);
|
||||||
|
bigtime_t time = system_time();
|
||||||
|
CHK(messenger.LockTargetWithTimeout(25000) == B_TIMED_OUT);
|
||||||
|
time = system_time() - time - 25000;
|
||||||
|
CHK(fLooper->IsLocked() == false);
|
||||||
|
CHK(time > -JITTER && time < JITTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 8 this is initialized to remote target with preferred
|
||||||
|
handler, looper is not locked
|
||||||
|
@results should not lock the looper and return B_BAD_VALUE.
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest8()
|
||||||
|
{
|
||||||
|
// TODO: Implement!
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
status_t LockTargetWithTimeout(bigtime_t timeout) const
|
||||||
|
@case 9 this is initialized to remote target with specific handler,
|
||||||
|
looper is not locked
|
||||||
|
@results should not lock the looper and return B_BAD_VALUE.
|
||||||
|
*/
|
||||||
|
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest9()
|
||||||
|
{
|
||||||
|
// TODO: Implement!
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Test* LockTargetWithTimeoutTester::Suite()
|
||||||
|
{
|
||||||
|
typedef BThreadedTestCaller<LockTargetWithTimeoutTester> TC;
|
||||||
|
|
||||||
|
TestSuite* testSuite = new TestSuite;
|
||||||
|
|
||||||
|
ADD_TEST(testSuite, LockTargetWithTimeoutTester,
|
||||||
|
LockTargetWithTimeoutTest1);
|
||||||
|
ADD_TEST(testSuite, LockTargetWithTimeoutTester,
|
||||||
|
LockTargetWithTimeoutTest2);
|
||||||
|
ADD_TEST(testSuite, LockTargetWithTimeoutTester,
|
||||||
|
LockTargetWithTimeoutTest3);
|
||||||
|
// test4
|
||||||
|
LockTargetWithTimeoutTester *test4
|
||||||
|
= new LockTargetWithTimeoutTester("LockTargetWithTimeoutTest4");
|
||||||
|
test4->fLooper = new BLooper;
|
||||||
|
test4->fLooper->Run();
|
||||||
|
// test4 test caller
|
||||||
|
TC *caller4 = new TC("LockTargetWithTimeoutTest4", test4);
|
||||||
|
caller4->addThread("A",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest4A);
|
||||||
|
caller4->addThread("B",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest4B);
|
||||||
|
testSuite->addTest(caller4);
|
||||||
|
// test5
|
||||||
|
LockTargetWithTimeoutTester *test5
|
||||||
|
= new LockTargetWithTimeoutTester("LockTargetWithTimeoutTest5");
|
||||||
|
test5->fLooper = new BLooper;
|
||||||
|
test5->fLooper->Run();
|
||||||
|
// test5 test caller
|
||||||
|
TC *caller5 = new TC("LockTargetWithTimeoutTest5", test5);
|
||||||
|
caller5->addThread("A",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest5A);
|
||||||
|
caller5->addThread("B",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest5B);
|
||||||
|
testSuite->addTest(caller5);
|
||||||
|
// test6
|
||||||
|
LockTargetWithTimeoutTester *test6
|
||||||
|
= new LockTargetWithTimeoutTester("LockTargetWithTimeoutTest6");
|
||||||
|
// create looper and handler
|
||||||
|
test6->fLooper = new BLooper;
|
||||||
|
test6->fLooper->Run();
|
||||||
|
test6->fHandler = new BHandler;
|
||||||
|
if (test6->fLooper->Lock()) {
|
||||||
|
test6->fLooper->AddHandler(test6->fHandler);
|
||||||
|
test6->fLooper->Unlock();
|
||||||
|
} else
|
||||||
|
printf("ERROR: Can't init LockTargetWithTimeoutTester test6!\n");
|
||||||
|
// test6 test caller
|
||||||
|
TC *caller6 = new TC("LockTargetWithTimeoutTest6", test6);
|
||||||
|
caller6->addThread("A",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest6A);
|
||||||
|
caller6->addThread("B",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest6B);
|
||||||
|
testSuite->addTest(caller6);
|
||||||
|
// test7
|
||||||
|
LockTargetWithTimeoutTester *test7
|
||||||
|
= new LockTargetWithTimeoutTester("LockTargetWithTimeoutTest7");
|
||||||
|
// create looper and handler
|
||||||
|
test7->fLooper = new BLooper;
|
||||||
|
test7->fLooper->Run();
|
||||||
|
test7->fHandler = new BHandler;
|
||||||
|
if (test7->fLooper->Lock()) {
|
||||||
|
test7->fLooper->AddHandler(test7->fHandler);
|
||||||
|
test7->fLooper->Unlock();
|
||||||
|
} else
|
||||||
|
printf("ERROR: Can't init LockTargetWithTimeoutTester test7!\n");
|
||||||
|
// test7 test caller
|
||||||
|
TC *caller7 = new TC("LockTargetWithTimeoutTest7", test7);
|
||||||
|
caller7->addThread("A",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest7A);
|
||||||
|
caller7->addThread("B",
|
||||||
|
&LockTargetWithTimeoutTester::LockTargetWithTimeoutTest7B);
|
||||||
|
testSuite->addTest(caller7);
|
||||||
|
// tests 8-9
|
||||||
|
ADD_TEST(testSuite, LockTargetWithTimeoutTester,
|
||||||
|
LockTargetWithTimeoutTest8);
|
||||||
|
ADD_TEST(testSuite, LockTargetWithTimeoutTester,
|
||||||
|
LockTargetWithTimeoutTest9);
|
||||||
|
|
||||||
|
return testSuite;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// LockTargetWithTimeoutTester.h
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef LOCK_TARGET_WITH_TIMEOUT_TESTER_H
|
||||||
|
#define LOCK_TARGET_WITH_TIMEOUT_TESTER_H
|
||||||
|
|
||||||
|
// Standard Includes -----------------------------------------------------------
|
||||||
|
|
||||||
|
// System Includes -------------------------------------------------------------
|
||||||
|
|
||||||
|
// Project Includes ------------------------------------------------------------
|
||||||
|
#include <ThreadedTestCase.h>
|
||||||
|
|
||||||
|
// Local Includes --------------------------------------------------------------
|
||||||
|
#include "../common.h"
|
||||||
|
|
||||||
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
|
||||||
|
// Globals ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
class BHandler;
|
||||||
|
class BLooper;
|
||||||
|
|
||||||
|
class LockTargetWithTimeoutTester : public BThreadedTestCase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LockTargetWithTimeoutTester();
|
||||||
|
LockTargetWithTimeoutTester(std::string name);
|
||||||
|
virtual ~LockTargetWithTimeoutTester();
|
||||||
|
|
||||||
|
void LockTargetWithTimeoutTest1();
|
||||||
|
void LockTargetWithTimeoutTest2();
|
||||||
|
void LockTargetWithTimeoutTest3();
|
||||||
|
void LockTargetWithTimeoutTest4A();
|
||||||
|
void LockTargetWithTimeoutTest4B();
|
||||||
|
void LockTargetWithTimeoutTest5A();
|
||||||
|
void LockTargetWithTimeoutTest5B();
|
||||||
|
void LockTargetWithTimeoutTest6A();
|
||||||
|
void LockTargetWithTimeoutTest6B();
|
||||||
|
void LockTargetWithTimeoutTest7A();
|
||||||
|
void LockTargetWithTimeoutTest7B();
|
||||||
|
void LockTargetWithTimeoutTest8();
|
||||||
|
void LockTargetWithTimeoutTest9();
|
||||||
|
|
||||||
|
static Test* Suite();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BHandler *fHandler;
|
||||||
|
BLooper *fLooper;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOCK_TARGET_WITH_TIMEOUT_TESTER_H
|
||||||
|
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// MessengerAssignmentTester.cpp
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Standard Includes -----------------------------------------------------------
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// System Includes -------------------------------------------------------------
|
||||||
|
#include <be/app/Message.h>
|
||||||
|
#include <be/kernel/OS.h>
|
||||||
|
|
||||||
|
#include <Handler.h>
|
||||||
|
#include <Looper.h>
|
||||||
|
#include <Messenger.h>
|
||||||
|
|
||||||
|
// Project Includes ------------------------------------------------------------
|
||||||
|
#include <TestUtils.h>
|
||||||
|
#include <ThreadedTestCaller.h>
|
||||||
|
#include <cppunit/TestSuite.h>
|
||||||
|
|
||||||
|
// Local Includes --------------------------------------------------------------
|
||||||
|
#include "Helpers.h"
|
||||||
|
#include "MessengerAssignmentTester.h"
|
||||||
|
|
||||||
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
|
||||||
|
// Globals ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
MessengerAssignmentTester::MessengerAssignmentTester()
|
||||||
|
: BThreadedTestCase(),
|
||||||
|
fHandler(NULL),
|
||||||
|
fLooper(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
MessengerAssignmentTester::MessengerAssignmentTester(std::string name)
|
||||||
|
: BThreadedTestCase(name),
|
||||||
|
fHandler(NULL),
|
||||||
|
fLooper(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
MessengerAssignmentTester::~MessengerAssignmentTester()
|
||||||
|
{
|
||||||
|
if (fLooper) {
|
||||||
|
fLooper->Lock();
|
||||||
|
if (fHandler) {
|
||||||
|
fLooper->RemoveHandler(fHandler);
|
||||||
|
delete fHandler;
|
||||||
|
}
|
||||||
|
fLooper->Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
BMessenger &operator=(const BMessenger &from)
|
||||||
|
@case 1 from is uninitialized
|
||||||
|
@results IsValid() and IsTargetLocal() should return false
|
||||||
|
Target() should return NULL and NULL for looper.
|
||||||
|
Team() should return -1.
|
||||||
|
*/
|
||||||
|
void MessengerAssignmentTester::AssignmentTest1()
|
||||||
|
{
|
||||||
|
BMessenger from;
|
||||||
|
BMessenger messenger;
|
||||||
|
CHK(&(messenger = from) == &messenger);
|
||||||
|
CHK(messenger.IsValid() == false);
|
||||||
|
CHK(messenger.IsTargetLocal() == false);
|
||||||
|
BLooper *looper;
|
||||||
|
CHK(messenger.Target(&looper) == NULL);
|
||||||
|
CHK(looper == NULL);
|
||||||
|
CHK(messenger.Team() == -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
BMessenger &operator=(const BMessenger &from)
|
||||||
|
@case 2 from is properly initialized to a local target
|
||||||
|
(preferred handler)
|
||||||
|
@results IsValid() and IsTargetLocal() should return true
|
||||||
|
Target() should return the same values as for from.
|
||||||
|
Team() should return this team.
|
||||||
|
*/
|
||||||
|
void MessengerAssignmentTester::AssignmentTest2()
|
||||||
|
{
|
||||||
|
// create looper
|
||||||
|
status_t result = B_OK;
|
||||||
|
BLooper *looper = new BLooper;
|
||||||
|
looper->Run();
|
||||||
|
LooperQuitter quitter(looper);
|
||||||
|
// create the from messenger
|
||||||
|
BMessenger from(NULL, looper, &result);
|
||||||
|
CHK(from.IsValid() == true);
|
||||||
|
CHK(from.IsTargetLocal() == true);
|
||||||
|
BLooper *resultLooper;
|
||||||
|
CHK(from.Target(&resultLooper) == NULL);
|
||||||
|
CHK(resultLooper == looper);
|
||||||
|
CHK(from.Team() == get_this_team());
|
||||||
|
CHK(result == B_OK);
|
||||||
|
// create the messenger and do the checks
|
||||||
|
BMessenger messenger;
|
||||||
|
CHK(&(messenger = from) == &messenger);
|
||||||
|
CHK(messenger.IsValid() == true);
|
||||||
|
CHK(messenger.IsTargetLocal() == true);
|
||||||
|
resultLooper = NULL;
|
||||||
|
CHK(messenger.Target(&resultLooper) == NULL);
|
||||||
|
CHK(resultLooper == looper);
|
||||||
|
CHK(messenger.Team() == get_this_team());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
BMessenger &operator=(const BMessenger &from)
|
||||||
|
@case 3 from is properly initialized to a local target
|
||||||
|
(specific handler)
|
||||||
|
@results IsValid() and IsTargetLocal() should return true
|
||||||
|
Target() should return the same values as for from.
|
||||||
|
Team() should return this team.
|
||||||
|
*/
|
||||||
|
void MessengerAssignmentTester::AssignmentTest3()
|
||||||
|
{
|
||||||
|
// 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 from messenger
|
||||||
|
BMessenger from(handler, looper, &result);
|
||||||
|
CHK(from.IsValid() == true);
|
||||||
|
CHK(from.IsTargetLocal() == true);
|
||||||
|
BLooper *resultLooper;
|
||||||
|
CHK(from.Target(&resultLooper) == handler);
|
||||||
|
CHK(resultLooper == looper);
|
||||||
|
CHK(from.Team() == get_this_team());
|
||||||
|
CHK(result == B_OK);
|
||||||
|
// create the messenger and do the checks
|
||||||
|
BMessenger messenger;
|
||||||
|
CHK(&(messenger = from) == &messenger);
|
||||||
|
CHK(messenger.IsValid() == true);
|
||||||
|
CHK(messenger.IsTargetLocal() == true);
|
||||||
|
resultLooper = NULL;
|
||||||
|
CHK(messenger.Target(&resultLooper) == handler);
|
||||||
|
CHK(resultLooper == looper);
|
||||||
|
CHK(messenger.Team() == get_this_team());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Test* MessengerAssignmentTester::Suite()
|
||||||
|
{
|
||||||
|
typedef BThreadedTestCaller<MessengerAssignmentTester> TC;
|
||||||
|
|
||||||
|
TestSuite* testSuite = new TestSuite;
|
||||||
|
|
||||||
|
ADD_TEST(testSuite, MessengerAssignmentTester, AssignmentTest1);
|
||||||
|
ADD_TEST(testSuite, MessengerAssignmentTester, AssignmentTest2);
|
||||||
|
ADD_TEST(testSuite, MessengerAssignmentTester, AssignmentTest3);
|
||||||
|
|
||||||
|
return testSuite;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// MessengerAssignmentTester.h
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MESSENGER_ASSIGNMENT_TESTER_H
|
||||||
|
#define MESSENGER_ASSIGNMENT_TESTER_H
|
||||||
|
|
||||||
|
// Standard Includes -----------------------------------------------------------
|
||||||
|
|
||||||
|
// System Includes -------------------------------------------------------------
|
||||||
|
|
||||||
|
// Project Includes ------------------------------------------------------------
|
||||||
|
#include <ThreadedTestCase.h>
|
||||||
|
|
||||||
|
// Local Includes --------------------------------------------------------------
|
||||||
|
#include "../common.h"
|
||||||
|
|
||||||
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
|
||||||
|
// Globals ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
class BHandler;
|
||||||
|
class BLooper;
|
||||||
|
|
||||||
|
class MessengerAssignmentTester : public BThreadedTestCase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MessengerAssignmentTester();
|
||||||
|
MessengerAssignmentTester(std::string name);
|
||||||
|
virtual ~MessengerAssignmentTester();
|
||||||
|
|
||||||
|
void AssignmentTest1();
|
||||||
|
void AssignmentTest2();
|
||||||
|
void AssignmentTest3();
|
||||||
|
|
||||||
|
static Test* Suite();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BHandler *fHandler;
|
||||||
|
BLooper *fLooper;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MESSENGER_ASSIGNMENT_TESTER_H
|
||||||
|
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// MessengerComparissonTester.cpp
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Standard Includes -----------------------------------------------------------
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// System Includes -------------------------------------------------------------
|
||||||
|
#include <be/app/Message.h>
|
||||||
|
#include <be/kernel/OS.h>
|
||||||
|
|
||||||
|
#include <Handler.h>
|
||||||
|
#include <Looper.h>
|
||||||
|
#include <Messenger.h>
|
||||||
|
|
||||||
|
// Project Includes ------------------------------------------------------------
|
||||||
|
#include <TestUtils.h>
|
||||||
|
#include <ThreadedTestCaller.h>
|
||||||
|
#include <cppunit/TestSuite.h>
|
||||||
|
|
||||||
|
// Local Includes --------------------------------------------------------------
|
||||||
|
#include "Helpers.h"
|
||||||
|
#include "MessengerComparissonTester.h"
|
||||||
|
|
||||||
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
|
||||||
|
// Globals ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
MessengerComparissonTester::MessengerComparissonTester()
|
||||||
|
: BThreadedTestCase(),
|
||||||
|
fHandler(NULL),
|
||||||
|
fLooper(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
MessengerComparissonTester::MessengerComparissonTester(std::string name)
|
||||||
|
: BThreadedTestCase(name),
|
||||||
|
fHandler(NULL),
|
||||||
|
fLooper(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// destructor
|
||||||
|
MessengerComparissonTester::~MessengerComparissonTester()
|
||||||
|
{
|
||||||
|
if (fLooper) {
|
||||||
|
fLooper->Lock();
|
||||||
|
if (fHandler) {
|
||||||
|
fLooper->RemoveHandler(fHandler);
|
||||||
|
delete fHandler;
|
||||||
|
}
|
||||||
|
fLooper->Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
BMessenger &operator=(const BMessenger &from)
|
||||||
|
@case 1 from is uninitialized
|
||||||
|
@results IsValid() and IsTargetLocal() should return false
|
||||||
|
Target() should return NULL and NULL for looper.
|
||||||
|
Team() should return -1.
|
||||||
|
*/
|
||||||
|
void MessengerComparissonTester::ComparissonTest1()
|
||||||
|
{
|
||||||
|
BMessenger a;
|
||||||
|
BMessenger b;
|
||||||
|
CHK(a == b);
|
||||||
|
CHK(b == a);
|
||||||
|
CHK(!(a != b));
|
||||||
|
CHK(!(b != a));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
BMessenger &operator=(const BMessenger &from)
|
||||||
|
@case 2 from is properly initialized to a local target
|
||||||
|
(preferred handler)
|
||||||
|
@results IsValid() and IsTargetLocal() should return true
|
||||||
|
Target() should return the same values as for from.
|
||||||
|
Team() should return this team.
|
||||||
|
*/
|
||||||
|
void MessengerComparissonTester::ComparissonTest2()
|
||||||
|
{
|
||||||
|
// create looper
|
||||||
|
BLooper *looper = new BLooper;
|
||||||
|
looper->Run();
|
||||||
|
LooperQuitter quitter(looper);
|
||||||
|
// create messenger
|
||||||
|
BMessenger a(NULL, looper);
|
||||||
|
BMessenger b;
|
||||||
|
CHK(a != b);
|
||||||
|
CHK(b != a);
|
||||||
|
CHK(!(a == b));
|
||||||
|
CHK(!(b == a));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
BMessenger &operator=(const BMessenger &from)
|
||||||
|
@case 3 from is properly initialized to a local target
|
||||||
|
(specific handler)
|
||||||
|
@results IsValid() and IsTargetLocal() should return true
|
||||||
|
Target() should return the same values as for from.
|
||||||
|
Team() should return this team.
|
||||||
|
*/
|
||||||
|
void MessengerComparissonTester::ComparissonTest3()
|
||||||
|
{
|
||||||
|
// messenger1: looper and handler
|
||||||
|
BLooper *looper1 = new BLooper;
|
||||||
|
looper1->Run();
|
||||||
|
LooperQuitter quitter1(looper1);
|
||||||
|
BHandler *handler1 = new BHandler;
|
||||||
|
HandlerDeleter deleter1(handler1);
|
||||||
|
CHK(looper1->Lock());
|
||||||
|
looper1->AddHandler(handler1);
|
||||||
|
looper1->Unlock();
|
||||||
|
BMessenger messenger1(handler1, looper1);
|
||||||
|
BMessenger messenger1a(handler1, looper1);
|
||||||
|
// messenger2: looper (1)
|
||||||
|
BMessenger messenger2(NULL, looper1);
|
||||||
|
BMessenger messenger2a(NULL, looper1);
|
||||||
|
// messenger3: looper and handler
|
||||||
|
BLooper *looper2 = new BLooper;
|
||||||
|
looper2->Run();
|
||||||
|
LooperQuitter quitter2(looper2);
|
||||||
|
BHandler *handler2 = new BHandler;
|
||||||
|
HandlerDeleter deleter2(handler2);
|
||||||
|
CHK(looper2->Lock());
|
||||||
|
looper2->AddHandler(handler2);
|
||||||
|
looper2->Unlock();
|
||||||
|
BMessenger messenger3(handler2, looper2);
|
||||||
|
BMessenger messenger3a(handler2, looper2);
|
||||||
|
// messenger4: looper (2)
|
||||||
|
BMessenger messenger4(NULL, looper2);
|
||||||
|
BMessenger messenger4a(NULL, looper2);
|
||||||
|
// TODO: remote targets
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// targets -- test data
|
||||||
|
struct target {
|
||||||
|
BMessenger &messenger;
|
||||||
|
int32 id; // identifies the target
|
||||||
|
} targets[] = {
|
||||||
|
{ messenger1, 1 },
|
||||||
|
{ messenger1a, 1 },
|
||||||
|
{ messenger2, 2 },
|
||||||
|
{ messenger2, 2 },
|
||||||
|
{ messenger3, 3 },
|
||||||
|
{ messenger3a, 3 },
|
||||||
|
{ messenger4, 4 },
|
||||||
|
{ messenger4a, 4 },
|
||||||
|
};
|
||||||
|
int32 targetCount = sizeof(targets) / sizeof(target);
|
||||||
|
|
||||||
|
// test
|
||||||
|
for (int32 i = 0; i < targetCount; i++) {
|
||||||
|
NextSubTest();
|
||||||
|
const target &target1 = targets[i];
|
||||||
|
const BMessenger &a = target1.messenger;
|
||||||
|
for (int32 k = 0; k < targetCount; k++) {
|
||||||
|
const target &target2 = targets[k];
|
||||||
|
const BMessenger &b = target2.messenger;
|
||||||
|
bool areEqual = (target1.id == target2.id);
|
||||||
|
CHK((a == b) == areEqual);
|
||||||
|
CHK((b == a) == areEqual);
|
||||||
|
CHK((a != b) == !areEqual);
|
||||||
|
CHK((b != a) == !areEqual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Test* MessengerComparissonTester::Suite()
|
||||||
|
{
|
||||||
|
typedef BThreadedTestCaller<MessengerComparissonTester> TC;
|
||||||
|
|
||||||
|
TestSuite* testSuite = new TestSuite;
|
||||||
|
|
||||||
|
ADD_TEST(testSuite, MessengerComparissonTester, ComparissonTest1);
|
||||||
|
ADD_TEST(testSuite, MessengerComparissonTester, ComparissonTest2);
|
||||||
|
ADD_TEST(testSuite, MessengerComparissonTester, ComparissonTest3);
|
||||||
|
|
||||||
|
return testSuite;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// MessengerComparissonTester.h
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef MESSENGER_COMPARISSON_TESTER_H
|
||||||
|
#define MESSENGER_COMPARISSON_TESTER_H
|
||||||
|
|
||||||
|
// Standard Includes -----------------------------------------------------------
|
||||||
|
|
||||||
|
// System Includes -------------------------------------------------------------
|
||||||
|
|
||||||
|
// Project Includes ------------------------------------------------------------
|
||||||
|
#include <ThreadedTestCase.h>
|
||||||
|
|
||||||
|
// Local Includes --------------------------------------------------------------
|
||||||
|
#include "../common.h"
|
||||||
|
|
||||||
|
// Local Defines ---------------------------------------------------------------
|
||||||
|
|
||||||
|
// Globals ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
class BHandler;
|
||||||
|
class BLooper;
|
||||||
|
|
||||||
|
class MessengerComparissonTester : public BThreadedTestCase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MessengerComparissonTester();
|
||||||
|
MessengerComparissonTester(std::string name);
|
||||||
|
virtual ~MessengerComparissonTester();
|
||||||
|
|
||||||
|
void ComparissonTest1();
|
||||||
|
void ComparissonTest2();
|
||||||
|
void ComparissonTest3();
|
||||||
|
|
||||||
|
static Test* Suite();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BHandler *fHandler;
|
||||||
|
BLooper *fLooper;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MESSENGER_COMPARISSON_TESTER_H
|
||||||
|
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
#include "BMessengerTester.h"
|
#include "BMessengerTester.h"
|
||||||
#include "LockTargetTester.h"
|
#include "LockTargetTester.h"
|
||||||
|
#include "LockTargetWithTimeoutTester.h"
|
||||||
|
#include "MessengerAssignmentTester.h"
|
||||||
|
#include "MessengerComparissonTester.h"
|
||||||
#include "TargetTester.h"
|
#include "TargetTester.h"
|
||||||
|
|
||||||
CppUnit::Test* MessengerTestSuite()
|
CppUnit::Test* MessengerTestSuite()
|
||||||
@@ -8,8 +11,11 @@ CppUnit::Test* MessengerTestSuite()
|
|||||||
CppUnit::TestSuite *testSuite = new CppUnit::TestSuite();
|
CppUnit::TestSuite *testSuite = new CppUnit::TestSuite();
|
||||||
|
|
||||||
testSuite->addTest(LockTargetTester::Suite());
|
testSuite->addTest(LockTargetTester::Suite());
|
||||||
|
testSuite->addTest(LockTargetWithTimeoutTester::Suite());
|
||||||
|
testSuite->addTest(MessengerAssignmentTester::Suite());
|
||||||
|
testSuite->addTest(MessengerComparissonTester::Suite());
|
||||||
testSuite->addTest(TBMessengerTester::Suite());
|
testSuite->addTest(TBMessengerTester::Suite());
|
||||||
testSuite->addTest(TargetTester::Suite());
|
testSuite->addTest(TargetTester::Suite());
|
||||||
|
|
||||||
return testSuite;
|
return testSuite;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user