[Mockpp-commits] mockpp/mockpp/tests AbstractDynamicChainingMock_test.cpp,1.31,1.32 ChainableMockMet
Brought to you by:
ewald-arnold
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14497/mockpp/tests Modified Files: AbstractDynamicChainingMock_test.cpp ChainableMockMethod_1_test.cpp ChainableMockMethod_2_test.cpp ChainableMockMethod_test.cpp ChainableMockObject_1_test.cpp ChainableMockObject_2_test.cpp ChainableMockObject_3_test.cpp ChainableMockObject_4_test.cpp ChainableMockObject_5_test.cpp ChainableMockObject_test.cpp ChainingMockBuilder_test.cpp ChainingMockObjectSupport_test.cpp CoreMock_test.cpp FIFOInvocationDispatcher_test.cpp InvocationMockerBuilder_test.cpp InvocationMocker_test.cpp LIFOInvocationDispatcher_test.cpp StubBuilder_test.cpp StubSequence_test.cpp TypelessStubSequence_test.cpp Log Message: use shorthand function Index: LIFOInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/LIFOInvocationDispatcher_test.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- LIFOInvocationDispatcher_test.cpp 15 Oct 2005 15:40:59 -0000 1.18 +++ LIFOInvocationDispatcher_test.cpp 18 Oct 2005 20:03:54 -0000 1.19 @@ -35,6 +35,7 @@ #else +#include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/LIFOInvocationDispatcher.h> #include <mockpp/chaining/Invocation.h> #include <mockpp/chaining/Invokable.h> @@ -193,7 +194,7 @@ ti1->invoke_return = 1; ti2->invoke_return = 2; - id.setDefaultStub(new mockpp::ReturnStub<int>(3)); + id.setDefaultStub(mockpp::returnValue<int>(3)); MOCKPP_ASSERT_TRUE(2 == id.doDispatch(ginv)); ti2->match_result = false; Index: StubSequence_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/StubSequence_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- StubSequence_test.cpp 15 Oct 2005 15:40:59 -0000 1.13 +++ StubSequence_test.cpp 18 Oct 2005 20:03:54 -0000 1.14 @@ -41,6 +41,8 @@ #include <mockpp/stub/ReturnStub.h> #include <mockpp/stub/ThrowStub.h> +#include <mockpp/chaining/ChainingMockObjectSupport.h> + #include <cppunit/extensions/HelperMacros.h> class StubSequence_test : public CppUnit::TestFixture @@ -68,8 +70,8 @@ { std::vector<mockpp::Stub<int, int>* > sv; mockpp::ReturnStub<int> rs (12); - sv.push_back(new mockpp::TypelessStubAdapter<int, int>(new mockpp::ReturnStub<int>(12))); - sv.push_back(new mockpp::TypelessStubAdapter<int, int>(new mockpp::ReturnStub<int>(34))); + sv.push_back(new mockpp::TypelessStubAdapter<int, int>(mockpp::returnValue<int>(12))); + sv.push_back(new mockpp::TypelessStubAdapter<int, int>(mockpp::returnValue<int>(34))); mockpp::StubSequence<int, int> ss (sv.begin(), sv.end()); mockpp::String b = MOCKPP_GET_STRING("abcd"); @@ -86,9 +88,9 @@ void StubSequence_test::test_invoke() { std::vector<mockpp::Stub<int, int>* > sv; - sv.push_back(new mockpp::TypelessStubAdapter<int, int>(new mockpp::ReturnStub<int>(12))); - sv.push_back(new mockpp::TypelessStubAdapter<int, int>(new mockpp::ReturnStub<int>(34))); - sv.push_back(new mockpp::TypelessStubAdapter<int, int>(new mockpp::ReturnStub<int>(56))); + sv.push_back(new mockpp::TypelessStubAdapter<int, int>(mockpp::returnValue<int>(12))); + sv.push_back(new mockpp::TypelessStubAdapter<int, int>(mockpp::returnValue<int>(34))); + sv.push_back(new mockpp::TypelessStubAdapter<int, int>(mockpp::returnValue<int>(56))); mockpp::StubSequence<int, int> ss(sv.begin(), sv.end()); Index: TypelessStubSequence_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/TypelessStubSequence_test.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TypelessStubSequence_test.cpp 15 Oct 2005 15:40:59 -0000 1.3 +++ TypelessStubSequence_test.cpp 18 Oct 2005 20:03:54 -0000 1.4 @@ -37,6 +37,8 @@ #include <vector> +#include <mockpp/chaining/ChainingMockObjectSupport.h> + #include <mockpp/stub/TypelessStubSequence.h> #include <mockpp/stub/ReturnStub.h> #include <mockpp/stub/ThrowStub.h> @@ -68,7 +70,7 @@ { std::vector<mockpp::TypelessStub<int>* > sv; mockpp::ReturnStub<int> rs (12); - sv.push_back(new mockpp::ReturnStub<int>(12)); + sv.push_back(new mockpp::ReturnStub<int>(12)); // @todo mockpp::returnValue sv.push_back(new mockpp::ReturnStub<int>(34)); mockpp::TypelessStubSequence<int> ss (sv.begin(), sv.end()); Index: ChainableMockObject_3_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_3_test.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockObject_3_test.cpp 15 Oct 2005 15:40:58 -0000 1.7 +++ ChainableMockObject_3_test.cpp 18 Oct 2005 20:03:54 -0000 1.8 @@ -109,13 +109,13 @@ .with(mockpp::eq( (unsigned int) 12), mockpp::eq( (unsigned int) 34), mockpp::eq( (unsigned int) 56)) - .will(new mockpp::ReturnStub<int>(123456)); + .will(mockpp::returnValue<int>(123456)); chain.stubs(mockpp::once()) .with(mockpp::eq( (unsigned int) 65), mockpp::eq( (unsigned int) 43), mockpp::eq( (unsigned int) 21)) - .will(new mockpp::ReturnStub<int>(654321)); + .will(mockpp::returnValue<int>(654321)); MOCKPP_ASSERT_TRUE(mcm.chainable(12, 34, 56) == 123456); MOCKPP_ASSERT_TRUE(mcm.chainable(65, 43, 21) == 654321); Index: ChainableMockMethod_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_2_test.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ChainableMockMethod_2_test.cpp 16 Oct 2005 12:26:46 -0000 1.4 +++ ChainableMockMethod_2_test.cpp 18 Oct 2005 20:03:53 -0000 1.5 @@ -106,12 +106,12 @@ chain.stubs(mockpp::once()) .with(mockpp::eq<unsigned>(12u), mockpp::eq<long>(23)) - .will(new mockpp::ReturnStub<int>(21)); + .will(mockpp::returnValue<int>(21)); chain.stubs(mockpp::once()) .with(mockpp::eq<unsigned>(34), mockpp::eq<long>(45)) - .will(new mockpp::ReturnStub<int>(43)); + .will(mockpp::returnValue<int>(43)); MOCKPP_ASSERT_TRUE(mcm.chainable(12, 23) == 21); MOCKPP_ASSERT_TRUE(mcm.chainable(34, 45) == 43); Index: InvocationMockerBuilder_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvocationMockerBuilder_test.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- InvocationMockerBuilder_test.cpp 15 Oct 2005 15:40:58 -0000 1.29 +++ InvocationMockerBuilder_test.cpp 18 Oct 2005 20:03:54 -0000 1.30 @@ -38,6 +38,8 @@ #include <mockpp/builder/InvocationMockerBuilder.h> #include <mockpp/builder/ArgumentsMatchBuilder.h> +#include <mockpp/chaining/ChainingMockObjectSupport.h> + #include <mockpp/matcher/InvokeCountMatcher.h> #include <mockpp/chaining/mockpp_pti.h> @@ -185,7 +187,7 @@ MOCKPP_ASSERT_TRUE( mocker.last_matcher->toString() == MOCKPP_PCHAR( "(equalTo CA&, equalTo CB&, equalTo CC&, equalTo CD&, equalTo CE&)" ) ); MOCKPP_ASSERT_TRUE( table.lookupID( MOCKPP_PCHAR( "with5counter" ) )->getBuilder() == &imb ); - imb.setStub( new mockpp::ReturnStub<int>( 2 ) ); + imb.setStub( mockpp::returnValue<int>( 2 ) ); MOCKPP_ASSERT_TRUE( mocker.last_stub->toString() == MOCKPP_PCHAR( "returns <2>" ) ); } @@ -219,7 +221,7 @@ MOCKPP_ASSERT_TRUE( mocker.last_matcher->toString() == MOCKPP_PCHAR( "(no arguments)" ) ); MOCKPP_ASSERT_TRUE( table.lookupID( MOCKPP_PCHAR( "with0counter" ) )->getBuilder() == &imb ); - imb.setStub( new mockpp::ReturnStub<int>( 5 ) ); + imb.setStub( mockpp::returnValue<int>( 5 ) ); MOCKPP_ASSERT_TRUE( mocker.last_stub->toString() == MOCKPP_PCHAR( "returns <5>" ) ); } Index: AbstractDynamicChainingMock_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractDynamicChainingMock_test.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- AbstractDynamicChainingMock_test.cpp 15 Oct 2005 15:40:58 -0000 1.31 +++ AbstractDynamicChainingMock_test.cpp 18 Oct 2005 20:03:53 -0000 1.32 @@ -292,7 +292,7 @@ md1->invocation_result = 10; md1->enable_except = false; cmd.addInvokable(md1); - cmd.setDefaultStub(new mockpp::ReturnStub<int>(33)); + cmd.setDefaultStub(mockpp::returnValue<int>(33)); md1->match_result = false; MOCKPP_ASSERT_TRUE(cmd.invoke(inv) == 33); Index: ChainingMockBuilder_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainingMockBuilder_test.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- ChainingMockBuilder_test.cpp 15 Oct 2005 15:40:58 -0000 1.18 +++ ChainingMockBuilder_test.cpp 18 Oct 2005 20:03:54 -0000 1.19 @@ -196,7 +196,7 @@ cmd.string_return = MOCKPP_PCHAR( "describe??" ); MOCKPP_ASSERT_TRUE( cm.toString() == MOCKPP_PCHAR( "describe??" ) ); - cm.setDefaultStub( new mockpp::ReturnStub<int>( 123 ) ); + cm.setDefaultStub( mockpp::returnValue<int>( 123 ) ); MOCKPP_ASSERT_TRUE( cmd.stub->toString() == MOCKPP_PCHAR( "returns <123>" ) ); cmd.resetted = false; @@ -216,7 +216,7 @@ InvokableDummy<int, Getter5Invocation> *id = new InvokableDummy<int, Getter5Invocation>; - cm.stubs().will( new mockpp::ReturnStub<int>( 321 ) ).id( MOCKPP_PCHAR( "id1a" ) ); + cm.stubs().will( mockpp::returnValue<int>( 321 ) ).id( MOCKPP_PCHAR( "id1a" ) ); cm.stubs().will( new mockpp::ThrowStub<int>( mockpp::make_throwable( 1 ) ) ).id( MOCKPP_PCHAR( "id1b" ) ); Index: ChainableMockObject_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_1_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockObject_1_test.cpp 15 Oct 2005 15:40:58 -0000 1.8 +++ ChainableMockObject_1_test.cpp 18 Oct 2005 20:03:54 -0000 1.9 @@ -108,11 +108,11 @@ chain.stubs(mockpp::once()) .with(mockpp::eq((unsigned int) 12)) - .will(new mockpp::ReturnStub<int>(21)); + .will(mockpp::returnValue<int>(21)); chain.stubs(mockpp::once()) .with(mockpp::eq((unsigned int) 34)) // @todoc pitfall - .will(new mockpp::ReturnStub<int>(43)); + .will(mockpp::returnValue<int>(43)); MOCKPP_ASSERT_TRUE(mcm.chainable(12) == 21); MOCKPP_ASSERT_TRUE(mcm.chainable(34) == 43); Index: ChainableMockObject_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_test.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- ChainableMockObject_test.cpp 15 Oct 2005 15:40:58 -0000 1.21 +++ ChainableMockObject_test.cpp 18 Oct 2005 20:03:54 -0000 1.22 @@ -146,10 +146,10 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject, chainable_a) chain(&mcm); - chain.setDefaultStub(new mockpp::ReturnStub<int>(321)); + chain.setDefaultStub(mockpp::returnValue<int>(321)); chain.expects(mockpp::exactly(2)) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-2")); MOCKPP_ASSERT_TRUE(mcm.chainable_a() == 456); @@ -190,14 +190,14 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject, chainable_a) chain(&mcm); chain.stubs(mockpp::exactly(2)) - .will(new mockpp::ReturnStub<int>(123)); + .will(mockpp::returnValue<int>(123)); chain.stubs(mockpp::once()) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-2")); chain.stubs() - .will(new mockpp::ReturnStub<int>(789)) + .will(mockpp::returnValue<int>(789)) .id(MOCKPP_PCHAR("chainable-3")); MOCKPP_ASSERT_TRUE(mcm.chainable_a() == 123); @@ -252,22 +252,22 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject, chainable_d) chain_d(&mcm); chain_a.expects(mockpp::once()) - .will(new mockpp::ReturnStub<int>(123)) + .will(mockpp::returnValue<int>(123)) .id(MOCKPP_PCHAR("chainable-a")); chain_b.expects(mockpp::once()) .after(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-b")); chain_c.expects(mockpp::once()) .after(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(789)) + .will(mockpp::returnValue<int>(789)) .id(MOCKPP_PCHAR("chainable-c")); chain_d.expects(mockpp::once()) .after(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(111)) + .will(mockpp::returnValue<int>(111)) .id(MOCKPP_PCHAR("chainable-d")); MOCKPP_ASSERT_TRUE(mcm.chainable_a() == 123); @@ -290,21 +290,21 @@ chain_a.expects(mockpp::once()) .after(MOCKPP_PCHAR("chainable-d")) - .will(new mockpp::ReturnStub<int>(123)) + .will(mockpp::returnValue<int>(123)) .id(MOCKPP_PCHAR("chainable-a")); chain_b.expects(mockpp::once()) .after(MOCKPP_PCHAR("chainable-d")) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-b")); chain_c.expects(mockpp::once()) .after(MOCKPP_PCHAR("chainable-d")) - .will(new mockpp::ReturnStub<int>(789)) + .will(mockpp::returnValue<int>(789)) .id(MOCKPP_PCHAR("chainable-c")); chain_d.expects(mockpp::once()) - .will(new mockpp::ReturnStub<int>(111)) + .will(mockpp::returnValue<int>(111)) .id(MOCKPP_PCHAR("chainable-d")); MOCKPP_ASSERT_TRUE(mcm.chainable_d() == 111); @@ -325,11 +325,11 @@ chain_a.expects(mockpp::once()) .after(MOCKPP_PCHAR("chainable-b")) - .will(new mockpp::ReturnStub<int>(123)) + .will(mockpp::returnValue<int>(123)) .id(MOCKPP_PCHAR("chainable-a")); chain_b.expects(mockpp::once()) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-b")); try @@ -358,21 +358,21 @@ chain_d.expects(mockpp::once()) .before(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(111)) + .will(mockpp::returnValue<int>(111)) .id(MOCKPP_PCHAR("chainable-d")); chain_c.expects(mockpp::once()) .before(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(789)) + .will(mockpp::returnValue<int>(789)) .id(MOCKPP_PCHAR("chainable-c")); chain_b.expects(mockpp::once()) .before(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(123)) + .will(mockpp::returnValue<int>(123)) .id(MOCKPP_PCHAR("chainable-b")); chain_a.expects(mockpp::once()) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-a")); MOCKPP_ASSERT_TRUE(mcm.chainable_d() == 111); @@ -394,22 +394,22 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject, chainable_d) chain_d(&mcm); chain_a.expects(mockpp::once()) - .will(new mockpp::ReturnStub<int>(123)) + .will(mockpp::returnValue<int>(123)) .id(MOCKPP_PCHAR("chainable-a")); chain_b.expects(mockpp::once()) .before(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-b")); chain_c.expects(mockpp::once()) .before(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(789)) + .will(mockpp::returnValue<int>(789)) .id(MOCKPP_PCHAR("chainable-c")); chain_d.expects(mockpp::once()) .before(MOCKPP_PCHAR("chainable-a")) - .will(new mockpp::ReturnStub<int>(111)) + .will(mockpp::returnValue<int>(111)) .id(MOCKPP_PCHAR("chainable-d")); MOCKPP_ASSERT_TRUE(mcm.chainable_d() == 111); @@ -430,11 +430,11 @@ chain_a.expects(mockpp::once()) .before(MOCKPP_PCHAR("chainable-b")) - .will(new mockpp::ReturnStub<int>(123)) + .will(mockpp::returnValue<int>(123)) .id(MOCKPP_PCHAR("chainable-a")); chain_b.expects(mockpp::once()) - .will(new mockpp::ReturnStub<int>(456)) + .will(mockpp::returnValue<int>(456)) .id(MOCKPP_PCHAR("chainable-b")); MOCKPP_ASSERT_TRUE(mcm.chainable_b() == 456); @@ -459,7 +459,7 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject, chainable_e_Shadow) chain(&mcm); - chain.setDefaultStub(new mockpp::ReturnStub<int>(321)); + chain.setDefaultStub(mockpp::returnValue<int>(321)); MOCKPP_ASSERT_TRUE(mcm.chainable_e() == 321); Index: FIFOInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/FIFOInvocationDispatcher_test.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- FIFOInvocationDispatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.19 +++ FIFOInvocationDispatcher_test.cpp 18 Oct 2005 20:03:54 -0000 1.20 @@ -35,6 +35,7 @@ #else +#include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/FIFOInvocationDispatcher.h> #include <mockpp/chaining/Invokable.h> #include <mockpp/chaining/Invocation.h> @@ -193,7 +194,7 @@ ti1->invoke_return = 1; ti2->invoke_return = 2; - id.setDefaultStub(new mockpp::ReturnStub<int>(3)); + id.setDefaultStub(mockpp::returnValue<int>(3)); MOCKPP_ASSERT_TRUE(1 == id.doDispatch(ginv)); ti1->match_result = false; Index: ChainableMockObject_5_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_5_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChainableMockObject_5_test.cpp 15 Oct 2005 15:40:58 -0000 1.10 +++ ChainableMockObject_5_test.cpp 18 Oct 2005 20:03:54 -0000 1.11 @@ -287,7 +287,7 @@ mockpp::eq( (unsigned int) 34), mockpp::eq( (unsigned int) 45), mockpp::eq( (unsigned int) 56)) - .will(new mockpp::ReturnStub<int>(12345)); + .will(mockpp::returnValue<int>(12345)); chain.stubs(mockpp::once()) .with(mockpp::eq( (unsigned int) 65), @@ -295,7 +295,7 @@ mockpp::eq( (unsigned int) 43), mockpp::eq( (unsigned int) 32), mockpp::eq( (unsigned int) 21)) - .will(new mockpp::ReturnStub<int>(54321)); + .will(mockpp::returnValue<int>(54321)); MOCKPP_ASSERT_TRUE(mcm.chainable_i(12, 23, 34, 45, 56) == 12345); MOCKPP_ASSERT_TRUE(mcm.chainable_i(65, 54, 43, 32, 21) == 54321); Index: ChainableMockObject_4_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_4_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockObject_4_test.cpp 15 Oct 2005 15:40:58 -0000 1.8 +++ ChainableMockObject_4_test.cpp 18 Oct 2005 20:03:54 -0000 1.9 @@ -111,14 +111,14 @@ mockpp::eq( (unsigned int) 34), mockpp::eq( (unsigned int) 56), mockpp::eq( (unsigned int) 78)) - .will(new mockpp::ReturnStub<int>(12345678)); + .will(mockpp::returnValue<int>(12345678)); chain.stubs(mockpp::once()) .with(mockpp::eq( (unsigned int) 87), mockpp::eq( (unsigned int) 65), mockpp::eq( (unsigned int) 43), mockpp::eq( (unsigned int) 21)) - .will(new mockpp::ReturnStub<int>(87654321)); + .will(mockpp::returnValue<int>(87654321)); MOCKPP_ASSERT_TRUE(mcm.chainable(12, 34, 56, 78) == 12345678); MOCKPP_ASSERT_TRUE(mcm.chainable(87, 65, 43, 21) == 87654321); Index: InvocationMocker_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvocationMocker_test.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- InvocationMocker_test.cpp 15 Oct 2005 15:40:58 -0000 1.36 +++ InvocationMocker_test.cpp 18 Oct 2005 20:03:54 -0000 1.37 @@ -37,6 +37,7 @@ #include <mockpp/chaining/InvocationMocker.h> +#include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/mockpp_pti.h> #include <mockpp/stub/ReturnStub.h> #include <mockpp/stub/ThrowStub.h> @@ -334,7 +335,7 @@ MyInvocationMatcher<GetterInvocation> *ivm1 = new MyInvocationMatcher<GetterInvocation>; MyInvocationMatcher<GetterInvocation> *ivm2 = new MyInvocationMatcher<GetterInvocation>; - im.setStub(new mockpp::ReturnStub<int>(13)); + im.setStub(mockpp::returnValue<int>(13)); im.setName(MOCKPP_PCHAR("magic-name")); im.addMatcher( ivm1 ); im.addMatcher( ivm2 ); @@ -375,7 +376,7 @@ mockpp::InvocationMatcher<GetterInvocation> *ivm1 = new mockpp::ArgumentsMatcher<GetterInvocation>(cs1); mockpp::InvocationMatcher<GetterInvocation> *ivm2 = new mockpp::ArgumentsMatcher<GetterInvocation>(cs2); - im.setStub(new mockpp::ReturnStub<int>(42)); + im.setStub(mockpp::returnValue<int>(42)); im.setName(MOCKPP_PCHAR("magic-name")); im.addMatcher( ivm1 ); im.addMatcher( ivm2 ); Index: ChainableMockMethod_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_1_test.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ChainableMockMethod_1_test.cpp 16 Oct 2005 12:26:46 -0000 1.5 +++ ChainableMockMethod_1_test.cpp 18 Oct 2005 20:03:53 -0000 1.6 @@ -106,11 +106,11 @@ chain.stubs(mockpp::once()) .with(mockpp::eq((unsigned int) 12)) - .will(new mockpp::ReturnStub<int>(21)); + .will(mockpp::returnValue<int>(21)); chain.stubs(mockpp::once()) .with(mockpp::eq((unsigned int) 34)) - .will(new mockpp::ReturnStub<int>(43)); + .will(mockpp::returnValue<int>(43)); MOCKPP_ASSERT_TRUE(mcm.chainable(12) == 21); MOCKPP_ASSERT_TRUE(mcm.chainable(34) == 43); Index: ChainableMockObject_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_2_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockObject_2_test.cpp 15 Oct 2005 15:40:58 -0000 1.8 +++ ChainableMockObject_2_test.cpp 18 Oct 2005 20:03:54 -0000 1.9 @@ -107,12 +107,12 @@ chain.stubs(mockpp::once()) .with(mockpp::eq( (unsigned int) 12), mockpp::eq( (unsigned int) 34)) - .will(new mockpp::ReturnStub<int>(1234)); + .will(mockpp::returnValue<int>(1234)); chain.stubs(mockpp::once()) .with(mockpp::eq( (unsigned int) 43), mockpp::eq( (unsigned int) 21)) - .will(new mockpp::ReturnStub<int>(4321)); + .will(mockpp::returnValue<int>(4321)); MOCKPP_ASSERT_TRUE(mcm.chainable(12, 34) == 1234); MOCKPP_ASSERT_TRUE(mcm.chainable(43, 21) == 4321); Index: ChainingMockObjectSupport_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainingMockObjectSupport_test.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- ChainingMockObjectSupport_test.cpp 15 Oct 2005 15:40:58 -0000 1.31 +++ ChainingMockObjectSupport_test.cpp 18 Oct 2005 20:03:54 -0000 1.32 @@ -394,7 +394,7 @@ void ChainingMockObjectSupport_test::test_actor() { - mockpp::TypelessStub<int>::AP stub (mockpp::returnValue<int>( 1 )); + mockpp::TypelessStub<int>::AP stub (new mockpp::ReturnStub<int>( 1 )); MOCKPP_ASSERT_TRUE( stub->toString() == MOCKPP_PCHAR( "returns <1>" ) ); @@ -465,7 +465,7 @@ { mockpp::TypelessStub<long>::AP stub; - stub = mockpp::onConsecutiveCalls( new mockpp::ReturnStub<long>( 1 ), + stub = mockpp::onConsecutiveCalls( new mockpp::ReturnStub<long>( 1 ), // @todo mockpp::returnValue new mockpp::ReturnStub<long>( 2 )); MOCKPP_ASSERT_TRUE( stub->toString() == MOCKPP_PCHAR( "returns <1>, and then returns <2>" ) ); Index: ChainableMockMethod_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_test.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ChainableMockMethod_test.cpp 17 Oct 2005 19:13:43 -0000 1.4 +++ ChainableMockMethod_test.cpp 18 Oct 2005 20:03:53 -0000 1.5 @@ -105,10 +105,10 @@ mockpp::ChainableMockMethod0<int>::ChainerFor chain(mcm.chainable_mocker); chain.stubs(mockpp::once()) - .will(new mockpp::ReturnStub<int>(21)); + .will(mockpp::returnValue<int>(21)); chain.stubs(mockpp::once()) - .will(new mockpp::ReturnStub<int>(43)); + .will(mockpp::returnValue<int>(43)); MOCKPP_ASSERT_TRUE(mcm.chainable() == 21); MOCKPP_ASSERT_TRUE(mcm.chainable() == 43); Index: StubBuilder_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/StubBuilder_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- StubBuilder_test.cpp 15 Oct 2005 15:40:59 -0000 1.15 +++ StubBuilder_test.cpp 18 Oct 2005 20:03:54 -0000 1.16 @@ -41,6 +41,7 @@ #include <mockpp/builder/StubBuilder.h> +#include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/mockpp_pti.h> #include <mockpp/stub/ReturnStub.h> #include <mockpp/stub/StubHolder.h> @@ -110,7 +111,7 @@ GetterInvocation ginv(MOCKPP_PCHAR("InvocationDummy::getProp5"), ca, cb, cc, cd, ce); MyStubBuilder<int, GetterInvocation> sbi; - sbi.will(new mockpp::ReturnStub<int>(123)); + sbi.will(mockpp::returnValue<int>(123)); MOCKPP_ASSERT_TRUE(sbi.stub->invoke(ginv) == 123); MyStubBuilder<void, VoidInvocation> sbv; Index: CoreMock_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/CoreMock_test.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- CoreMock_test.cpp 15 Oct 2005 15:40:58 -0000 1.22 +++ CoreMock_test.cpp 18 Oct 2005 20:03:54 -0000 1.23 @@ -40,6 +40,7 @@ #include <mockpp/chaining/LIFOInvocationDispatcher.h> #include <mockpp/chaining/FIFOInvocationDispatcher.h> +#include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/mockpp_pti.h> #include <mockpp/stub/ReturnStub.h> @@ -170,7 +171,7 @@ MatcherDummy<GetterInvocation> *md1 = new MatcherDummy<GetterInvocation>; md1->invocation_result = 10; cmd.addInvokable( md1 ); - cmd.setDefaultStub( new mockpp::ReturnStub<int>( 33 ) ); + cmd.setDefaultStub( mockpp::returnValue<int>( 33 ) ); md1->match_result = false; MOCKPP_ASSERT_TRUE( cmd.invoke( inv ) == 33 ); |