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)
|
||||
{
|
||||
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();
|
||||
|
||||
// now de-register the pipe as "default Pipe"
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ namespace test {
|
|||
VERIFY_ERROR (NOT_IN_SESSION, Scope invalid (notRelated2anything) );
|
||||
|
||||
Scope const& scopeOfEvil = fabricate_invalidScope();
|
||||
REQUIRE (!scopeOfEvil.isValid());
|
||||
CHECK (!scopeOfEvil.isValid());
|
||||
|
||||
VERIFY_ERROR (INVALID_SCOPE, ScopePath outsideCurrentModel (scopeOfEvil) );
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace test{
|
|||
class SingletonTestMock_test : public Test
|
||||
{
|
||||
|
||||
Singleton<TestSingletonO> instance;
|
||||
Singleton<TestSingletonO> sing;
|
||||
|
||||
void
|
||||
run (Arg arg)
|
||||
|
|
@ -140,30 +140,26 @@ namespace test{
|
|||
void
|
||||
injectBoth ()
|
||||
{
|
||||
TestSingletonO* sing = &instance();
|
||||
sing->doIt();
|
||||
sing->doIt();
|
||||
CHECK (sing->getCnt() == 2);
|
||||
sing().doIt();
|
||||
sing().doIt();
|
||||
CHECK (sing().getCnt() == 2);
|
||||
|
||||
instance.injectSubclass (new Mock_1);
|
||||
sing = &instance();
|
||||
sing->doIt();
|
||||
sing->doIt();
|
||||
sing->doIt();
|
||||
sing->doIt();
|
||||
sing->doIt();
|
||||
CHECK (sing->getCnt() == 5);
|
||||
sing.injectSubclass (new Mock_1);
|
||||
sing().doIt();
|
||||
sing().doIt();
|
||||
sing().doIt();
|
||||
sing().doIt();
|
||||
sing().doIt();
|
||||
CHECK (sing().getCnt() == 5);
|
||||
|
||||
instance.injectSubclass (new Mock_2);
|
||||
sing = &instance();
|
||||
sing->doIt();
|
||||
CHECK (sing->getCnt() == 1);
|
||||
sing.injectSubclass (new Mock_2);
|
||||
sing().doIt();
|
||||
CHECK (sing().getCnt() == 1);
|
||||
|
||||
instance.injectSubclass (0); // un-shadowing original instance
|
||||
sing = &instance();
|
||||
CHECK (sing->getCnt() == 2);
|
||||
sing->doIt();
|
||||
CHECK (sing->getCnt() == 3);
|
||||
sing.injectSubclass (0); // un-shadowing original instance
|
||||
CHECK (sing().getCnt() == 2);
|
||||
sing().doIt();
|
||||
CHECK (sing().getCnt() == 3);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -171,8 +167,7 @@ namespace test{
|
|||
void
|
||||
noMock ()
|
||||
{
|
||||
TestSingletonO& sing = instance();
|
||||
sing.doIt();
|
||||
sing().doIt();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -181,9 +176,8 @@ namespace test{
|
|||
void
|
||||
onlyMock ()
|
||||
{
|
||||
instance.injectSubclass (new Mock_1);
|
||||
TestSingletonO& sing = instance();
|
||||
sing.doIt();
|
||||
sing.injectSubclass (new Mock_1);
|
||||
sing().doIt();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -194,16 +188,14 @@ namespace test{
|
|||
void
|
||||
firstMock ()
|
||||
{
|
||||
instance.injectSubclass (new Mock_1);
|
||||
TestSingletonO* sing = &instance();
|
||||
sing->doIt();
|
||||
sing->doIt();
|
||||
CHECK (sing->getCnt() == 2);
|
||||
sing.injectSubclass (new Mock_1);
|
||||
sing().doIt();
|
||||
sing().doIt();
|
||||
CHECK (sing().getCnt() == 2);
|
||||
|
||||
instance.injectSubclass (0);
|
||||
sing = &instance();
|
||||
sing->doIt();
|
||||
CHECK (sing->getCnt() == 1);
|
||||
sing.injectSubclass (0);
|
||||
sing().doIt();
|
||||
CHECK (sing().getCnt() == 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue