From 1d462845dd2fdf73d22a98f3293c1cdb27902b78 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 24 Sep 2007 02:35:12 +0200 Subject: [PATCH] oops... class TargetObject defined twice --- src/common/singletonpreconfigure.hpp | 6 +- tests/50components.tests | 70 +++++++++++------- .../common/singletontestmocktest.cpp | 74 +++++++++---------- 3 files changed, 83 insertions(+), 67 deletions(-) diff --git a/src/common/singletonpreconfigure.hpp b/src/common/singletonpreconfigure.hpp index f2171fd82..3ffa46c64 100644 --- a/src/common/singletonpreconfigure.hpp +++ b/src/common/singletonpreconfigure.hpp @@ -66,7 +66,7 @@ namespace cinelerra namespace test { - class TargetObj; + class TestSingletonO; using cinelerra::Singleton; } // namespace test @@ -94,8 +94,8 @@ namespace cinelerra template<> - class Singleton - : public MockInjector + class Singleton + : public MockInjector { }; diff --git a/tests/50components.tests b/tests/50components.tests index 9b134ed6c..7435f21b0 100644 --- a/tests/50components.tests +++ b/tests/50components.tests @@ -103,6 +103,49 @@ out: dtor ~TargetObj(12) successfull END +TEST "SanitizedIdentifier_test" SanitizedIdentifier_test < 'Word' +out: 'a Sentence' --> 'a_Sentence' +out: 'trailing Withespace +out: ' --> 'trailing_Withespace' +out: 'with a lot +out: of Whitespace' --> 'with_a_lot_of_Whitespace' +out: 'with"much (punctuation)[]!' --> 'withmuch_(punctuation)' +out: '§&Ω%€ leading garbarge' --> 'leading_garbarge' +out: 'mixed Ω garbarge' --> 'mixed_garbarge' +out: 'Bääääh!!' --> 'Bh' +out: '§&Ω%€' --> '' +END + + +TEST "SingletonTestMock_test" SingletonTestMock_test < Testgroup=ALL @@ -139,30 +182,3 @@ out: --> remaining=SingleTestID spam --eggs END -TEST "SanitizedIdentifier_test" SanitizedIdentifier_test < 'Word' -out: 'a Sentence' --> 'a_Sentence' -out: 'trailing Withespace -out: ' --> 'trailing_Withespace' -out: 'with a lot -out: of Whitespace' --> 'with_a_lot_of_Whitespace' -out: 'with"much (punctuation)[]!' --> 'withmuch_(punctuation)' -out: '§&Ω%€ leading garbarge' --> 'leading_garbarge' -out: 'mixed Ω garbarge' --> 'mixed_garbarge' -out: 'Bääääh!!' --> 'Bh' -out: '§&Ω%€' --> '' -END - - -TEST "Singleton_test" Singleton_test 23 < instance; + Singleton instance; virtual void run(Arg arg) { @@ -135,30 +135,30 @@ namespace cinelerra */ void injectBoth () { - TargetObj* tartar = &instance(); - tartar->doIt(); - tartar->doIt(); - ASSERT (tartar->getCnt() == 2); + TestSingletonO* sing = &instance(); + sing->doIt(); + sing->doIt(); + ASSERT (sing->getCnt() == 2); instance.injectSubclass (new Mock_1); - tartar = &instance(); - tartar->doIt(); - tartar->doIt(); - tartar->doIt(); - tartar->doIt(); - tartar->doIt(); - ASSERT (tartar->getCnt() == 5); + sing = &instance(); + sing->doIt(); + sing->doIt(); + sing->doIt(); + sing->doIt(); + sing->doIt(); + ASSERT (sing->getCnt() == 5); instance.injectSubclass (new Mock_2); - tartar = &instance(); - tartar->doIt(); - ASSERT (tartar->getCnt() == 1); + sing = &instance(); + sing->doIt(); + ASSERT (sing->getCnt() == 1); instance.injectSubclass (0); // unshaddowing original instance - tartar = &instance(); - ASSERT (tartar->getCnt() == 2); - tartar->doIt(); - ASSERT (tartar->getCnt() == 3); + sing = &instance(); + ASSERT (sing->getCnt() == 2); + sing->doIt(); + ASSERT (sing->getCnt() == 3); } @@ -166,8 +166,8 @@ namespace cinelerra */ void noMock () { - TargetObj& tartar = instance(); - tartar.doIt(); + TestSingletonO& sing = instance(); + sing.doIt(); } @@ -177,8 +177,8 @@ namespace cinelerra void onlyMock () { instance.injectSubclass (new Mock_1); - TargetObj& tartar = instance(); - tartar.doIt(); + TestSingletonO& sing = instance(); + sing.doIt(); } @@ -189,15 +189,15 @@ namespace cinelerra void firstMock () { instance.injectSubclass (new Mock_1); - TargetObj* tartar = &instance(); - tartar->doIt(); - tartar->doIt(); - ASSERT (tartar->getCnt() == 2); + TestSingletonO* sing = &instance(); + sing->doIt(); + sing->doIt(); + ASSERT (sing->getCnt() == 2); instance.injectSubclass (0); - tartar = &instance(); - tartar->doIt(); - ASSERT (tartar->getCnt() == 1); + sing = &instance(); + sing->doIt(); + ASSERT (sing->getCnt() == 1); } };