some unrelated unit test tweaks
This commit is contained in:
parent
24911dc990
commit
a2bcedc31e
3 changed files with 30 additions and 38 deletions
|
|
@ -155,7 +155,7 @@ lumiera::query::setFakeBypass("stream("+sID+")"); //////////////////////////////
|
||||||
forget (string pID)
|
forget (string pID)
|
||||||
{
|
{
|
||||||
PPipe pipe = Pipe::query ("pipe("+pID+")");
|
PPipe pipe = Pipe::query ("pipe("+pID+")");
|
||||||
REQUIRE (find (pipe->getPipeID()), "need an object registered as default");
|
REQUIRE (find (pipe->getPipeID()), "test assumes pre-registered default pipe");
|
||||||
long cnt = pipe.use_count();
|
long cnt = pipe.use_count();
|
||||||
|
|
||||||
// now de-register the pipe as "default Pipe"
|
// now de-register the pipe as "default Pipe"
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ namespace test {
|
||||||
VERIFY_ERROR (NOT_IN_SESSION, Scope invalid (notRelated2anything) );
|
VERIFY_ERROR (NOT_IN_SESSION, Scope invalid (notRelated2anything) );
|
||||||
|
|
||||||
Scope const& scopeOfEvil = fabricate_invalidScope();
|
Scope const& scopeOfEvil = fabricate_invalidScope();
|
||||||
REQUIRE (!scopeOfEvil.isValid());
|
CHECK (!scopeOfEvil.isValid());
|
||||||
|
|
||||||
VERIFY_ERROR (INVALID_SCOPE, ScopePath outsideCurrentModel (scopeOfEvil) );
|
VERIFY_ERROR (INVALID_SCOPE, ScopePath outsideCurrentModel (scopeOfEvil) );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ namespace test{
|
||||||
class SingletonTestMock_test : public Test
|
class SingletonTestMock_test : public Test
|
||||||
{
|
{
|
||||||
|
|
||||||
Singleton<TestSingletonO> instance;
|
Singleton<TestSingletonO> sing;
|
||||||
|
|
||||||
void
|
void
|
||||||
run (Arg arg)
|
run (Arg arg)
|
||||||
|
|
@ -140,30 +140,26 @@ namespace test{
|
||||||
void
|
void
|
||||||
injectBoth ()
|
injectBoth ()
|
||||||
{
|
{
|
||||||
TestSingletonO* sing = &instance();
|
sing().doIt();
|
||||||
sing->doIt();
|
sing().doIt();
|
||||||
sing->doIt();
|
CHECK (sing().getCnt() == 2);
|
||||||
CHECK (sing->getCnt() == 2);
|
|
||||||
|
|
||||||
instance.injectSubclass (new Mock_1);
|
sing.injectSubclass (new Mock_1);
|
||||||
sing = &instance();
|
sing().doIt();
|
||||||
sing->doIt();
|
sing().doIt();
|
||||||
sing->doIt();
|
sing().doIt();
|
||||||
sing->doIt();
|
sing().doIt();
|
||||||
sing->doIt();
|
sing().doIt();
|
||||||
sing->doIt();
|
CHECK (sing().getCnt() == 5);
|
||||||
CHECK (sing->getCnt() == 5);
|
|
||||||
|
|
||||||
instance.injectSubclass (new Mock_2);
|
sing.injectSubclass (new Mock_2);
|
||||||
sing = &instance();
|
sing().doIt();
|
||||||
sing->doIt();
|
CHECK (sing().getCnt() == 1);
|
||||||
CHECK (sing->getCnt() == 1);
|
|
||||||
|
|
||||||
instance.injectSubclass (0); // un-shadowing original instance
|
sing.injectSubclass (0); // un-shadowing original instance
|
||||||
sing = &instance();
|
CHECK (sing().getCnt() == 2);
|
||||||
CHECK (sing->getCnt() == 2);
|
sing().doIt();
|
||||||
sing->doIt();
|
CHECK (sing().getCnt() == 3);
|
||||||
CHECK (sing->getCnt() == 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -171,8 +167,7 @@ namespace test{
|
||||||
void
|
void
|
||||||
noMock ()
|
noMock ()
|
||||||
{
|
{
|
||||||
TestSingletonO& sing = instance();
|
sing().doIt();
|
||||||
sing.doIt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -181,9 +176,8 @@ namespace test{
|
||||||
void
|
void
|
||||||
onlyMock ()
|
onlyMock ()
|
||||||
{
|
{
|
||||||
instance.injectSubclass (new Mock_1);
|
sing.injectSubclass (new Mock_1);
|
||||||
TestSingletonO& sing = instance();
|
sing().doIt();
|
||||||
sing.doIt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -194,16 +188,14 @@ namespace test{
|
||||||
void
|
void
|
||||||
firstMock ()
|
firstMock ()
|
||||||
{
|
{
|
||||||
instance.injectSubclass (new Mock_1);
|
sing.injectSubclass (new Mock_1);
|
||||||
TestSingletonO* sing = &instance();
|
sing().doIt();
|
||||||
sing->doIt();
|
sing().doIt();
|
||||||
sing->doIt();
|
CHECK (sing().getCnt() == 2);
|
||||||
CHECK (sing->getCnt() == 2);
|
|
||||||
|
|
||||||
instance.injectSubclass (0);
|
sing.injectSubclass (0);
|
||||||
sing = &instance();
|
sing().doIt();
|
||||||
sing->doIt();
|
CHECK (sing().getCnt() == 1);
|
||||||
CHECK (sing->getCnt() == 1);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue