[Mockpp-commits] mockpp/mockpp/tests AbstractDynamicChainingMock_test.cpp,1.20,1.21 AbstractInvocati
Brought to you by:
ewald-arnold
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24081/mockpp/tests Modified Files: AbstractDynamicChainingMock_test.cpp AbstractInvocationDispatcher_test.cpp AssertMo_test.cpp ChainingMockBuilder_test.cpp CoreMock_test.cpp FIFOInvocationDispatcher_test.cpp InvocationMocker_test.cpp LIFOInvocationDispatcher_test.cpp Makefile.am ReturnObjectList_test.cpp ThrowableList_test.cpp TrackingCounter_test.cpp Verifiable_test.cpp VerifyingTestCaller_test.cpp VisitableMockObject_1_test.cpp VisitableMockObject_1_void_test.cpp VisitableMockObject_2_test.cpp VisitableMockObject_2_void_test.cpp VisitableMockObject_3_test.cpp VisitableMockObject_3_void_test.cpp VisitableMockObject_4_test.cpp VisitableMockObject_4_void_test.cpp VisitableMockObject_5_test.cpp VisitableMockObject_5_void_test.cpp VisitableMockObject_test.cpp VisitableMockObject_void_test.cpp compilecheck.cpp Log Message: - VisitableMockObjects optionally take Constraints - mock objects reset all their sub objects - all mock objects get their own reset() method - ReturnObjectList has a default return value - changed "verify() const" to "verify()" Index: LIFOInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/LIFOInvocationDispatcher_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** LIFOInvocationDispatcher_test.cpp 12 Jan 2005 20:24:30 -0000 1.14 --- LIFOInvocationDispatcher_test.cpp 27 Feb 2005 11:48:16 -0000 1.15 *************** *** 97,100 **** --- 97,103 ---- } + virtual void reset() + {} + virtual bool hasDescription() { *************** *** 107,111 **** } ! virtual void verify() const { } --- 110,114 ---- } ! virtual void verify() { } *************** *** 141,145 **** } ! virtual void verify() const { } --- 144,151 ---- } ! virtual void reset() ! {} ! ! virtual void verify() { } Index: compilecheck.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/compilecheck.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** compilecheck.cpp 28 Aug 2004 17:55:20 -0000 1.22 --- compilecheck.cpp 27 Feb 2005 11:48:16 -0000 1.23 *************** *** 63,67 **** {} ! virtual void verify() const { // throw AssertionFailedError(); --- 63,67 ---- {} ! virtual void verify() { // throw AssertionFailedError(); *************** *** 98,102 **** ! virtual void verify() const { // throw AssertionFailedException(); --- 98,102 ---- ! virtual void verify() { // throw AssertionFailedException(); *************** *** 141,145 **** ! virtual void verify() const { // throw AssertionFailedException(); --- 141,145 ---- ! virtual void verify() { // throw AssertionFailedException(); Index: ChainingMockBuilder_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainingMockBuilder_test.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ChainingMockBuilder_test.cpp 22 Jan 2005 20:41:04 -0000 1.16 --- ChainingMockBuilder_test.cpp 27 Feb 2005 11:48:16 -0000 1.17 *************** *** 103,106 **** --- 103,109 ---- } + virtual void reset() + {} + virtual bool hasDescription() { *************** *** 113,117 **** } ! virtual void verify() const { verified = true; --- 116,120 ---- } ! virtual void verify() { verified = true; *************** *** 172,176 **** } ! virtual void verify() const { verified = true; --- 175,179 ---- } ! virtual void verify() { verified = true; Index: AbstractDynamicChainingMock_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractDynamicChainingMock_test.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** AbstractDynamicChainingMock_test.cpp 12 Jan 2005 20:24:30 -0000 1.20 --- AbstractDynamicChainingMock_test.cpp 27 Feb 2005 11:48:16 -0000 1.21 *************** *** 126,129 **** --- 126,133 ---- } + virtual void reset() + { + } + virtual int invoke( const I &/*invocation*/ ) { *************** *** 136,140 **** } ! virtual void verify() const { if (enable_except) --- 140,144 ---- } ! virtual void verify() { if (enable_except) *************** *** 170,173 **** --- 174,181 ---- } + virtual void reset() + { + } + virtual void invoke( const I &/*invocation*/ ) { *************** *** 179,183 **** } ! virtual void verify() const { if (enable_except) --- 187,191 ---- } ! virtual void verify() { if (enable_except) Index: TrackingCounter_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/TrackingCounter_test.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TrackingCounter_test.cpp 19 Feb 2005 15:56:10 -0000 1.3 --- TrackingCounter_test.cpp 27 Feb 2005 11:48:16 -0000 1.4 *************** *** 115,119 **** {} ! void verify() const {} --- 115,122 ---- {} ! virtual void verify() ! {} ! ! virtual void reset() {} Index: FIFOInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/FIFOInvocationDispatcher_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** FIFOInvocationDispatcher_test.cpp 12 Jan 2005 20:24:30 -0000 1.14 --- FIFOInvocationDispatcher_test.cpp 27 Feb 2005 11:48:16 -0000 1.15 *************** *** 92,95 **** --- 92,98 ---- } + virtual void reset() + {} + virtual R invoke( const I &/*invocation*/ ) { *************** *** 107,111 **** } ! virtual void verify() const { } --- 110,114 ---- } ! virtual void verify() { } *************** *** 131,134 **** --- 134,140 ---- } + virtual void reset() + {} + virtual bool hasDescription() { *************** *** 141,145 **** } ! virtual void verify() const { } --- 147,151 ---- } ! virtual void verify() { } Index: AssertMo_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AssertMo_test.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** AssertMo_test.cpp 29 Jan 2005 13:54:48 -0000 1.20 --- AssertMo_test.cpp 27 Feb 2005 11:48:16 -0000 1.21 *************** *** 309,316 **** public: MyVerifiable() ! : mockpp::Verifiable(MOCKPP_PCHAR("myVer"), 0) {} ! virtual void verify() const { throw mockpp::AssertionFailedError(__LINE__, __FILE__, --- 309,320 ---- public: MyVerifiable() ! : mockpp::Verifiable(MOCKPP_PCHAR("myVer"), 0) {} ! virtual void reset() ! { ! } ! ! virtual void verify() { throw mockpp::AssertionFailedError(__LINE__, __FILE__, Index: InvocationMocker_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/InvocationMocker_test.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** InvocationMocker_test.cpp 12 Jan 2005 20:24:30 -0000 1.26 --- InvocationMocker_test.cpp 27 Feb 2005 11:48:16 -0000 1.27 *************** *** 111,115 **** } ! virtual void verify() const { verified = true; --- 111,115 ---- } ! virtual void verify() { verified = true; Index: VisitableMockObject_4_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_4_void_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** VisitableMockObject_4_void_test.cpp 26 Jan 2005 21:59:12 -0000 1.13 --- VisitableMockObject_4_void_test.cpp 27 Feb 2005 11:48:16 -0000 1.14 *************** *** 41,44 **** --- 41,47 ---- #include <mockpp/VisitableMockObject.h> + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <cppunit/extensions/HelperMacros.h> *************** *** 55,58 **** --- 58,62 ---- CPPUNIT_TEST(test_clear); CPPUNIT_TEST(test_default_throw); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 73,76 **** --- 77,81 ---- void test_parameter_ex(); void test_parameter(); + void test_constraint(); void fail_unused_throwable(); *************** *** 99,109 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_Parameter1.size() == 0 ! && visitable_Parameter2.size() == 0 ! && visitable_Parameter3.size() == 0 ! && visitable_Parameter4.size() == 0; } }; --- 104,114 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableParameter1.size() == 0 ! && visitableParameter2.size() == 0 ! && visitableParameter3.size() == 0 ! && visitableParameter4.size() == 0; } }; *************** *** 352,354 **** --- 357,375 ---- + void VisitableMockObject_4_void_test::test_constraint() + { + MyVisitableMockObject_4_void_test mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4_void_test, visitable) ctr (&mvo); + + mvo.visitable(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(34), + new mockpp::IsEqual<unsigned>(56), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable(12, 34, 56, 90); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_5_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_5_test.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** VisitableMockObject_5_test.cpp 26 Jan 2005 21:59:12 -0000 1.19 --- VisitableMockObject_5_test.cpp 27 Feb 2005 11:48:16 -0000 1.20 *************** *** 42,45 **** --- 42,48 ---- #include <mockpp/util/AssertMo.h> + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include "classes_ABCDE.h" *************** *** 62,65 **** --- 65,69 ---- CPPUNIT_TEST(test_inline_pre_1_2); CPPUNIT_TEST(test_inline_post_1_2); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 88,91 **** --- 92,96 ---- void test_inline_pre_1_2(); void test_inline_post_1_2(); + void test_constraint(); void fail_unused_value(); *************** *** 211,227 **** bool isClear() { ! return visitable5_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable5_Throwables.size() == 0 ! && visitable5_ResponseValues.size() == 0 ! && visitable5_Parameter1.size() == 0 ! && visitable5_Parameter2.size() == 0 ! && visitable5_Parameter3.size() == 0 ! && visitable5_Parameter4.size() == 0 ! && visitable5_Parameter5.size() == 0 ! && visitable5_haveDefaultReturnValue == false ! && visitable5_DefaultReturnValueUsed == false ! && visitable5_ReturnValues.hasMoreObjects() == false; } }; --- 216,232 ---- bool isClear() { ! return visitable5DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable5Throwables.size() == 0 ! && visitable5ResponseValues.size() == 0 ! && visitable5Parameter1.size() == 0 ! && visitable5Parameter2.size() == 0 ! && visitable5Parameter3.size() == 0 ! && visitable5Parameter4.size() == 0 ! && visitable5Parameter5.size() == 0 ! && visitable5haveDefaultReturnValue == false ! && visitable5DefaultReturnValueUsed == false ! && visitable5ReturnValues.hasMoreObjects() == false; } }; *************** *** 904,906 **** --- 909,929 ---- + void VisitableMockObject_5_test::test_constraint() + { + MyVisitableMockObject_5 mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5, visitable5) ctr (&mvo); + ctr.setDefaultReturnValue(123); + + mvo.visitable5(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(34), + new mockpp::IsEqual<unsigned>(56), + new mockpp::IsEqual<unsigned>(78), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable5(12, 34, 56, 78, 90); + mvo.verify(); + } + + #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.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** VisitableMockObject_5_void_test.cpp 26 Jan 2005 21:59:12 -0000 1.16 --- VisitableMockObject_5_void_test.cpp 27 Feb 2005 11:48:16 -0000 1.17 *************** *** 41,44 **** --- 41,47 ---- #include <mockpp/VisitableMockObject.h> + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include "classes_ABCDE.h" *************** *** 57,60 **** --- 60,64 ---- CPPUNIT_TEST(test_clear); CPPUNIT_TEST(test_default_throw); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 75,78 **** --- 79,83 ---- void test_parameter(); void test_parameter_ex(); + void test_constraint(); void fail_unused_throwable(); *************** *** 187,198 **** bool isClear() { ! return visitable5_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable5_Throwables.size() == 0 ! && visitable5_Parameter1.size() == 0 ! && visitable5_Parameter2.size() == 0 ! && visitable5_Parameter3.size() == 0 ! && visitable5_Parameter4.size() == 0 ! && visitable5_Parameter5.size() == 0; } }; --- 192,203 ---- bool isClear() { ! return visitable5DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable5Throwables.size() == 0 ! && visitable5Parameter1.size() == 0 ! && visitable5Parameter2.size() == 0 ! && visitable5Parameter3.size() == 0 ! && visitable5Parameter4.size() == 0 ! && visitable5Parameter5.size() == 0; } }; *************** *** 670,672 **** --- 675,694 ---- + void VisitableMockObject_5_void_test::test_constraint() + { + MyVisitableMockObject_5_void_test mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_5_void_test, visitable5) ctr (&mvo); + + mvo.visitable5(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(34), + new mockpp::IsEqual<unsigned>(56), + new mockpp::IsEqual<unsigned>(78), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable5(12, 34, 56, 78, 90); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_4_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_4_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** VisitableMockObject_4_test.cpp 26 Jan 2005 21:59:12 -0000 1.14 --- VisitableMockObject_4_test.cpp 27 Feb 2005 11:48:16 -0000 1.15 *************** *** 38,41 **** --- 38,44 ---- #else + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <mockpp/ExpectationValue.h> #include <mockpp/VisitableMockObject.h> *************** *** 60,63 **** --- 63,67 ---- CPPUNIT_TEST(test_inline_pre_1_2); CPPUNIT_TEST(test_inline_post_1_2); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 86,89 **** --- 90,94 ---- void test_inline_pre_1_2(); void test_inline_post_1_2(); + void test_constraint(); void fail_unused_value(); *************** *** 116,131 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_ResponseValues.size() == 0 ! && visitable_Parameter1.size() == 0 ! && visitable_Parameter2.size() == 0 ! && visitable_Parameter3.size() == 0 ! && visitable_Parameter4.size() == 0 ! && visitable_haveDefaultReturnValue == false ! && visitable_DefaultReturnValueUsed == false ! && visitable_ReturnValues.hasMoreObjects() == false; } }; --- 121,136 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableResponseValues.size() == 0 ! && visitableParameter1.size() == 0 ! && visitableParameter2.size() == 0 ! && visitableParameter3.size() == 0 ! && visitableParameter4.size() == 0 ! && visitablehaveDefaultReturnValue == false ! && visitableDefaultReturnValueUsed == false ! && visitableReturnValues.hasMoreObjects() == false; } }; *************** *** 587,589 **** --- 592,611 ---- + void VisitableMockObject_4_test::test_constraint() + { + MyVisitableMockObject_4 mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_4, visitable) ctr (&mvo); + ctr.setDefaultReturnValue(123); + + mvo.visitable(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(34), + new mockpp::IsEqual<unsigned>(56), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable(12, 34, 56, 90); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT Index: ReturnObjectList_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ReturnObjectList_test.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ReturnObjectList_test.cpp 30 Dec 2004 20:54:06 -0000 1.9 --- ReturnObjectList_test.cpp 27 Feb 2005 11:48:16 -0000 1.10 *************** *** 44,59 **** public: ! CPPUNIT_TEST_SUITE( ReturnObjectList_test ); ! CPPUNIT_TEST(test_get_object); ! CPPUNIT_TEST_EXCEPTION(fail_get_object, mockpp::AssertionFailedError); ! CPPUNIT_TEST_EXCEPTION(fail_not_empty, mockpp::AssertionFailedError); ! CPPUNIT_TEST_SUITE_END(); public: void test_get_object(); void fail_get_object(); --- 44,61 ---- public: ! CPPUNIT_TEST_SUITE( ReturnObjectList_test ); ! CPPUNIT_TEST(test_get_object); ! CPPUNIT_TEST(test_default); ! CPPUNIT_TEST_EXCEPTION(fail_get_object, mockpp::AssertionFailedError); ! CPPUNIT_TEST_EXCEPTION(fail_not_empty, mockpp::AssertionFailedError); ! CPPUNIT_TEST_SUITE_END(); public: void test_get_object(); + void test_default(); void fail_get_object(); *************** *** 121,123 **** --- 123,142 ---- + void ReturnObjectList_test::test_default() + { + mockpp::ReturnObjectList<unsigned> rol (MOCKPP_PCHAR("data"), 0); + rol.addObjectToReturn(456); + rol.setDefaultReturnVaue(123); + + CPPUNIT_ASSERT(456 == rol.nextReturnObject()); + CPPUNIT_ASSERT(123 == rol.nextReturnObject()); + CPPUNIT_ASSERT(123 == rol.nextReturnObject()); + rol.verify(); + + rol.addObjectToReturn(456); + rol.clear(); + CPPUNIT_ASSERT(!rol.hasMoreObjects()); + } + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_1_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_1_void_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** VisitableMockObject_1_void_test.cpp 26 Jan 2005 21:59:12 -0000 1.15 --- VisitableMockObject_1_void_test.cpp 27 Feb 2005 11:48:16 -0000 1.16 *************** *** 41,44 **** --- 41,47 ---- #include <mockpp/VisitableMockObject.h> + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <cppunit/extensions/HelperMacros.h> *************** *** 55,58 **** --- 58,62 ---- CPPUNIT_TEST(test_clear); CPPUNIT_TEST(test_default_throw); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 73,76 **** --- 77,81 ---- void test_parameter(); void test_parameter_ex(); + void test_constraint(); void fail_unused_throwable(); *************** *** 99,106 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_Parameter1.size() == 0; } }; --- 104,111 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableParameter1.size() == 0; } }; *************** *** 325,327 **** --- 330,347 ---- + void VisitableMockObject_1_void_test::test_constraint() + { + MyVisitableMockObject_1_void mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1_void, visitable) ctr (&mvo); + + mvo.visitable(new mockpp::IsEqual<int>(13)); + mvo.visitable(new mockpp::IsNot<int>(new mockpp::IsEqual<int>(13))); + + mvo.activate(); + mvo.visitable(13); + mvo.visitable(31); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT Index: VisitableMockObject_3_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_3_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** VisitableMockObject_3_test.cpp 26 Jan 2005 21:59:12 -0000 1.14 --- VisitableMockObject_3_test.cpp 27 Feb 2005 11:48:16 -0000 1.15 *************** *** 38,41 **** --- 38,44 ---- #else + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <mockpp/ExpectationValue.h> #include <mockpp/VisitableMockObject.h> *************** *** 60,63 **** --- 63,67 ---- CPPUNIT_TEST(test_inline_pre_1_2); CPPUNIT_TEST(test_inline_post_1_2); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 86,89 **** --- 90,94 ---- void test_inline_pre_1_2(); void test_inline_post_1_2(); + void test_constraint(); void fail_unused_value(); *************** *** 116,130 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_ResponseValues.size() == 0 ! && visitable_Parameter1.size() == 0 ! && visitable_Parameter2.size() == 0 ! && visitable_Parameter3.size() == 0 ! && visitable_haveDefaultReturnValue == false ! && visitable_DefaultReturnValueUsed == false ! && visitable_ReturnValues.hasMoreObjects() == false; } }; --- 121,135 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableResponseValues.size() == 0 ! && visitableParameter1.size() == 0 ! && visitableParameter2.size() == 0 ! && visitableParameter3.size() == 0 ! && visitablehaveDefaultReturnValue == false ! && visitableDefaultReturnValueUsed == false ! && visitableReturnValues.hasMoreObjects() == false; } }; *************** *** 575,577 **** --- 580,598 ---- + void VisitableMockObject_3_test::test_constraint() + { + MyVisitableMockObject_3 mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3, visitable) ctr (&mvo); + ctr.setDefaultReturnValue(123); + + mvo.visitable(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(34), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable(12, 34, 90); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT Index: Verifiable_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Verifiable_test.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Verifiable_test.cpp 26 Jan 2005 21:59:12 -0000 1.19 --- Verifiable_test.cpp 27 Feb 2005 11:48:16 -0000 1.20 *************** *** 94,98 **** // make public for test purposes ! virtual void verify() const { } --- 94,103 ---- // make public for test purposes ! virtual void verify() ! { ! } ! ! // make public for test purposes ! virtual void reset() { } *************** *** 129,133 **** // make public for test purposes ! const mockpp::Verifiable *getVerifiable(unsigned idx) const { #ifdef _MSC_VER --- 134,138 ---- // make public for test purposes ! mockpp::Verifiable *getVerifiable(unsigned idx) { #ifdef _MSC_VER *************** *** 147,151 **** } ! void addVerifiable(const mockpp::Verifiable *vf) { #ifdef _MSC_VER --- 152,156 ---- } ! void addVerifiable(mockpp::Verifiable *vf) { #ifdef _MSC_VER Index: VisitableMockObject_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_void_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** VisitableMockObject_void_test.cpp 26 Jan 2005 21:59:13 -0000 1.14 --- VisitableMockObject_void_test.cpp 27 Feb 2005 11:48:16 -0000 1.15 *************** *** 1,3 **** ! /*************************************************************************** VisitableMockObject_void_test.cpp - --- 1,3 ---- ! /*************************************************************************** VisitableMockObject_void_test.cpp - *************** *** 95,100 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0; } }; --- 95,100 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0; } }; Index: AbstractInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractInvocationDispatcher_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractInvocationDispatcher_test.cpp 30 Dec 2004 20:54:04 -0000 1.15 --- AbstractInvocationDispatcher_test.cpp 27 Feb 2005 11:48:16 -0000 1.16 *************** *** 105,109 **** } ! virtual void verify() const { verified = true; --- 105,113 ---- } ! virtual void reset() ! { ! } ! ! virtual void verify() { verified = true; Index: VisitableMockObject_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_2_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** VisitableMockObject_2_test.cpp 26 Jan 2005 21:59:12 -0000 1.15 --- VisitableMockObject_2_test.cpp 27 Feb 2005 11:48:16 -0000 1.16 *************** *** 38,41 **** --- 38,44 ---- #else + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <mockpp/ExpectationValue.h> #include <mockpp/VisitableMockObject.h> *************** *** 60,63 **** --- 63,67 ---- CPPUNIT_TEST(test_inline_pre_1_2); CPPUNIT_TEST(test_inline_post_1_2); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 86,89 **** --- 90,94 ---- void test_inline_pre_1_2(); void test_inline_post_1_2(); + void test_constraint(); void fail_unused_value(); *************** *** 116,129 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_ResponseValues.size() == 0 ! && visitable_Parameter1.size() == 0 ! && visitable_Parameter2.size() == 0 ! && visitable_haveDefaultReturnValue == false ! && visitable_DefaultReturnValueUsed == false ! && visitable_ReturnValues.hasMoreObjects() == false; } }; --- 121,134 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableResponseValues.size() == 0 ! && visitableParameter1.size() == 0 ! && visitableParameter2.size() == 0 ! && visitablehaveDefaultReturnValue == false ! && visitableDefaultReturnValueUsed == false ! && visitableReturnValues.hasMoreObjects() == false; } }; *************** *** 564,566 **** --- 569,586 ---- + void VisitableMockObject_2_test::test_constraint() + { + MyVisitableMockObject_2 mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2, visitable) ctr (&mvo); + ctr.setDefaultReturnValue(123); + + mvo.visitable(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable(12, 90); + mvo.verify(); + } + + #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.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** VisitableMockObject_2_void_test.cpp 26 Jan 2005 21:59:12 -0000 1.14 --- VisitableMockObject_2_void_test.cpp 27 Feb 2005 11:48:16 -0000 1.15 *************** *** 38,41 **** --- 38,44 ---- #else + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <mockpp/ExpectationValue.h> #include <mockpp/VisitableMockObject.h> *************** *** 55,58 **** --- 58,62 ---- CPPUNIT_TEST(test_clear); CPPUNIT_TEST(test_default_throw); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 73,76 **** --- 77,81 ---- void test_parameter_ex(); void test_parameter(); + void test_constraint(); void fail_unused_throwable(); *************** *** 99,107 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_Parameter1.size() == 0 ! && visitable_Parameter2.size() == 0; } }; --- 104,112 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableParameter1.size() == 0 ! && visitableParameter2.size() == 0; } }; *************** *** 334,336 **** --- 339,355 ---- + void VisitableMockObject_2_void_test::test_constraint() + { + MyVisitableMockObject_2_void mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_2_void, visitable) ctr (&mvo); + + mvo.visitable(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable(12, 90); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT Index: CoreMock_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/CoreMock_test.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CoreMock_test.cpp 12 Jan 2005 20:24:30 -0000 1.16 --- CoreMock_test.cpp 27 Feb 2005 11:48:16 -0000 1.17 *************** *** 96,102 **** } ! virtual void verify() const ! { ! } virtual mockpp::String describeTo ( mockpp::String &buffer ) const --- 96,104 ---- } ! virtual void reset() ! {} ! ! virtual void verify() ! {} virtual mockpp::String describeTo ( mockpp::String &buffer ) const *************** *** 131,137 **** } ! virtual void verify() const ! { ! } virtual mockpp::String describeTo ( mockpp::String &buffer ) const --- 133,141 ---- } ! virtual void reset() ! {} ! ! virtual void verify() ! {} virtual mockpp::String describeTo ( mockpp::String &buffer ) const Index: VerifyingTestCaller_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VerifyingTestCaller_test.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VerifyingTestCaller_test.cpp 30 Jan 2005 17:18:07 -0000 1.2 --- VerifyingTestCaller_test.cpp 27 Feb 2005 11:48:16 -0000 1.3 *************** *** 93,97 **** {} ! virtual void verify() const { ver = ++cnt; --- 93,97 ---- {} ! virtual void verify() { ver = ++cnt; Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Makefile.am,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Makefile.am 18 Feb 2005 21:07:53 -0000 1.62 --- Makefile.am 27 Feb 2005 11:48:16 -0000 1.63 *************** *** 17,23 **** TESTS = $(SINGLE_TESTS) mock_test_SOURCES = mock_test.cpp VisitableMockObject_test.cpp \ Formatter_test.cpp Throwable_test.cpp ThrowableList_test.cpp ExpectationCounter_test.cpp \ ! ExpectationCounterRange_test.cpp ExpectationMap_test.cpp ExpectationList_test.cpp \ ExpectationSet_test.cpp ExpectationConglomeration_test.cpp ExpectationSegment_test.cpp \ ExpectationValue_test.cpp ExpectationBoundary_test.cpp Verifiable_test.cpp Exception_test.cpp \ --- 17,32 ---- TESTS = $(SINGLE_TESTS) + raw-gen: + cpp -DHAVE_CPPUNIT $(srcdir)/VisitableMockObject_5_void_test.cpp $(INCLUDES) >x.cpp + sed -e s,^#,//,g x.cpp >xx.cpp + + raw-comp: raw-gen + indent xx.cpp + g++ xx.cpp -o xx + + mock_test_SOURCES = mock_test.cpp VisitableMockObject_test.cpp \ Formatter_test.cpp Throwable_test.cpp ThrowableList_test.cpp ExpectationCounter_test.cpp \ ! ExpectationCounterRange_test.cpp ExpectationMap_test.cpp ExpectationList_test.cpp ConstraintList_test.cpp \ ExpectationSet_test.cpp ExpectationConglomeration_test.cpp ExpectationSegment_test.cpp \ ExpectationValue_test.cpp ExpectationBoundary_test.cpp Verifiable_test.cpp Exception_test.cpp \ Index: VisitableMockObject_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_test.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** VisitableMockObject_test.cpp 26 Jan 2005 21:59:12 -0000 1.18 --- VisitableMockObject_test.cpp 27 Feb 2005 11:48:16 -0000 1.19 *************** *** 107,116 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_haveDefaultReturnValue == false ! && visitable_DefaultReturnValueUsed == false ! && visitable_ReturnValues.hasMoreObjects() == false; } }; --- 107,116 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitablehaveDefaultReturnValue == false ! && visitableDefaultReturnValueUsed == false ! && visitableReturnValues.hasMoreObjects() == false; } }; Index: VisitableMockObject_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_1_test.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** VisitableMockObject_1_test.cpp 26 Jan 2005 21:59:12 -0000 1.16 --- VisitableMockObject_1_test.cpp 27 Feb 2005 11:48:16 -0000 1.17 *************** *** 42,45 **** --- 42,48 ---- #include <mockpp/util/AssertMo.h> + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <cppunit/extensions/HelperMacros.h> *************** *** 60,63 **** --- 63,67 ---- CPPUNIT_TEST(test_inline_pre_1_2); CPPUNIT_TEST(test_inline_post_1_2); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 86,89 **** --- 90,94 ---- void test_inline_pre_1_2(); void test_inline_post_1_2(); + void test_constraint(); void fail_unused_value(); *************** *** 116,128 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_ResponseValues.size() == 0 ! && visitable_Parameter1.size() == 0 ! && visitable_haveDefaultReturnValue == false ! && visitable_DefaultReturnValueUsed == false ! && visitable_ReturnValues.hasMoreObjects() == false; } }; --- 121,133 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableResponseValues.size() == 0 ! && visitableParameter1.size() == 0 ! && visitablehaveDefaultReturnValue == false ! && visitableDefaultReturnValueUsed == false ! && visitableReturnValues.hasMoreObjects() == false; } }; *************** *** 553,555 **** --- 558,576 ---- + void VisitableMockObject_1_test::test_constraint() + { + MyVisitableMockObject_1 mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_1, visitable) ctr (&mvo); + ctr.setDefaultReturnValue(123); + + mvo.visitable(new mockpp::IsEqual<unsigned>(13)); + mvo.visitable(new mockpp::IsNot<unsigned>(new mockpp::IsEqual<unsigned>(13))); + + mvo.activate(); + mvo.visitable(13); + mvo.visitable(31); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT Index: ThrowableList_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ThrowableList_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ThrowableList_test.cpp 30 Dec 2004 20:54:06 -0000 1.10 --- ThrowableList_test.cpp 27 Feb 2005 11:48:16 -0000 1.11 *************** *** 48,58 **** public: ! CPPUNIT_TEST_SUITE( ThrowableList_test ); ! CPPUNIT_TEST(test_throw); ! CPPUNIT_TEST(test_at); ! CPPUNIT_TEST(test_setter); ! CPPUNIT_TEST_SUITE_END(); public: --- 48,59 ---- public: ! CPPUNIT_TEST_SUITE( ThrowableList_test ); ! CPPUNIT_TEST(test_throw); ! CPPUNIT_TEST(test_at); ! CPPUNIT_TEST(test_reset); ! CPPUNIT_TEST(test_setter); ! CPPUNIT_TEST_SUITE_END(); public: *************** *** 60,63 **** --- 61,65 ---- void test_throw(); void test_at(); + void test_reset(); void test_setter(); }; *************** *** 105,108 **** --- 107,129 ---- + void ThrowableList_test::test_reset() + { + mockpp::ThrowableList tl(MOCKPP_PCHAR("tl"), 0); + + mockpp::Throwable *tt1 = mockpp::make_throwable(std::string("my-item 1")); + mockpp::Throwable *tt2 = mockpp::make_throwable(std::string("my-item 2")); + mockpp::Throwable *tt3 = mockpp::make_throwable(std::string("my-item 3")); + mockpp::Throwable *tt4 = mockpp::make_throwable(std::string("my-item 4")); + tl.push_back(tt1); + tl.push_back(tt2); + tl.push_back(tt3); + tl.push_back(tt4); + CPPUNIT_ASSERT(tl.hasMoreObjects() == true); + tl.reset(); + CPPUNIT_ASSERT(tl.hasMoreObjects() == false); + tl.verify(); + } + + void ThrowableList_test::test_at() { Index: VisitableMockObject_3_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_3_void_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** VisitableMockObject_3_void_test.cpp 26 Jan 2005 21:59:12 -0000 1.13 --- VisitableMockObject_3_void_test.cpp 27 Feb 2005 11:48:16 -0000 1.14 *************** *** 38,41 **** --- 38,44 ---- #else + #include <mockpp/constraint/IsEqual.h> + #include <mockpp/constraint/IsNot.h> + #include <mockpp/ExpectationValue.h> #include <mockpp/VisitableMockObject.h> *************** *** 55,58 **** --- 58,62 ---- CPPUNIT_TEST(test_clear); CPPUNIT_TEST(test_default_throw); + CPPUNIT_TEST(test_constraint); CPPUNIT_TEST_EXCEPTION(fail_add_throw_after_active, mockpp::AssertionFailedError); *************** *** 73,76 **** --- 77,81 ---- void test_parameter_ex(); void test_parameter(); + void test_constraint(); void fail_unused_throwable(); *************** *** 99,108 **** bool isClear() { ! return visitable_DefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitable_Throwables.size() == 0 ! && visitable_Parameter1.size() == 0 ! && visitable_Parameter2.size() == 0 ! && visitable_Parameter3.size() == 0; } }; --- 104,113 ---- bool isClear() { ! return visitableDefaultThrowable.get() == 0 // check preprocessed doc-template.h for the actual members ! && visitableThrowables.size() == 0 ! && visitableParameter1.size() == 0 ! && visitableParameter2.size() == 0 ! && visitableParameter3.size() == 0; } }; *************** *** 343,345 **** --- 348,365 ---- + void VisitableMockObject_3_void_test::test_constraint() + { + MyVisitableMockObject_3_void mvo(MOCKPP_PCHAR("mvo")); + MOCKPP_CONTROLLER_FOR(MyVisitableMockObject_3_void, visitable) ctr (&mvo); + + mvo.visitable(new mockpp::IsEqual<unsigned>(12), + new mockpp::IsEqual<unsigned>(34), + new mockpp::IsEqual<unsigned>(90)); + + mvo.activate(); + mvo.visitable(12, 34, 90); + mvo.verify(); + } + + #endif // HAVE_CPPUNIT |