Made use of the shiny new RemoteSMTarget to implement test cases operating on remote targets.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@368 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2002-07-21 14:51:23 +00:00
parent 7e2c6197d8
commit 15df6f8a0c
4 changed files with 61 additions and 27 deletions

View File

@ -22,6 +22,7 @@
// Local Includes --------------------------------------------------------------
#include "Helpers.h"
#include "LockTargetTester.h"
#include "SMTarget.h"
// Local Defines ---------------------------------------------------------------
@ -206,7 +207,9 @@ void LockTargetTester::LockTargetTest5B()
*/
void LockTargetTester::LockTargetTest6()
{
// TODO: Implement!
RemoteSMTarget target(true);
BMessenger messenger(target.Messenger());
CHK(messenger.LockTarget() == false);
}
/*
@ -217,7 +220,9 @@ void LockTargetTester::LockTargetTest6()
*/
void LockTargetTester::LockTargetTest7()
{
// TODO: Implement!
RemoteSMTarget target(false);
BMessenger messenger(target.Messenger());
CHK(messenger.LockTarget() == false);
}

View File

@ -22,6 +22,7 @@
// Local Includes --------------------------------------------------------------
#include "Helpers.h"
#include "LockTargetWithTimeoutTester.h"
#include "SMTarget.h"
// Local Defines ---------------------------------------------------------------
@ -284,7 +285,9 @@ void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest7B()
*/
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest8()
{
// TODO: Implement!
RemoteSMTarget target(true);
BMessenger messenger(target.Messenger());
CHK(messenger.LockTargetWithTimeout(10000) == B_BAD_VALUE);
}
/*
@ -295,7 +298,9 @@ void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest8()
*/
void LockTargetWithTimeoutTester::LockTargetWithTimeoutTest9()
{
// TODO: Implement!
RemoteSMTarget target(false);
BMessenger messenger(target.Messenger());
CHK(messenger.LockTargetWithTimeout(10000) == B_BAD_VALUE);
}

View File

@ -22,6 +22,7 @@
// Local Includes --------------------------------------------------------------
#include "Helpers.h"
#include "MessengerComparissonTester.h"
#include "SMTarget.h"
// Local Defines ---------------------------------------------------------------
@ -101,11 +102,10 @@ MessengerComparissonTester::~MessengerComparissonTester()
}
/*
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.
bool operator==(const BMessenger &other) const
bool operator!=(const BMessenger &a, const BMessenger &b)
@case 1 this (a) and other (b) are uninitialized
@results should return true/false.
*/
void MessengerComparissonTester::ComparissonTest1()
{
@ -118,12 +118,11 @@ void MessengerComparissonTester::ComparissonTest1()
}
/*
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.
bool operator==(const BMessenger &other) const
bool operator!=(const BMessenger &a, const BMessenger &b)
@case 1 this (a) is initialized, other (b) is uninitialized,
and vice versa
@results should return false/true.
*/
void MessengerComparissonTester::ComparissonTest2()
{
@ -141,12 +140,19 @@ void MessengerComparissonTester::ComparissonTest2()
}
/*
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.
bool operator==(const BMessenger &other) const
bool operator!=(const BMessenger &a, const BMessenger &b)
bool operator<(const BMessenger &a, const BMessenger &b)
@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
*/
void MessengerComparissonTester::ComparissonTest3()
{
@ -178,8 +184,13 @@ void MessengerComparissonTester::ComparissonTest3()
// messenger4: looper (2)
BMessenger messenger4(NULL, looper2);
BMessenger messenger4a(NULL, looper2);
// TODO: remote targets
// ...
// remote targets
RemoteSMTarget remoteTarget1(false);
RemoteSMTarget remoteTarget2(true);
BMessenger messenger5(remoteTarget1.Messenger());
BMessenger messenger5a(remoteTarget1.Messenger());
BMessenger messenger6(remoteTarget2.Messenger());
BMessenger messenger6a(remoteTarget2.Messenger());
// targets -- test data
struct target {
@ -194,6 +205,10 @@ void MessengerComparissonTester::ComparissonTest3()
{ messenger3a, 3 },
{ messenger4, 4 },
{ messenger4a, 4 },
{ messenger5, 5 },
{ messenger5a, 5 },
{ messenger6, 6 },
{ messenger6a, 6 },
};
int32 targetCount = sizeof(targets) / sizeof(target);

View File

@ -20,6 +20,7 @@
// Local Includes --------------------------------------------------------------
#include "Helpers.h"
#include "SMTarget.h"
#include "TargetTester.h"
// Local Defines ---------------------------------------------------------------
@ -83,7 +84,9 @@ void TargetTester::IsTargetLocalTest3()
*/
void TargetTester::IsTargetLocalTest4()
{
// TODO: Implement.
RemoteSMTarget target(true);
BMessenger messenger(target.Messenger());
CHK(messenger.IsTargetLocal() == false);
}
/*
@ -93,7 +96,9 @@ void TargetTester::IsTargetLocalTest4()
*/
void TargetTester::IsTargetLocalTest5()
{
// TODO: Implement.
RemoteSMTarget target(false);
BMessenger messenger(target.Messenger());
CHK(messenger.IsTargetLocal() == false);
}
/*
@ -154,7 +159,9 @@ void TargetTester::TargetTest3()
*/
void TargetTester::TargetTest4()
{
// TODO: Implement.
RemoteSMTarget target(true);
BMessenger messenger(target.Messenger());
CHK(messenger.Target(NULL) == NULL);
}
/*
@ -165,7 +172,9 @@ void TargetTester::TargetTest4()
*/
void TargetTester::TargetTest5()
{
// TODO: Implement.
RemoteSMTarget target(false);
BMessenger messenger(target.Messenger());
CHK(messenger.Target(NULL) == NULL);
}