From a2bcedc31e84b062abc93d1c1924bf0e66f67b18 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 20 Jan 2012 00:05:12 +0100 Subject: [PATCH] some unrelated unit test tweaks --- .../session/defs-manager-impl-test.cpp | 2 +- .../proc/mobject/session/scope-path-test.cpp | 2 +- tests/lib/singleton-testmock-test.cpp | 64 ++++++++----------- 3 files changed, 30 insertions(+), 38 deletions(-) diff --git a/tests/components/proc/mobject/session/defs-manager-impl-test.cpp b/tests/components/proc/mobject/session/defs-manager-impl-test.cpp index 9afa64b21..9df802a31 100644 --- a/tests/components/proc/mobject/session/defs-manager-impl-test.cpp +++ b/tests/components/proc/mobject/session/defs-manager-impl-test.cpp @@ -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" diff --git a/tests/components/proc/mobject/session/scope-path-test.cpp b/tests/components/proc/mobject/session/scope-path-test.cpp index 01c9b95c6..e54fed27a 100644 --- a/tests/components/proc/mobject/session/scope-path-test.cpp +++ b/tests/components/proc/mobject/session/scope-path-test.cpp @@ -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) ); diff --git a/tests/lib/singleton-testmock-test.cpp b/tests/lib/singleton-testmock-test.cpp index 27a0ce086..df8cfdfd4 100644 --- a/tests/lib/singleton-testmock-test.cpp +++ b/tests/lib/singleton-testmock-test.cpp @@ -112,7 +112,7 @@ namespace test{ class SingletonTestMock_test : public Test { - Singleton instance; + Singleton 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); } };