[Mockpp-commits] mockpp/mockpp/tests ChainableMockObject_1_test.cpp,1.6,1.7 ChainableMockObject_1_vo
Brought to you by:
ewald-arnold
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/mockpp/tests Modified Files: ChainableMockObject_1_test.cpp ChainableMockObject_1_void_test.cpp ChainableMockObject_2_test.cpp ChainableMockObject_2_void_test.cpp ChainableMockObject_3_test.cpp ChainableMockObject_3_void_test.cpp ChainableMockObject_4_test.cpp ChainableMockObject_4_void_test.cpp ChainableMockObject_5_test.cpp ChainableMockObject_5_void_test.cpp VisitableMockObject_2_void_test.cpp VisitableMockObject_3_void_test.cpp VisitableMockObject_4_void_test.cpp VisitableMockObject_5_void_test.cpp Log Message: broader test coverage Index: ChainableMockObject_5_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_5_void_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChainableMockObject_5_void_test.cpp 3 Apr 2005 18:32:54 -0000 1.10 +++ ChainableMockObject_5_void_test.cpp 25 Jul 2005 19:02:15 -0000 1.11 @@ -47,6 +47,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + class ChainableMockObject_5_void_test : public CppUnit::TestFixture { @@ -54,6 +56,7 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_5_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST(test_controller); CPPUNIT_TEST(test_controller_ext); CPPUNIT_TEST( test_parameter_5 ); @@ -62,6 +65,7 @@ public: + void test_outbound(); void test_parameter_5(); void test_controller(); void test_controller_ext(); @@ -73,10 +77,10 @@ typedef mockpp::Invocation5<unsigned, unsigned, unsigned, unsigned, unsigned> mockpp_Invocation5_unsigned_unsigned_unsigned_unsigned_unsigned; - -MOCKPP_PTI_IMPLEMENT(mockpp_Invocation5_unsigned_unsigned_unsigned_unsigned_unsigned) - - + +MOCKPP_PTI_IMPLEMENT(mockpp_Invocation5_unsigned_unsigned_unsigned_unsigned_unsigned) + + class MyChainableMockObject_5_void_Interface { public: @@ -208,6 +212,8 @@ , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT2(const_chainable2_p, Ext) , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT1(const_chainable1_p, Ext) , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT0(const_chainable0_p, Ext) + + , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT5(outbound, Ext) {} MOCKPP_VOID_CHAINABLE_EXT5(MyChainableMockObject_5_void_ex, chainable5, const CA&, const CB&, const CC&, const CD&, CE, @@ -231,6 +237,9 @@ MOCKPP_VOID_CHAINABLE_EXT0(MyChainableMockObject_5_void_ex, chainable0, Ext); + MOCKPP_VOID_CHAINABLE_EXT5(MyChainableMockObject_5_void_ex, outbound, unsigned &, unsigned &, unsigned &, unsigned &, unsigned &, + Ext, unsigned, unsigned, unsigned, unsigned, unsigned ); + MOCKPP_VOID_CONST_CHAINABLE_EXT5(MyChainableMockObject_5_void_ex, const_chainable5, const CA&, const CB&, const CC&, const CD&, CE, Ext1, CA, CB, CC, CD, CE); @@ -370,4 +379,31 @@ } +void ChainableMockObject_5_void_test::test_outbound() +{ + MyChainableMockObject_5_void_ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_5_void_ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123), + mockpp::outBound( (unsigned int) 3123), + mockpp::outBound( (unsigned int) 4123), + mockpp::outBound( (unsigned int) 5123)); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + unsigned val4 = 0; + unsigned val5 = 0; + mcm.outbound(val1,val2, val3, val4, val5); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)4123, val4); + CPPUNIT_ASSERT_EQUAL((unsigned)5123, val5); +} + + #endif // HAVE_CPPUNIT Index: ChainableMockObject_4_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_4_test.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ChainableMockObject_4_test.cpp 2 Apr 2005 20:45:32 -0000 1.6 +++ ChainableMockObject_4_test.cpp 25 Jul 2005 19:02:14 -0000 1.7 @@ -44,6 +44,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + class ChainableMockObject_4_test : public CppUnit::TestFixture { @@ -51,12 +53,14 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_4_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST( test_parameter_4 ); CPPUNIT_TEST_SUITE_END(); public: + void test_outbound(); void test_parameter_4(); }; @@ -85,10 +89,14 @@ MyChainableMockObject_4ex(const mockpp::String &name) : mockpp::ChainableMockObject(name, 0) , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT4(chainable4, Ext) + , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT4(outbound, Ext) {} MOCKPP_CHAINABLE_EXT4(MyChainableMockObject_4ex, std::string, chainable4, const std::string &, const std::string &, const std::string &, const std::string &, std::string, Ext, std::string, std::string, std::string, std::string); + + MOCKPP_CHAINABLE_EXT4(MyChainableMockObject_4ex, int, outbound, unsigned &, unsigned &, unsigned &, unsigned &, + int, Ext, unsigned, unsigned, unsigned, unsigned); }; @@ -129,4 +137,28 @@ } +void ChainableMockObject_4_test::test_outbound() +{ + MyChainableMockObject_4ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_4ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123), + mockpp::outBound( (unsigned int) 3123), + mockpp::outBound( (unsigned int) 4123)); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + unsigned val4 = 0; + mcm.outbound(val1,val2, val3, val4); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)4123, val4); +} + + #endif // HAVE_CPPUNIT Index: ChainableMockObject_2_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_2_void_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockObject_2_void_test.cpp 3 Apr 2005 18:32:53 -0000 1.8 +++ ChainableMockObject_2_void_test.cpp 25 Jul 2005 19:02:14 -0000 1.9 @@ -45,6 +45,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + class ChainableMockObject_2_void_test : public CppUnit::TestFixture { @@ -52,12 +54,14 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_2_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST( test_parameter_2 ); CPPUNIT_TEST_SUITE_END(); public: + void test_outbound(); void test_parameter_2(); }; @@ -67,8 +71,8 @@ typedef mockpp::Invocation2<unsigned, unsigned> mockpp_Invocation2_unsigned_unsigned; - -MOCKPP_PTI_IMPLEMENT(mockpp_Invocation2_unsigned_unsigned) + +MOCKPP_PTI_IMPLEMENT(mockpp_Invocation2_unsigned_unsigned) class MyChainableMockObject_2_void : public mockpp::ChainableMockObject @@ -91,10 +95,14 @@ MyChainableMockObject_2_void_ex(const mockpp::String &name) : mockpp::ChainableMockObject(name, 0) , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT2(chainable2, Ext) + , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT2(outbound, Ext) {} MOCKPP_VOID_CHAINABLE_EXT2(MyChainableMockObject_2_void_ex, chainable2, const std::string &, const std::string &, Ext, std::string, std::string); + + MOCKPP_VOID_CHAINABLE_EXT2(MyChainableMockObject_2_void_ex, outbound, unsigned &, unsigned &, + Ext, unsigned, unsigned); }; @@ -148,5 +156,22 @@ } +void ChainableMockObject_2_void_test::test_outbound() +{ + MyChainableMockObject_2_void_ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_2_void_ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123)); + + unsigned val1 = 0; + unsigned val2 = 0; + mcm.outbound(val1,val2); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); +} + #endif // HAVE_CPPUNIT Index: ChainableMockObject_3_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_3_test.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ChainableMockObject_3_test.cpp 2 Apr 2005 20:45:32 -0000 1.5 +++ ChainableMockObject_3_test.cpp 25 Jul 2005 19:02:14 -0000 1.6 @@ -44,6 +44,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + class ChainableMockObject_3_test : public CppUnit::TestFixture { @@ -51,12 +53,14 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_3_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST( test_parameter_3 ); CPPUNIT_TEST_SUITE_END(); public: + void test_outbound(); void test_parameter_3(); }; @@ -84,10 +88,14 @@ MyChainableMockObject_3ex(const mockpp::String &name) : mockpp::ChainableMockObject(name, 0) , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT3(chainable3, Ext) + , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT3(outbound, Ext) {} MOCKPP_CHAINABLE_EXT3(MyChainableMockObject_3ex, std::string, chainable3, const std::string &, const std::string &, const std::string &, std::string, Ext, std::string, std::string, std::string); + + MOCKPP_CHAINABLE_EXT3(MyChainableMockObject_3ex, int, outbound, unsigned &, unsigned &, unsigned &, + int, Ext, unsigned, unsigned, unsigned); }; @@ -126,4 +134,25 @@ } +void ChainableMockObject_3_test::test_outbound() +{ + MyChainableMockObject_3ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_3ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123), + mockpp::outBound( (unsigned int) 3123)); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + mcm.outbound(val1,val2, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); +} + + #endif // HAVE_CPPUNIT Index: ChainableMockObject_4_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_4_void_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockObject_4_void_test.cpp 3 Apr 2005 18:32:54 -0000 1.8 +++ ChainableMockObject_4_void_test.cpp 25 Jul 2005 19:02:14 -0000 1.9 @@ -45,6 +45,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + class ChainableMockObject_4_void_test : public CppUnit::TestFixture { @@ -52,12 +54,14 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_4_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST( test_parameter_4 ); CPPUNIT_TEST_SUITE_END(); public: + void test_outbound(); void test_parameter_4(); }; @@ -67,10 +71,10 @@ typedef mockpp::Invocation4<unsigned, unsigned, unsigned, unsigned> mockpp_Invocation4_unsigned_unsigned_unsigned_unsigned; - -MOCKPP_PTI_IMPLEMENT(mockpp_Invocation4_unsigned_unsigned_unsigned_unsigned) - - + +MOCKPP_PTI_IMPLEMENT(mockpp_Invocation4_unsigned_unsigned_unsigned_unsigned) + + class MyChainableMockObject_4_void : public mockpp::ChainableMockObject { public: @@ -91,10 +95,14 @@ MyChainableMockObject_4_void_ex(const mockpp::String &name) : mockpp::ChainableMockObject(name, 0) , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT4(chainable4, Ext) + , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT4(outbound, Ext) {} MOCKPP_VOID_CHAINABLE_EXT4(MyChainableMockObject_4_void_ex, chainable4, const std::string &, const std::string &, const std::string &, const std::string &, Ext, std::string, std::string, std::string, std::string); + + MOCKPP_VOID_CHAINABLE_EXT4(MyChainableMockObject_4_void_ex, outbound, unsigned &, unsigned &, unsigned &, unsigned &, + Ext, unsigned, unsigned, unsigned, unsigned); }; @@ -152,4 +160,28 @@ } +void ChainableMockObject_4_void_test::test_outbound() +{ + MyChainableMockObject_4_void_ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_4_void_ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123), + mockpp::outBound( (unsigned int) 3123), + mockpp::outBound( (unsigned int) 4123)); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + unsigned val4 = 0; + mcm.outbound(val1,val2, val3, val4); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)4123, val4); +} + + #endif // HAVE_CPPUNIT Index: ChainableMockObject_5_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_5_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockObject_5_test.cpp 2 Apr 2005 20:45:32 -0000 1.8 +++ ChainableMockObject_5_test.cpp 25 Jul 2005 19:02:14 -0000 1.9 @@ -46,6 +46,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + class ChainableMockObject_5_test : public CppUnit::TestFixture { @@ -53,6 +55,7 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_5_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST(test_chainer); CPPUNIT_TEST(test_chainer_ext); CPPUNIT_TEST( test_parameter_5 ); @@ -61,6 +64,7 @@ public: + void test_outbound(); void test_parameter_5(); void test_chainer_ext(); void test_chainer(); @@ -197,6 +201,8 @@ , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT2(const_chainable2_p, Ext) , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT1(const_chainable1_p, Ext) , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT0(const_chainable0_p, Ext) + + , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT5(outbound, Ext) {} virtual ~MyChainableMockObject_5ex() @@ -263,6 +269,9 @@ MOCKPP_CONST_CHAINABLE_EXT0(MyChainableMockObject_5ex, int, const_chainable0_p, int, Ext); + + MOCKPP_CHAINABLE_EXT5(MyChainableMockObject_5ex, int, outbound, unsigned &, unsigned &, unsigned &, unsigned &, unsigned &, + int, Ext, unsigned, unsigned, unsigned, unsigned, unsigned ); }; @@ -345,4 +354,31 @@ } +void ChainableMockObject_5_test::test_outbound() +{ + MyChainableMockObject_5ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_5ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123), + mockpp::outBound( (unsigned int) 3123), + mockpp::outBound( (unsigned int) 4123), + mockpp::outBound( (unsigned int) 5123)); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + unsigned val4 = 0; + unsigned val5 = 0; + mcm.outbound(val1,val2, val3, val4, val5); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)4123, val4); + CPPUNIT_ASSERT_EQUAL((unsigned)5123, val5); +} + + #endif // HAVE_CPPUNIT Index: ChainableMockObject_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_1_test.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ChainableMockObject_1_test.cpp 2 Apr 2005 20:45:32 -0000 1.6 +++ ChainableMockObject_1_test.cpp 25 Jul 2005 19:02:14 -0000 1.7 @@ -42,6 +42,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + #include <cppunit/extensions/HelperMacros.h> @@ -51,12 +53,14 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_1_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST( test_parameter_1 ); CPPUNIT_TEST_SUITE_END(); public: + void test_outbound(); void test_parameter_1(); }; @@ -73,6 +77,7 @@ {} MOCKPP_CHAINABLE1(MyChainableMockObject_1, int, chainable, unsigned); + }; @@ -83,11 +88,15 @@ MyChainableMockObject_1ex(const mockpp::String &name) : mockpp::ChainableMockObject(name, 0) , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT1(chainable1, Ext) + , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT1(outbound, Ext) {} MOCKPP_CHAINABLE_EXT1(MyChainableMockObject_1ex, std::string, chainable1, const std::string &, std::string, Ext, std::string); + MOCKPP_CHAINABLE_EXT1(MyChainableMockObject_1ex, int, outbound, unsigned &, + int, Ext, unsigned ); + }; @@ -122,4 +131,24 @@ } +void ChainableMockObject_1_test::test_outbound() +{ + MyChainableMockObject_1ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_1ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 123)); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 456)); + + unsigned val = 0; + mcm.outbound(val); + CPPUNIT_ASSERT_EQUAL((unsigned)123, val); + mcm.outbound(val); + CPPUNIT_ASSERT_EQUAL((unsigned)456, val); +} + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_2_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_2_void_test.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- VisitableMockObject_2_void_test.cpp 27 Feb 2005 18:04:29 -0000 1.16 +++ VisitableMockObject_2_void_test.cpp 25 Jul 2005 19:02:15 -0000 1.17 @@ -39,6 +39,7 @@ #include <mockpp/constraint/IsEqual.h> #include <mockpp/constraint/IsNot.h> +#include <mockpp/constraint/OutBound.h> #include <mockpp/chaining/ChainingMockObjectSupport.h> @@ -53,6 +54,7 @@ CPPUNIT_TEST_SUITE( VisitableMockObject_2_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST(test_controller); CPPUNIT_TEST(test_parameter); CPPUNIT_TEST(test_parameter_ex); @@ -73,6 +75,7 @@ public: + void test_outbound(); void test_controller(); void test_thrower(); void test_clear(); @@ -124,9 +127,13 @@ : mockpp::VisitableMockObject(name, 0), MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT2(visitable2, Ext), MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT1(visitable1, Ext), - MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT0(visitable0, Ext) + MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT0(visitable0, Ext), + MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT2(outbound, Ext) {} + MOCKPP_VOID_VISITABLE_EXT2(MyVisitableMockObject_2_void_ex, outbound, unsigned &, unsigned &, + Ext, unsigned, unsigned); + MOCKPP_VOID_VISITABLE_EXT2(MyVisitableMockObject_2_void_ex, visitable2, const std::string &, const std::string &, Ext, std::string, std::string); @@ -394,4 +401,21 @@ } +void VisitableMockObject_2_void_test::test_outbound() +{ + MyVisitableMockObject_2_void_ex mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR_EXT(MyVisitableMockObject_2_void_ex, outbound, Ext) ctr1 (&mvo); + + mvo.outbound(mockpp::outBound<unsigned>(1123), + mockpp::outBound<unsigned>(2123)); + mvo.activate(); + + unsigned val1 = 0; + unsigned val2 = 0; + mvo.outbound(val1,val2); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); +} + + #endif // HAVE_CPPUNIT Index: ChainableMockObject_1_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_1_void_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockObject_1_void_test.cpp 24 Jul 2005 16:11:14 -0000 1.11 +++ ChainableMockObject_1_void_test.cpp 25 Jul 2005 19:02:14 -0000 1.12 @@ -153,7 +153,6 @@ mcm.verify(); } -#include <iostream> void ChainableMockObject_1_void_test::test_outbound() { @@ -172,7 +171,6 @@ CPPUNIT_ASSERT_EQUAL((unsigned)123, val); mcm.outbound(val); CPPUNIT_ASSERT_EQUAL((unsigned)456, val); - } Index: ChainableMockObject_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_2_test.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ChainableMockObject_2_test.cpp 2 Apr 2005 20:45:32 -0000 1.6 +++ ChainableMockObject_2_test.cpp 25 Jul 2005 19:02:14 -0000 1.7 @@ -42,6 +42,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + #include <cppunit/extensions/HelperMacros.h> class ChainableMockObject_2_test : public CppUnit::TestFixture @@ -50,13 +52,15 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_2_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST( test_parameter_2 ); CPPUNIT_TEST_SUITE_END(); public: - void test_parameter_2(); + void test_outbound(); + void test_parameter_2(); }; @@ -83,10 +87,14 @@ MyChainableMockObject_2ex(const mockpp::String &name) : mockpp::ChainableMockObject(name, 0) , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT2(chainable2, Ext) + , MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE_EXT2(outbound, Ext) {} MOCKPP_CHAINABLE_EXT2(MyChainableMockObject_2ex, std::string, chainable2, const std::string &, const std::string &, std::string, Ext, std::string, std::string); + + MOCKPP_CHAINABLE_EXT2(MyChainableMockObject_2ex, int, outbound, unsigned &, unsigned &, + int, Ext, unsigned, unsigned); }; @@ -123,4 +131,22 @@ } +void ChainableMockObject_2_test::test_outbound() +{ + MyChainableMockObject_2ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_2ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123)); + + unsigned val1 = 0; + unsigned val2 = 0; + mcm.outbound(val1,val2); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); +} + + #endif // HAVE_CPPUNIT Index: ChainableMockObject_3_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_3_void_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockObject_3_void_test.cpp 3 Apr 2005 18:32:54 -0000 1.8 +++ ChainableMockObject_3_void_test.cpp 25 Jul 2005 19:02:14 -0000 1.9 @@ -45,6 +45,8 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/chaining/Invocation.h> +#include <mockpp/constraint/OutBound.h> + class ChainableMockObject_3_void_test : public CppUnit::TestFixture { @@ -52,12 +54,14 @@ CPPUNIT_TEST_SUITE( ChainableMockObject_3_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST( test_parameter_3 ); CPPUNIT_TEST_SUITE_END(); public: + void test_outbound(); void test_parameter_3(); }; @@ -66,9 +70,9 @@ typedef mockpp::Invocation3<unsigned, unsigned, unsigned> mockpp_Invocation3_unsigned_unsigned_unsigned; - -MOCKPP_PTI_IMPLEMENT(mockpp_Invocation3_unsigned_unsigned_unsigned) - + +MOCKPP_PTI_IMPLEMENT(mockpp_Invocation3_unsigned_unsigned_unsigned) + class MyChainableMockObject_3_void : public mockpp::ChainableMockObject { @@ -90,10 +94,14 @@ MyChainableMockObject_3_void_ex(const mockpp::String &name) : mockpp::ChainableMockObject(name, 0) , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT3(chainable3, Ext) + , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_CHAINABLE_EXT3(outbound, Ext) {} MOCKPP_VOID_CHAINABLE_EXT3(MyChainableMockObject_3_void_ex, chainable3, const std::string &, const std::string &, const std::string &, Ext, std::string, std::string, std::string); + + MOCKPP_VOID_CHAINABLE_EXT3(MyChainableMockObject_3_void_ex, outbound, unsigned &, unsigned &, unsigned &, + Ext, unsigned, unsigned, unsigned ); }; @@ -149,4 +157,27 @@ } + + +void ChainableMockObject_3_void_test::test_outbound() +{ + MyChainableMockObject_3_void_ex mcm(MOCKPP_PCHAR("chainable-object")); + + MOCKPP_CHAINER_FOR_EXT(MyChainableMockObject_3_void_ex, outbound, Ext) chain(&mcm); + + chain.stubs(mockpp::once()) + .with(mockpp::outBound( (unsigned int) 1123), + mockpp::outBound( (unsigned int) 2123), + mockpp::outBound( (unsigned int) 3123)); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + mcm.outbound(val1,val2, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); +} + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_4_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_4_void_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- VisitableMockObject_4_void_test.cpp 27 Feb 2005 18:04:29 -0000 1.15 +++ VisitableMockObject_4_void_test.cpp 25 Jul 2005 19:02:15 -0000 1.16 @@ -44,6 +44,7 @@ #include <mockpp/constraint/IsEqual.h> #include <mockpp/constraint/IsNot.h> +#include <mockpp/constraint/OutBound.h> #include <cppunit/extensions/HelperMacros.h> @@ -53,6 +54,7 @@ CPPUNIT_TEST_SUITE( VisitableMockObject_4_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST(test_controller); CPPUNIT_TEST(test_parameter); CPPUNIT_TEST(test_parameter_ex); @@ -73,6 +75,7 @@ public: + void test_outbound(); void test_controller(); void test_thrower(); void test_clear(); @@ -128,9 +131,13 @@ MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT3(visitable3, Ext), MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT2(visitable2, Ext), MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT1(visitable1, Ext), - MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT0(visitable0, Ext) + MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT0(visitable0, Ext), + MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT4(outbound, Ext) {} + MOCKPP_VOID_VISITABLE_EXT4(MyVisitableMockObject_4_void_ex, outbound, unsigned &, unsigned &, unsigned &, unsigned &, + Ext, unsigned, unsigned, unsigned, unsigned); + MOCKPP_VOID_VISITABLE_EXT4(MyVisitableMockObject_4_void_ex, visitable4, const std::string &, const std::string &, const std::string &, const std::string &, Ext, std::string, std::string, std::string, std::string); @@ -422,4 +429,27 @@ } +void VisitableMockObject_4_void_test::test_outbound() +{ + MyVisitableMockObject_4_void_ex mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR_EXT(MyVisitableMockObject_4_void_ex, outbound, Ext) ctr1 (&mvo); + + mvo.outbound(mockpp::outBound<unsigned>(1123), + mockpp::outBound<unsigned>(2123), + mockpp::outBound<unsigned>(3123), + mockpp::outBound<unsigned>(4123)); + mvo.activate(); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + unsigned val4 = 0; + mvo.outbound(val1,val2, val3, val4); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)4123, val4); +} + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_5_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_5_void_test.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- VisitableMockObject_5_void_test.cpp 24 Mar 2005 21:43:07 -0000 1.20 +++ VisitableMockObject_5_void_test.cpp 25 Jul 2005 19:02:15 -0000 1.21 @@ -44,6 +44,7 @@ #include <mockpp/constraint/IsEqual.h> #include <mockpp/constraint/IsNot.h> +#include <mockpp/constraint/OutBound.h> #include "classes_ABCDE.h" @@ -55,6 +56,7 @@ CPPUNIT_TEST_SUITE( VisitableMockObject_5_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST(test_controller); CPPUNIT_TEST(test_parameter); CPPUNIT_TEST(test_parameter_ex); @@ -76,6 +78,7 @@ public: + void test_outbound(); void test_controller(); void test_thrower(); void test_clear(); @@ -322,8 +325,13 @@ , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT2(abc_const_visitable2, Ext) , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT1(abc_const_visitable1, Ext) , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT0(abc_const_visitable0, Ext) + + , MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT5(outbound, Ext) {} + MOCKPP_VOID_VISITABLE_EXT5(MyVisitableMockObject_5_void_ex, outbound, unsigned &, unsigned &, unsigned &, unsigned &, unsigned &, + Ext, unsigned, unsigned, unsigned, unsigned, unsigned ); + MOCKPP_VOID_VISITABLE_EXT5(MyVisitableMockObject_5_void_ex, visitable5, const std::string &, const std::string &, const std::string &, const std::string &, const std::string &, Ext1, std::string, std::string, std::string, std::string, std::string); @@ -858,4 +866,31 @@ mvo.verify(); } + +void VisitableMockObject_5_void_test::test_outbound() +{ + MyVisitableMockObject_5_void_ex mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR_EXT(MyVisitableMockObject_5_void_ex, outbound, Ext) ctr1 (&mvo); + + mvo.outbound(mockpp::outBound<unsigned>(1123), + mockpp::outBound<unsigned>(2123), + mockpp::outBound<unsigned>(3123), + mockpp::outBound<unsigned>(4123), + mockpp::outBound<unsigned>(5123)); + mvo.activate(); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + unsigned val4 = 0; + unsigned val5 = 0; + mvo.outbound(val1,val2, val3, val4,val5); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)4123, val4); + CPPUNIT_ASSERT_EQUAL((unsigned)5123, val5); +} + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_3_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_3_void_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- VisitableMockObject_3_void_test.cpp 27 Feb 2005 18:04:29 -0000 1.15 +++ VisitableMockObject_3_void_test.cpp 25 Jul 2005 19:02:15 -0000 1.16 @@ -39,6 +39,7 @@ #include <mockpp/constraint/IsEqual.h> #include <mockpp/constraint/IsNot.h> +#include <mockpp/constraint/OutBound.h> #include <mockpp/chaining/ChainingMockObjectSupport.h> @@ -53,6 +54,7 @@ CPPUNIT_TEST_SUITE( VisitableMockObject_3_void_test ); + CPPUNIT_TEST(test_outbound); CPPUNIT_TEST(test_controller); CPPUNIT_TEST(test_parameter); CPPUNIT_TEST(test_parameter_ex); @@ -73,6 +75,7 @@ public: + void test_outbound(); void test_controller(); void test_thrower(); void test_clear(); @@ -126,9 +129,13 @@ MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT3(visitable3, Ext), MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT2(visitable2, Ext), MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT1(visitable1, Ext), - MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT0(visitable0, Ext) + MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT0(visitable0, Ext), + MOCKPP_CONSTRUCT_MEMBERS_FOR_VOID_VISITABLE_EXT3(outbound, Ext) {} + MOCKPP_VOID_VISITABLE_EXT3(MyVisitableMockObject_3_void_ex, outbound, unsigned &, unsigned &, unsigned &, + Ext, unsigned, unsigned, unsigned); + MOCKPP_VOID_VISITABLE_EXT3(MyVisitableMockObject_3_void_ex, visitable3, const std::string &, const std::string &, const std::string &, Ext, std::string, std::string, std::string); @@ -408,4 +415,24 @@ } +void VisitableMockObject_3_void_test::test_outbound() +{ + MyVisitableMockObject_3_void_ex mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR_EXT(MyVisitableMockObject_3_void_ex, outbound, Ext) ctr1 (&mvo); + + mvo.outbound(mockpp::outBound<unsigned>(1123), + mockpp::outBound<unsigned>(2123), + mockpp::outBound<unsigned>(3123)); + mvo.activate(); + + unsigned val1 = 0; + unsigned val2 = 0; + unsigned val3 = 0; + mvo.outbound(val1,val2, val3); + CPPUNIT_ASSERT_EQUAL((unsigned)1123, val1); + CPPUNIT_ASSERT_EQUAL((unsigned)2123, val2); + CPPUNIT_ASSERT_EQUAL((unsigned)3123, val3); +} + + #endif // HAVE_CPPUNIT |