mockpp-commits Mailing List for Mock Objects for C++ (Page 23)
Brought to you by:
ewald-arnold
You can subscribe to this list here.
2005 |
Jan
|
Feb
(17) |
Mar
(178) |
Apr
(119) |
May
(60) |
Jun
(3) |
Jul
(60) |
Aug
(16) |
Sep
(55) |
Oct
(156) |
Nov
(136) |
Dec
(255) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(98) |
Feb
(8) |
Mar
(57) |
Apr
(43) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ewald A. <ewa...@us...> - 2005-11-18 10:23:37
|
Update of /cvsroot/mockpp/mockpp/mockpp/examples/tutorial In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27173/mockpp/examples/tutorial Added Files: visitmock2.cpp Log Message: changes formock method --- NEW FILE: visitmock2.cpp --- /*************************************************************************** visitmock.cpp - solve problem with visitable mocks ------------------- begin : Sun 2 Jan 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de $Id: visitmock2.cpp,v 1.1 2005/11/18 10:23:27 ewald-arnold Exp $ ***************************************************************************/ #define MOCKPP_IMPORT_ABBREVIATED #include <mockpp/mockpp.h> // always first #include <mockpp/VisitableMockObject.h> #include <mockpp/CountedVisitableMethod.h> #include <mockpp/chaining/ChainingMockObjectSupport.h> #include "interface.h" #include "consumer.h" #include <exception> #include <iostream> class VisitMock : public Interface , public mockpp::VisitableMockObject { public: VisitMock() : mockpp::VisitableMockObject(MOCKPP_PCHAR("VisitMock"), 0) , open_mocker(MOCKPP_PCHAR("open"), this) , read_mocker(MOCKPP_PCHAR("read"), this) , write_mocker(MOCKPP_PCHAR("write"), this) , close_mocker(MOCKPP_PCHAR("close"), this) , calculate_mocker(MOCKPP_PCHAR("calculate"), this) {} void open(const std::string &filename) { open_mocker.forward(filename); } std::string read() { return read_mocker.forward(); } void write(const std::string &data) { write_mocker.forward(data); } unsigned calculate(unsigned input) { return calculate_mocker.forward(input); } void write(const mockpp::ConstraintHolder<std::string> &ch) { write_mocker.forward(ch); } void calculate(const mockpp::ConstraintHolder<unsigned> &ch) { calculate_mocker.forward(ch); } void close() { close_mocker.forward(); } mockpp::VisitableMockMethod<void, std::string> open_mocker; mockpp::VisitableMockMethod<std::string> read_mocker; mockpp::VisitableMockMethod<void, std::string> write_mocker; mockpp::VisitableMockMethod<void> close_mocker; mockpp::VisitableMockMethod<unsigned, unsigned> calculate_mocker; }; int main(int /*argc*/, char ** /*argv*/) { try { VisitMock mock; mockpp::VisitableMockMethod<std::string> &read_controller (mock.read_mocker); mockpp::VisitableMockMethod<unsigned, unsigned> &calculate_controller (mock.calculate_mocker); // record program flow while reading data mock.open("file1.lst"); mock.read(); mock.read(); mock.read(); mock.close(); // provide return values for read() read_controller.addReturnValue("record-1"); read_controller.addReturnValue("record-2"); read_controller.addReturnValue("record-3"); // processing is not exactly defined #if defined(_MSC_VER) && _MSC_VER <= 1300 mock.calculate(new mockpp::IsCloseTo<unsigned>(5, 5)); mock.calculate(new mockpp::IsCloseTo<unsigned>(5, 5)); mock.calculate(new mockpp::IsCloseTo<unsigned>(5, 5)); calculate_controller.addResponseValue(10, new mockpp::IsCloseTo<unsigned>(2, 2)); calculate_controller.addResponseValue(20, new mockpp::IsCloseTo<unsigned>(4, 2)); calculate_controller.addResponseValue(30, new mockpp::IsCloseTo<unsigned>(6, 2)); #else mock.calculate(eq<unsigned>(5, 5)); mock.calculate(eq<unsigned>(5, 5)); mock.calculate(eq<unsigned>(5, 5)); calculate_controller.addResponseValue(10, eq<unsigned>(2, 2)); calculate_controller.addResponseValue(20, eq<unsigned>(4, 2)); calculate_controller.addResponseValue(30, eq<unsigned>(6, 2)); #endif // record program flow while writing data mock.open("file1.lst"); mock.write("record-1/processed"); mock.write(stringContains(std::string("processed"))); mock.write(stringContains(std::string("processed"))); mock.close(); // activate mock object mock.activate(); // Run Consumer object std::cout << "Tests starting" << std::endl; Consumer consumer(&mock); consumer.load(); consumer.process(); consumer.save(); std::cout << "Tests finished" << std::endl; // Check pending expectations mock.verify(); std::cout << "All tests have passed successfully" << std::endl; } catch(std::exception &ex) { std::cout << std::endl << "Error occured.\n" << ex.what() << std::endl << std::endl; return 1; } return 0; } |
From: Ewald A. <ewa...@us...> - 2005-11-18 10:20:17
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26496/mockpp Modified Files: VisitableMockMethod.cpp VisitableMockMethod.h Log Message: reset everything on start Index: VisitableMockMethod.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- VisitableMockMethod.cpp 13 Nov 2005 11:52:26 -0000 1.5 +++ VisitableMockMethod.cpp 18 Nov 2005 10:20:00 -0000 1.6 @@ -46,6 +46,7 @@ { MOCKPP_PRE(parent != 0); MOCKPP_PRE(name.length() != 0); + reset(); } Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- VisitableMockMethod.h 18 Nov 2005 08:49:34 -0000 1.20 +++ VisitableMockMethod.h 18 Nov 2005 10:20:00 -0000 1.21 @@ -202,7 +202,9 @@ VisitableMockReturningMethodBase(const String &name, VisitableMockObject *parent) : VisitableMockMethodBase(name, parent) , returnValues(getMethodName() + MOCKPP_PCHAR("/returnValues"), this) - {} + { + reset(); + } /** Sets the default return value. * This value is returned if there are no throwables available and if there |
From: Ewald A. <ewa...@us...> - 2005-11-18 10:19:48
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26417/mockpp/chaining Modified Files: ChainableMockMethod.h Log Message: update Index: ChainableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChainableMockMethod.h 18 Nov 2005 08:49:17 -0000 1.10 +++ ChainableMockMethod.h 18 Nov 2005 10:19:35 -0000 1.11 @@ -58,8 +58,8 @@ : MockObject(name, parent) , chainable(parent) { - MOCKPP_PRE(parent != 0); - MOCKPP_PRE(name.length() != 0); + MOCKPP_PRE(parent != 0); + MOCKPP_PRE(name.length() != 0); } ChainableMockObject *getChainableMockObject() const |
From: Ewald A. <ewa...@us...> - 2005-11-18 08:49:47
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5845/mockpp Modified Files: mockpp.h VisitableMockMethod.h Log Message: docs Index: mockpp.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/mockpp.h,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- mockpp.h 7 May 2005 12:45:10 -0000 1.56 +++ mockpp.h 18 Nov 2005 08:49:34 -0000 1.57 @@ -35,7 +35,8 @@ \section abstract Abstract mockpp is a platform independent generic unit testing framework for C++. It's goal is to facilitate - developing unit tests in the spirit of <a href="http://www.mockobjects.com/">Mock Objects for Java</a>, + developing unit tests and integraton tests in the spirit of + <a href="http://www.mockobjects.com/">Mock Objects for Java</a>, <a href="http://www.easymock.org/">EasyMock</a> and <a href="http://www.jmock.org/">jMock</a>. Mock objects allow you to set up predictible @@ -62,8 +63,7 @@ - More about visitable mock objects - \ref grp_controller - More about chainable mock objects - - Not really needed but maybe nice to know where the methods are - located: \ref grp_chainer + - \ref grp_chainer - Sub-expectations - Stubs - \ref grp_stub Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- VisitableMockMethod.h 13 Nov 2005 14:07:12 -0000 1.19 +++ VisitableMockMethod.h 18 Nov 2005 08:49:34 -0000 1.20 @@ -41,6 +41,7 @@ /** Base of all mock methods. + * @internal */ class VisitableMockMethodBase : public MockObject { @@ -187,6 +188,7 @@ /** Base of all mock methods returning some value. + * @internal */ template <typename R> class VisitableMockReturningMethodBase : public VisitableMockMethodBase @@ -281,6 +283,7 @@ /** Base of all mock methods returning void. + * @internal */ template <> class VisitableMockReturningMethodBase<void> : public VisitableMockMethodBase |
From: Ewald A. <ewa...@us...> - 2005-11-18 08:49:25
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5776/mockpp/chaining Modified Files: ChainableMockMethod.h ChainableMockMethod0.h ChainableMockMethod1.h ChainableMockMethod2.h ChainableMockMethod3.h ChainableMockMethod4.h ChainableMockMethod5.h ChainableMockMethod6.h gen_chainablemethod_N.pl Log Message: docs Index: ChainableMockMethod6.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod6.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ChainableMockMethod6.h 15 Nov 2005 19:42:04 -0000 1.6 +++ ChainableMockMethod6.h 18 Nov 2005 08:49:17 -0000 1.7 @@ -1,7 +1,7 @@ /** @file @brief Chainable Mock Method with 6 parameters. Generated with gen_chainablemethod_N.pl. - + $Id$ ***************************************************************************/ @@ -39,18 +39,19 @@ namespace mockpp { - + /** Common stuff to set up chainable mock method expectations with 6 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer + * @internal */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> -class ChainableMockMethod6Common - : public ChainableMockMethodCommon<R> - , public ChainingMockBuilder <ArgumentsMatchBuilder6<R, Invocation6<P1, P2, P3, P4, P5, P6> > > +class ChainableMockMethod6Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder6<R, Invocation6<P1, P2, P3, P4, P5, P6> > > { public: - - typedef Invocation6<P1, P2, P3, P4, P5, P6> InvocationType; + + typedef Invocation6<P1, P2, P3, P4, P5, P6> InvocationType; typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -85,10 +86,10 @@ /** Set up a chainable mock method expectations with 6 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> -class ChainableMockMethod6 +class ChainableMockMethod6 : public ChainableMockMethod6Common<R, P1, P2, P3, P4, P5, P6> { public: @@ -122,14 +123,14 @@ /** Set up a chainable mock method expectations with 6 parameters. * Partial specialisation for a void return value. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> -class ChainableMockMethod6<void, P1, P2, P3, P4, P5, P6> +class ChainableMockMethod6<void, P1, P2, P3, P4, P5, P6> : public ChainableMockMethod6Common<void, P1, P2, P3, P4, P5, P6> { public: - + typedef typename ChainableMockMethod6Common<void, P1, P2, P3, P4, P5, P6>::InvocationType InvocationType; /** Constructs the mock object. Index: ChainableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ChainableMockMethod.h 30 Oct 2005 13:54:52 -0000 1.9 +++ ChainableMockMethod.h 18 Nov 2005 08:49:17 -0000 1.10 @@ -41,6 +41,10 @@ namespace mockpp { +/** Common stuff to set up chainable mock method expectations + * @ingroup grp_controller + * @internal + */ template <typename R> class ChainableMockMethodCommon : public MockObject { Index: ChainableMockMethod2.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod2.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockMethod2.h 15 Nov 2005 19:42:04 -0000 1.8 +++ ChainableMockMethod2.h 18 Nov 2005 08:49:17 -0000 1.9 @@ -1,7 +1,7 @@ /** @file @brief Chainable Mock Method with 2 parameters. Generated with gen_chainablemethod_N.pl. - + $Id$ ***************************************************************************/ @@ -39,18 +39,19 @@ namespace mockpp { - + /** Common stuff to set up chainable mock method expectations with 2 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer + * @internal */ template <typename R, typename P1, typename P2> -class ChainableMockMethod2Common - : public ChainableMockMethodCommon<R> - , public ChainingMockBuilder <ArgumentsMatchBuilder2<R, Invocation2<P1, P2> > > +class ChainableMockMethod2Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder2<R, Invocation2<P1, P2> > > { public: - - typedef Invocation2<P1, P2> InvocationType; + + typedef Invocation2<P1, P2> InvocationType; typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -85,10 +86,10 @@ /** Set up a chainable mock method expectations with 2 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename R, typename P1, typename P2> -class ChainableMockMethod2 +class ChainableMockMethod2 : public ChainableMockMethod2Common<R, P1, P2> { public: @@ -118,14 +119,14 @@ /** Set up a chainable mock method expectations with 2 parameters. * Partial specialisation for a void return value. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename P1, typename P2> -class ChainableMockMethod2<void, P1, P2> +class ChainableMockMethod2<void, P1, P2> : public ChainableMockMethod2Common<void, P1, P2> { public: - + typedef typename ChainableMockMethod2Common<void, P1, P2>::InvocationType InvocationType; /** Constructs the mock object. Index: ChainableMockMethod3.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod3.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockMethod3.h 15 Nov 2005 19:42:04 -0000 1.8 +++ ChainableMockMethod3.h 18 Nov 2005 08:49:17 -0000 1.9 @@ -1,7 +1,7 @@ /** @file @brief Chainable Mock Method with 3 parameters. Generated with gen_chainablemethod_N.pl. - + $Id$ ***************************************************************************/ @@ -39,18 +39,19 @@ namespace mockpp { - + /** Common stuff to set up chainable mock method expectations with 3 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer + * @internal */ template <typename R, typename P1, typename P2, typename P3> -class ChainableMockMethod3Common - : public ChainableMockMethodCommon<R> - , public ChainingMockBuilder <ArgumentsMatchBuilder3<R, Invocation3<P1, P2, P3> > > +class ChainableMockMethod3Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder3<R, Invocation3<P1, P2, P3> > > { public: - - typedef Invocation3<P1, P2, P3> InvocationType; + + typedef Invocation3<P1, P2, P3> InvocationType; typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -85,10 +86,10 @@ /** Set up a chainable mock method expectations with 3 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename R, typename P1, typename P2, typename P3> -class ChainableMockMethod3 +class ChainableMockMethod3 : public ChainableMockMethod3Common<R, P1, P2, P3> { public: @@ -119,14 +120,14 @@ /** Set up a chainable mock method expectations with 3 parameters. * Partial specialisation for a void return value. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename P1, typename P2, typename P3> -class ChainableMockMethod3<void, P1, P2, P3> +class ChainableMockMethod3<void, P1, P2, P3> : public ChainableMockMethod3Common<void, P1, P2, P3> { public: - + typedef typename ChainableMockMethod3Common<void, P1, P2, P3>::InvocationType InvocationType; /** Constructs the mock object. Index: ChainableMockMethod4.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod4.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockMethod4.h 15 Nov 2005 19:42:04 -0000 1.8 +++ ChainableMockMethod4.h 18 Nov 2005 08:49:17 -0000 1.9 @@ -1,7 +1,7 @@ /** @file @brief Chainable Mock Method with 4 parameters. Generated with gen_chainablemethod_N.pl. - + $Id$ ***************************************************************************/ @@ -39,18 +39,19 @@ namespace mockpp { - + /** Common stuff to set up chainable mock method expectations with 4 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer + * @internal */ template <typename R, typename P1, typename P2, typename P3, typename P4> -class ChainableMockMethod4Common - : public ChainableMockMethodCommon<R> - , public ChainingMockBuilder <ArgumentsMatchBuilder4<R, Invocation4<P1, P2, P3, P4> > > +class ChainableMockMethod4Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder4<R, Invocation4<P1, P2, P3, P4> > > { public: - - typedef Invocation4<P1, P2, P3, P4> InvocationType; + + typedef Invocation4<P1, P2, P3, P4> InvocationType; typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -85,10 +86,10 @@ /** Set up a chainable mock method expectations with 4 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename R, typename P1, typename P2, typename P3, typename P4> -class ChainableMockMethod4 +class ChainableMockMethod4 : public ChainableMockMethod4Common<R, P1, P2, P3, P4> { public: @@ -120,14 +121,14 @@ /** Set up a chainable mock method expectations with 4 parameters. * Partial specialisation for a void return value. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename P1, typename P2, typename P3, typename P4> -class ChainableMockMethod4<void, P1, P2, P3, P4> +class ChainableMockMethod4<void, P1, P2, P3, P4> : public ChainableMockMethod4Common<void, P1, P2, P3, P4> { public: - + typedef typename ChainableMockMethod4Common<void, P1, P2, P3, P4>::InvocationType InvocationType; /** Constructs the mock object. Index: gen_chainablemethod_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/gen_chainablemethod_N.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- gen_chainablemethod_N.pl 15 Nov 2005 19:42:04 -0000 1.5 +++ gen_chainablemethod_N.pl 18 Nov 2005 08:49:17 -0000 1.6 @@ -13,16 +13,16 @@ $totalNumArgs = $ARGV[0]; if ($totalNumArgs < 5) { $totalNumArgs = 5; } - + for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) { open OUT, ">ChainableMockMethod" . $numArgs . ".h"; print "Creating ChainableMockMethod" . $numArgs . ".h\n"; -print OUT +print OUT "/** \@file \@brief Chainable Mock Method with $numArgs parameters. Generated with gen_chainablemethod_N.pl. - + \$I" . "d: ChainableMockMethod" . $numArgs . ".h,v 1.7 2005/10/19 20:53:09 ewald-arnold Exp \$ ***************************************************************************/ @@ -60,7 +60,7 @@ namespace mockpp { - + "; $templateParms = ""; @@ -71,20 +71,20 @@ } $templateParms .= "typename P$i"; } - if ($numArgs > 0) { + if ($numArgs > 0) { $templateParms_colon = ", " . $templateParms; } -# print OUT "// templateParms: $templateParms\n"; - +# print OUT "// templateParms: $templateParms\n"; + $templateArgs_colon = ""; $_ = $templateParms; s/typename //g; $templateArgs = $_; - if ($numArgs > 0) { + if ($numArgs > 0) { $templateArgs_colon = ", ". $templateArgs; } -# print OUT "// templateArgs: $templateArgs\n"; - +# print OUT "// templateArgs: $templateArgs\n"; + $parms = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { @@ -93,7 +93,7 @@ $parms .= "const P$i &p$i"; } -# print OUT "// parms: $parms\n"; +# print OUT "// parms: $parms\n"; $holderParms = ""; for ($i = 1; $i <= $numArgs; ++$i) { @@ -103,7 +103,7 @@ $holderParms .= "const ConstraintHolder<P$i> &p$i"; } -# print OUT "// holderParms: $holderParms\n"; +# print OUT "// holderParms: $holderParms\n"; $args_colon = ""; $args = ""; @@ -113,11 +113,11 @@ } $args .= "p$i"; } - if ($numArgs > 0) { + if ($numArgs > 0) { $args_colon = ", ". $args; } -# print OUT "// args: $args\n"; - +# print OUT "// args: $args\n"; + $boundArgs = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { @@ -126,15 +126,15 @@ $boundArgs .= "args->a$i"; } -# print OUT "// boundArgs: $boundArgs\n"; +# print OUT "// boundArgs: $boundArgs\n"; $argsAsMembers = ""; for ($i = 1; $i <= $numArgs; ++$i) { $argsAsMembers .= "P$i p$i;"; } -# print OUT "// argsAsMembers: $argsAsMembers\n"; - +# print OUT "// argsAsMembers: $argsAsMembers\n"; + $copyParms = ""; for ($i = 1; $i <= $numArgs; ++$i) { if ($i > 1) { @@ -143,7 +143,7 @@ $copyParms .= "P$i ia$i"; } -# print OUT "// copyParms: $copyParms\n"; +# print OUT "// copyParms: $copyParms\n"; $initArgs = ""; if ($numArgs > 0) { @@ -156,7 +156,7 @@ $initArgs .= "p$i(ip$i)"; } -# print OUT "// initArgs: $initArgs\n"; +# print OUT "// initArgs: $initArgs\n"; $argTypes = ""; for ($i = 1; $i <= $numArgs; ++$i) { @@ -165,42 +165,43 @@ # print OUT "// argTypes: $argTypes\n\n\n"; -print OUT +print OUT "/** Common stuff to set up chainable mock method expectations with " . $numArgs . " parameters. - * \@ingroup grp_controller + * \@ingroup grp_chainer + * \@internal */ template <typename R" . $templateParms_colon . "> -class ChainableMockMethod" . $numArgs . "Common +class ChainableMockMethod" . $numArgs . "Common : public ChainableMockMethodCommon<R>"; - + if ($numArgs > 0) { -print OUT " +print OUT " , public ChainingMockBuilder <ArgumentsMatchBuilder" . $numArgs . "<R, Invocation" . $numArgs . "<" . $templateArgs . "> > >"; } else { -print OUT " +print OUT " , public ChainingMockBuilder <ArgumentsMatchBuilder0<R, Invocation0> >"; -} - -print OUT " +} + +print OUT " { public: "; - + if ($numArgs > 0) { -print OUT " +print OUT " typedef Invocation" . $numArgs . "<" . $templateArgs . "> InvocationType;"; } else { -print OUT " +print OUT " typedef Invocation0 InvocationType;"; } -print OUT " +print OUT " typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -235,10 +236,10 @@ /** Set up a chainable mock method expectations with " . $numArgs . " parameters. - * \@ingroup grp_controller + * \@ingroup grp_chainer */ template <typename R" . $templateParms_colon . "> -class ChainableMockMethod" . $numArgs . " +class ChainableMockMethod" . $numArgs . " : public ChainableMockMethod" . $numArgs . "Common<R" . $templateArgs_colon . "> { public: @@ -271,10 +272,10 @@ /** Set up a chainable mock method expectations with " . $numArgs . " parameters. * Partial specialisation for a void return value. - * \@ingroup grp_controller + * \@ingroup grp_chainer */ template <" . $templateParms . "> -class ChainableMockMethod" . $numArgs . "<void" . $templateArgs_colon . "> +class ChainableMockMethod" . $numArgs . "<void" . $templateArgs_colon . "> : public ChainableMockMethod" . $numArgs . "Common<void" . $templateArgs_colon . "> { public: @@ -282,12 +283,12 @@ if ($numArgs > 0) { -print OUT " +print OUT " typedef typename ChainableMockMethod" . $numArgs . "Common<void" . $templateArgs_colon . ">::InvocationType InvocationType;"; } else { -print OUT " +print OUT " typedef ChainableMockMethod" . $numArgs . "Common<void" . $templateArgs_colon . ">::InvocationType InvocationType;"; } Index: ChainableMockMethod5.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod5.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockMethod5.h 15 Nov 2005 19:42:04 -0000 1.8 +++ ChainableMockMethod5.h 18 Nov 2005 08:49:17 -0000 1.9 @@ -1,7 +1,7 @@ /** @file @brief Chainable Mock Method with 5 parameters. Generated with gen_chainablemethod_N.pl. - + $Id$ ***************************************************************************/ @@ -39,18 +39,19 @@ namespace mockpp { - + /** Common stuff to set up chainable mock method expectations with 5 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer + * @internal */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5> -class ChainableMockMethod5Common - : public ChainableMockMethodCommon<R> - , public ChainingMockBuilder <ArgumentsMatchBuilder5<R, Invocation5<P1, P2, P3, P4, P5> > > +class ChainableMockMethod5Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder5<R, Invocation5<P1, P2, P3, P4, P5> > > { public: - - typedef Invocation5<P1, P2, P3, P4, P5> InvocationType; + + typedef Invocation5<P1, P2, P3, P4, P5> InvocationType; typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -85,10 +86,10 @@ /** Set up a chainable mock method expectations with 5 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5> -class ChainableMockMethod5 +class ChainableMockMethod5 : public ChainableMockMethod5Common<R, P1, P2, P3, P4, P5> { public: @@ -121,14 +122,14 @@ /** Set up a chainable mock method expectations with 5 parameters. * Partial specialisation for a void return value. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename P1, typename P2, typename P3, typename P4, typename P5> -class ChainableMockMethod5<void, P1, P2, P3, P4, P5> +class ChainableMockMethod5<void, P1, P2, P3, P4, P5> : public ChainableMockMethod5Common<void, P1, P2, P3, P4, P5> { public: - + typedef typename ChainableMockMethod5Common<void, P1, P2, P3, P4, P5>::InvocationType InvocationType; /** Constructs the mock object. Index: ChainableMockMethod0.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod0.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockMethod0.h 15 Nov 2005 19:42:04 -0000 1.8 +++ ChainableMockMethod0.h 18 Nov 2005 08:49:17 -0000 1.9 @@ -1,7 +1,7 @@ /** @file @brief Chainable Mock Method with 0 parameters. Generated with gen_chainablemethod_N.pl. - + $Id$ ***************************************************************************/ @@ -39,18 +39,19 @@ namespace mockpp { - + /** Common stuff to set up chainable mock method expectations with 0 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer + * @internal */ template <typename R> -class ChainableMockMethod0Common - : public ChainableMockMethodCommon<R> - , public ChainingMockBuilder <ArgumentsMatchBuilder0<R, Invocation0> > +class ChainableMockMethod0Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder0<R, Invocation0> > { public: - - typedef Invocation0 InvocationType; + + typedef Invocation0 InvocationType; typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -85,10 +86,10 @@ /** Set up a chainable mock method expectations with 0 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename R> -class ChainableMockMethod0 +class ChainableMockMethod0 : public ChainableMockMethod0Common<R> { public: @@ -116,14 +117,14 @@ /** Set up a chainable mock method expectations with 0 parameters. * Partial specialisation for a void return value. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <> -class ChainableMockMethod0<void> +class ChainableMockMethod0<void> : public ChainableMockMethod0Common<void> { public: - + typedef ChainableMockMethod0Common<void>::InvocationType InvocationType; /** Constructs the mock object. Index: ChainableMockMethod1.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod1.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ChainableMockMethod1.h 15 Nov 2005 19:42:04 -0000 1.8 +++ ChainableMockMethod1.h 18 Nov 2005 08:49:17 -0000 1.9 @@ -1,7 +1,7 @@ /** @file @brief Chainable Mock Method with 1 parameters. Generated with gen_chainablemethod_N.pl. - + $Id$ ***************************************************************************/ @@ -39,18 +39,19 @@ namespace mockpp { - + /** Common stuff to set up chainable mock method expectations with 1 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer + * @internal */ template <typename R, typename P1> -class ChainableMockMethod1Common - : public ChainableMockMethodCommon<R> - , public ChainingMockBuilder <ArgumentsMatchBuilder1<R, Invocation1<P1> > > +class ChainableMockMethod1Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder1<R, Invocation1<P1> > > { public: - - typedef Invocation1<P1> InvocationType; + + typedef Invocation1<P1> InvocationType; typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; @@ -85,10 +86,10 @@ /** Set up a chainable mock method expectations with 1 parameters. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename R, typename P1> -class ChainableMockMethod1 +class ChainableMockMethod1 : public ChainableMockMethod1Common<R, P1> { public: @@ -117,14 +118,14 @@ /** Set up a chainable mock method expectations with 1 parameters. * Partial specialisation for a void return value. - * @ingroup grp_controller + * @ingroup grp_chainer */ template <typename P1> -class ChainableMockMethod1<void, P1> +class ChainableMockMethod1<void, P1> : public ChainableMockMethod1Common<void, P1> { public: - + typedef typename ChainableMockMethod1Common<void, P1>::InvocationType InvocationType; /** Constructs the mock object. |
From: Ewald A. <ewa...@us...> - 2005-11-17 21:09:02
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11881/mockpp/docs/en Modified Files: Makefile.am dev_advanced_easymock.docbook dev_advanced_jmock.docbook Log Message: update Index: dev_advanced_jmock.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_advanced_jmock.docbook,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- dev_advanced_jmock.docbook 28 Oct 2005 20:35:14 -0000 1.14 +++ dev_advanced_jmock.docbook 17 Nov 2005 21:08:52 -0000 1.15 @@ -37,7 +37,6 @@ <programlisting> - MOCKPP_CHAINER_FOR (MyClass, MyMethod) chainer (&myobject); chainer.expects(once()) .after("other-ident") .with(new IsEqual<int>(321)) @@ -234,7 +233,7 @@ <programlisting> - mockpp::IsSame<std::string> same ("string"); + IsSame<std::string> same ("string"); </programlisting> @@ -244,7 +243,7 @@ <programlisting> std::string str ("string"); - mockpp::IsSame<std::string> same (str); + IsSame<std::string> same (str); </programlisting> @@ -287,7 +286,7 @@ </sect3> <sect3> -<title>Some Examples</title> +<title>Create a Chainer Object Using Macros</title> <para> To get a chainable mock object you must: @@ -306,8 +305,8 @@ { public: - virtual int access(unsigned &index) = 0; - } + virtual int access(unsigned index) = 0; + }; class MyChainableMockObject : public ChainableMockObject, <co id="chainable-class-co" linkends="chainable-class" /> public MyInterfaceClass @@ -325,10 +324,18 @@ MOCKPP_CHAINER_FOR(MyChainableMockObject, access) chainer (&mco); <co id="jmock-chainer-co" linkends="jmock-controller" /> - chainer.setDefaultStub(new ThrowStub(std::string("throw-default"))); <co id="jmock-feed1-co" linkends="jmock-feed1" /> - chainer.stubs().with(1).will(new ReturnStub(13)); <co id="jmock-feed2-co" linkends="jmock-feed2" /> - chainer.expects(once()).with((2).id("called-with-2"); <co id="jmock-feed3-co" linkends="jmock-feed3" /> - chainer.stubs().after(otherObject, "some-label").will(new ReturnStub(2222)); <co id="jmock-feed4-co" linkends="jmock-feed4" /> + chainer.setDefaultStub(new ThrowStub<int>(make_throwable(1))); <co id="jmock-feed1-co" linkends="jmock-feed1" /> + chainer.stubs() + .with(eq(1)) + .will(new ReturnStub<int>(13)); <co id="jmock-feed2-co" linkends="jmock-feed2" /> + + chainer.expects(once()) + .with((eq(2))) + .id("called-with-2"); <co id="jmock-feed3-co" linkends="jmock-feed3" /> + + chainer.stubs() + .after(otherObject, "some-label") + .will(new ReturnStub<int>(2222)); <co id="jmock-feed4-co" linkends="jmock-feed4" /> // use the object @@ -394,4 +401,75 @@ </sect3> +<sect3> +<title>Using a Mock Method Chainer</title> + +The second approach with mock method templates is almost the same as before. The difference +is to replace the macros and the resulting chainer object with the method object +and forward the call to it. + +<programlisting> + + class MyChainableMockObject : public ChainableMockObject, + public MyInterfaceClass + { + public: + MyChainableMockObject(const String &name) + : ChainableMockObject(name, 0) + , access_mocker("access", this) <co id="chainmeth-cons-co" linkends="chainmeth-cons" /> + {} + + virtual int access(unsigned index) <co id="chainmeth-fwd-co" linkends="chainmeth-fwd" /> + { + return access_mocker.forward(index); + } + + ChainableMockMethod1<int, unsigned> access_mocker; <co id="chainmeth-var-co" linkends="chainmeth-var" /> + }; + + MyChainableMockObject mco("mco"); + + ChainableMockMethod1<int, unsigned> &chainer (mco.access_mocker); <co id="chainmeth-ref-co" linkends="chainmeth-ref" /> + + chainer.setDefaultStub(new ThrowStub<int>(make_throwable(1))); + chainer.stubs() + .with(eq(12u)) + .will(new ReturnStub<int>(13)); <co id="chainmeth-setup-co" linkends="chainmeth-setup" /> + + // use the object + + mco.verify(); + +</programlisting> + +<calloutlist> + + <callout arearefs="chainmeth-cons-co" id="chainmeth-cons" > + <para>Construct the mock method helper object.</para> + </callout> + + <callout arearefs="chainmeth-fwd-co" id="chainmeth-fwd" > + <para>Provide the method as entry point and forward the call to + the method which does the actual work.</para> + </callout> + + <callout arearefs="chainmeth-var-co" id="chainmeth-var" > + <para>Instantiate a mock method variable. Select the class according + to the parameters the method takes. There also a template without a trailing + number which handles an arbitrary parameter count.</para> + </callout> + + <callout arearefs="chainmeth-ref-co" id="chainmeth-ref" > + <para>For convenience create a reference to the mock method helper.</para> + </callout> + + <callout arearefs="chainmeth-setup-co" id="chainmeth-setup" > + <para>Set up the mock objects behaviour in the same manner as + described above using the macros.</para> + </callout> + +</calloutlist> + +</sect3> + </sect2> Index: dev_advanced_easymock.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_advanced_easymock.docbook,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- dev_advanced_easymock.docbook 5 May 2005 21:01:59 -0000 1.8 +++ dev_advanced_easymock.docbook 17 Nov 2005 21:08:52 -0000 1.9 @@ -10,13 +10,17 @@ To obtain a visitable mock object you must: <itemizedlist> <listitem>Derive and define your object with the methods you need</listitem> - <listitem>Create a controller for each method and set up the behaviour</listitem> + <listitem>Create a helper object for each method and set up the behaviour</listitem> <listitem>Activate and use the object</listitem> </itemizedlist> </para> +<sect3 id="visit-macros"> +<title>Using Macros</title> + <para> -The following listing contains a short example and explains the basic features. +The following listing contains a short example and explains the basic features +when using macros. <programlisting> @@ -25,7 +29,7 @@ public: virtual int access(unsigned &index) = 0; - } + }; class MyVisitableMockObject : public VisitableMockObject, <co id="visitable-class-co" linkends="visitable-class" /> public MyInterfaceClass @@ -47,11 +51,11 @@ access_ctr.addThrowable(std::string("throw"), 2); <co id="mock-feed1-co" linkends="mock-feed1" /> access_ctr.addResponseValue(1, 13); <co id="mock-feed2-co" linkends="mock-feed2" /> access_ctr.addResponseValue(2, 37); - access_ctr.addResponseValue(3, gt<unsigned>(50)); <co id="mock-gt-co" linkends="mock-gt" /> + access_ctr.addResponseValue(3, lt(50u)); <co id="mock-gt-co" linkends="mock-gt" /> mvo.access(1); <co id="mock-feed3-co" linkends="mock-feed3" /> mvo.access(13); - mvo.access(lt<unsigned>(123)); <co id="mock-feed4-co" linkends="mock-feed4" /> + mvo.access(lt(123u)); <co id="mock-feed4-co" linkends="mock-feed4" /> mvo.activate(); <co id="mock-activate-co" linkends="mock-activate" /> @@ -112,7 +116,8 @@ </callout> <callout arearefs="mock-feed4-co" id="mock-feed4" > - <para>Demands that the parameter value is less than 123.</para> + <para>Demands that the parameter value is less than 123 by using an + appropriate <link linkend="parameter-constraint">constraint object</link>.</para> </callout> <callout arearefs="mock-activate-co" id="mock-activate" > @@ -132,6 +137,100 @@ the api documentation of <classname>VisitableMockObject::Controller</classname>. </para> +</sect3> + + +<sect3 id="visit-template"> +<title>Using Mock Method Templates</title> + +The second approach with mock method templates is almost the same as before. The difference +is to replace the macros and the resulting controller object with the method object +and forward the call to it. + +<programlisting> + + class MyVisitableMockObject : public VisitableMockObject, + public MyInterfaceClass + { + public: + + MyVisitableMockObject(const String &name) + : VisitableMockObject(name, 0) + , access_mocker("access", this) <co id="mockmeth-cons-co" linkends="mockmeth-cons" /> + {} + + virtual int access(unsigned index) <co id="mockmeth-fwd-co" linkends="mockmeth-fwd" /> + { + return access_mocker.forward(index); + } + + virtual void access(const ConstraintHolder<unsigned> &p) const <co id="mockmeth-fwd-constraint-co" linkends="mockmeth-fwd-constraint" /> + { + return access_mocker.forward(p); + } + + VisitableMockMethod1<int, unsigned> access_mocker; <co id="mockmeth-var-co" linkends="mockmeth-var" /> + }; + + MyVisitableMockObject mvmo("mvmo"); + + VisitableMockMethod1<int, unsigned> &access_ctr (mvmo.access_mocker); <co id="mockmeth-ref-co" linkends="mockmeth-ref" /> + + access_ctr.addThrowable(std::string("throw"), 2); + access_ctr.addResponseValue(1, 13); + access_ctr.addResponseValue(2, 37); + access_ctr.addResponseValue(3, eq(50u)); <co id="mockmeth-setup-co" linkends="mockmeth-setup" /> + + mvmo.access(1); + mvmo.access(13); + mvmo.access(eq(123)); + + mvmo.activate(); + + // use the object + + mvmo.verify(); + +</programlisting> + +<calloutlist> + + <callout arearefs="mockmeth-cons-co" id="mockmeth-cons" > + <para>Construct the mock method helper object.</para> + </callout> + + <callout arearefs="mockmeth-fwd-co" id="mockmeth-fwd" > + <para>Provide the method as entry point and forward the call to + the method which does the actual work.</para> + </callout> + + <callout arearefs="mockmeth-fwd-constraint-co" id="mockmeth-fwd-constraint" > + <para>If you want to benefit from <link linkend="parameter-constraint">constraints</link> + you have to provide an overloaded method which forwards the + constraint holder. This method has always return type <token>void</token> + and should be <token>const</token>. Of course you can call this method only + in record mode.</para> + </callout> + + <callout arearefs="mockmeth-var-co" id="mockmeth-var" > + <para>Instantiate a mock method variable. Select the class according + to the parameters the method takes. There also a template without a trailing + number which handles an arbitrary parameter count.</para> + </callout> + + <callout arearefs="mockmeth-ref-co" id="mockmeth-ref" > + <para>For convenience create a reference to the mock method helper.</para> + </callout> + + <callout arearefs="mockmeth-setup-co" id="mockmeth-setup" > + <para>Set up the mock objects behaviour in the same manner as + described above using the macros.</para> + </callout> + +</calloutlist> + +</sect3> + <sect3 id="visit-order"> <title>Dispatching Order</title> Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/Makefile.am,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- Makefile.am 14 Nov 2005 19:42:14 -0000 1.36 +++ Makefile.am 17 Nov 2005 21:08:52 -0000 1.37 @@ -29,10 +29,9 @@ ln -s ../../examples/tutorial/html tutorial -test -L api-doc && rm api-doc ln -s ../../docs/api/html api-doc - mkdir -pv var - -rm -rf ./var -rm -rf ./var/common -rm -rf ./var/images + mkdir -pv var cp -R $(srcdir)/common var cp -R $(srcdir)/images var xsltproc --nonet -o var/ $(srcdir)/customize-chunked.xsl $(srcdir)/index.docbook |
From: Ewald A. <ewa...@us...> - 2005-11-15 19:42:26
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13319/mockpp/tests Modified Files: ChainableMockMethod_1_test.cpp ChainableMockMethod_2_test.cpp ChainableMockMethod_test.cpp Log Message: omit chainer Index: ChainableMockMethod_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_test.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ChainableMockMethod_test.cpp 3 Nov 2005 20:44:06 -0000 1.11 +++ ChainableMockMethod_test.cpp 15 Nov 2005 19:42:18 -0000 1.12 @@ -151,7 +151,7 @@ { MyChainableMockObject_0 mcm(MOCKPP_PCHAR("chainable-object")); - mockpp::ChainableMockMethod0<int>::ChainerFor chain(mcm.chainable_mocker); + mockpp::ChainableMockMethod0<int>& chain(mcm.chainable_mocker); chain.stubs(mockpp::once()) .will(mockpp::returnValue<int>(21)); @@ -180,7 +180,7 @@ { MyChainableMockObject_0 mcm(MOCKPP_PCHAR("chainable-object")); - mockpp::ChainableMockMethod0<void>::ChainerFor chain(mcm.chainablev_mocker); + mockpp::ChainableMockMethod0<void> &chain(mcm.chainablev_mocker); unsigned counter = 0; chain.stubs(mockpp::once()) Index: ChainableMockMethod_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_1_test.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ChainableMockMethod_1_test.cpp 3 Nov 2005 20:44:06 -0000 1.9 +++ ChainableMockMethod_1_test.cpp 15 Nov 2005 19:42:18 -0000 1.10 @@ -108,7 +108,7 @@ { MyChainableMockObject_1 mcm(MOCKPP_PCHAR("chainable-object")); - mockpp::ChainableMockMethod1<int, unsigned>::ChainerFor chain(mcm.chainable_mocker); + mockpp::ChainableMockMethod1<int, unsigned> &chain(mcm.chainable_mocker); chain.stubs(mockpp::once()) .with(mockpp::eq(12u)) @@ -139,7 +139,7 @@ { MyChainableMockObject_1 mcm(MOCKPP_PCHAR("chainable-object")); - mockpp::ChainableMockMethod1<void, unsigned>::ChainerFor chain(mcm.chainablev_mocker); + mockpp::ChainableMockMethod1<void, unsigned> &chain(mcm.chainablev_mocker); unsigned counter = 0; chain.stubs(mockpp::once()) Index: ChainableMockMethod_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockMethod_2_test.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockMethod_2_test.cpp 3 Nov 2005 20:44:06 -0000 1.7 +++ ChainableMockMethod_2_test.cpp 15 Nov 2005 19:42:18 -0000 1.8 @@ -106,8 +106,7 @@ void ChainableMockMethod_2_test::test_parameter_2() { MyChainableMockObject_2 mcm(MOCKPP_PCHAR("chainable-object")); - - mockpp::ChainableMockMethod2<int, unsigned, long>::ChainerFor chain(mcm.chainable_mocker); + mockpp::ChainableMockMethod2<int, unsigned, long> &chain(mcm.chainable_mocker); chain.stubs(mockpp::once()) .with(mockpp::eq<unsigned>(12u), @@ -140,7 +139,7 @@ { MyChainableMockObject_2 mcm(MOCKPP_PCHAR("chainable-object")); - mockpp::ChainableMockMethod2<void, unsigned, long>::ChainerFor chain(mcm.chainablev_mocker); + mockpp::ChainableMockMethod2<void, unsigned, long> &chain(mcm.chainablev_mocker); unsigned counter = 0; // IncCounter<unsigned> ctr(counter); |
From: Ewald A. <ewa...@us...> - 2005-11-15 19:42:16
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13274/mockpp/chaining Modified Files: ChainableMockMethod0.h ChainableMockMethod1.h ChainableMockMethod2.h ChainableMockMethod3.h ChainableMockMethod4.h ChainableMockMethod5.h ChainableMockMethod6.h gen_chainablemethod_N.pl Log Message: omit chainer Index: ChainableMockMethod6.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod6.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ChainableMockMethod6.h 13 Nov 2005 11:53:18 -0000 1.5 +++ ChainableMockMethod6.h 15 Nov 2005 19:42:04 -0000 1.6 @@ -44,7 +44,9 @@ * @ingroup grp_controller */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> -class ChainableMockMethod6Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod6Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder6<R, Invocation6<P1, P2, P3, P4, P5, P6> > > { public: @@ -53,12 +55,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder6<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent chainable mock object */ ChainableMockMethod6Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR("/coreMock"), this) { } @@ -73,28 +78,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder6<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * @ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * @param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod6Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; Index: ChainableMockMethod2.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod2.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockMethod2.h 13 Nov 2005 11:53:18 -0000 1.7 +++ ChainableMockMethod2.h 15 Nov 2005 19:42:04 -0000 1.8 @@ -44,7 +44,9 @@ * @ingroup grp_controller */ template <typename R, typename P1, typename P2> -class ChainableMockMethod2Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod2Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder2<R, Invocation2<P1, P2> > > { public: @@ -53,12 +55,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder2<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent chainable mock object */ ChainableMockMethod2Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR("/coreMock"), this) { } @@ -73,28 +78,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder2<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * @ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * @param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod2Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; Index: ChainableMockMethod3.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod3.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockMethod3.h 13 Nov 2005 11:53:18 -0000 1.7 +++ ChainableMockMethod3.h 15 Nov 2005 19:42:04 -0000 1.8 @@ -44,7 +44,9 @@ * @ingroup grp_controller */ template <typename R, typename P1, typename P2, typename P3> -class ChainableMockMethod3Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod3Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder3<R, Invocation3<P1, P2, P3> > > { public: @@ -53,12 +55,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder3<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent chainable mock object */ ChainableMockMethod3Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR("/coreMock"), this) { } @@ -73,28 +78,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder3<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * @ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * @param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod3Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; Index: ChainableMockMethod4.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod4.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockMethod4.h 13 Nov 2005 11:53:18 -0000 1.7 +++ ChainableMockMethod4.h 15 Nov 2005 19:42:04 -0000 1.8 @@ -44,7 +44,9 @@ * @ingroup grp_controller */ template <typename R, typename P1, typename P2, typename P3, typename P4> -class ChainableMockMethod4Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod4Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder4<R, Invocation4<P1, P2, P3, P4> > > { public: @@ -53,12 +55,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder4<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent chainable mock object */ ChainableMockMethod4Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR("/coreMock"), this) { } @@ -73,28 +78,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder4<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * @ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * @param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod4Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; Index: gen_chainablemethod_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/gen_chainablemethod_N.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gen_chainablemethod_N.pl 31 Oct 2005 19:01:00 -0000 1.4 +++ gen_chainablemethod_N.pl 15 Nov 2005 19:42:04 -0000 1.5 @@ -170,7 +170,21 @@ * \@ingroup grp_controller */ template <typename R" . $templateParms_colon . "> -class ChainableMockMethod" . $numArgs . "Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod" . $numArgs . "Common + : public ChainableMockMethodCommon<R>"; + +if ($numArgs > 0) +{ +print OUT " + , public ChainingMockBuilder <ArgumentsMatchBuilder" . $numArgs . "<R, Invocation" . $numArgs . "<" . $templateArgs . "> > >"; +} +else +{ +print OUT " + , public ChainingMockBuilder <ArgumentsMatchBuilder0<R, Invocation0> >"; +} + +print OUT " { public: "; @@ -191,12 +205,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder" . $numArgs . "<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * \@param name human readable description about the expectation * \@param parent parent chainable mock object */ ChainableMockMethod" . $numArgs . "Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR(\"/coreMock\"), this) { } @@ -211,28 +228,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder" . $numArgs . "<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * \@ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * \@param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod" . $numArgs . "Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; Index: ChainableMockMethod5.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod5.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockMethod5.h 13 Nov 2005 11:53:18 -0000 1.7 +++ ChainableMockMethod5.h 15 Nov 2005 19:42:04 -0000 1.8 @@ -44,7 +44,9 @@ * @ingroup grp_controller */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5> -class ChainableMockMethod5Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod5Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder5<R, Invocation5<P1, P2, P3, P4, P5> > > { public: @@ -53,12 +55,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder5<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent chainable mock object */ ChainableMockMethod5Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR("/coreMock"), this) { } @@ -73,28 +78,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder5<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * @ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * @param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod5Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; Index: ChainableMockMethod0.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod0.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockMethod0.h 13 Nov 2005 11:53:18 -0000 1.7 +++ ChainableMockMethod0.h 15 Nov 2005 19:42:04 -0000 1.8 @@ -44,7 +44,9 @@ * @ingroup grp_controller */ template <typename R> -class ChainableMockMethod0Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod0Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder0<R, Invocation0> > { public: @@ -53,12 +55,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder0<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent chainable mock object */ ChainableMockMethod0Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR("/coreMock"), this) { } @@ -73,28 +78,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder0<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * @ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * @param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod0Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; Index: ChainableMockMethod1.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainableMockMethod1.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChainableMockMethod1.h 13 Nov 2005 11:53:18 -0000 1.7 +++ ChainableMockMethod1.h 15 Nov 2005 19:42:04 -0000 1.8 @@ -44,7 +44,9 @@ * @ingroup grp_controller */ template <typename R, typename P1> -class ChainableMockMethod1Common : public ChainableMockMethodCommon<R> +class ChainableMockMethod1Common + : public ChainableMockMethodCommon<R> + , public ChainingMockBuilder <ArgumentsMatchBuilder1<R, Invocation1<P1> > > { public: @@ -53,12 +55,15 @@ typedef CoreMock<R, InvocationType> CoreMockType; typedef R ReturnType; + typedef ChainingMockBuilder <ArgumentsMatchBuilder1<ReturnType, InvocationType> > Builder; + /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent chainable mock object */ ChainableMockMethod1Common(const String &name, ChainableMockObject *parent ) : ChainableMockMethodCommon<R>(name, parent) + , Builder(&coremock, this->getChainableMockObject(), this->getMethodName()) , coremock(name + MOCKPP_PCHAR("/coreMock"), this) { } @@ -73,28 +78,6 @@ return coremock; } - public: - - typedef ChainingMockBuilder <ArgumentsMatchBuilder1<ReturnType, InvocationType> > Builder; - - /** Helper object to easily set up the chainable expectations. - * @ingroup grp_controller - */ - class ChainerFor : public Builder - { - public: - - /** Construct the chainer object. - * @param method pointer to according method mock. - */ - ChainerFor(ChainableMockMethod1Common &method) - : Builder(&method.getCoreMock(), method.getChainableMockObject(), method.getMethodName()) - { - } - }; - - friend class ChainerFor; - private: mutable CoreMockType coremock; |
From: Ewald A. <ewa...@us...> - 2005-11-15 19:19:56
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9026/mockpp/tests Modified Files: VisitableMockMethod_test.cpp Log Message: more tests Index: VisitableMockMethod_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockMethod_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- VisitableMockMethod_test.cpp 13 Nov 2005 14:07:12 -0000 1.13 +++ VisitableMockMethod_test.cpp 15 Nov 2005 19:19:48 -0000 1.14 @@ -69,8 +69,8 @@ CPPUNIT_TEST_SUITE( VisitableMockMethod_test ); -// CPPUNIT_TEST( test_parameter_0 ); -// CPPUNIT_TEST( test_parameter_0V ); + CPPUNIT_TEST( test_parameter_0 ); + CPPUNIT_TEST( test_parameter_0v ); CPPUNIT_TEST( test_base ); CPPUNIT_TEST( test_inst ); CPPUNIT_TEST( test_base_returning ); @@ -82,16 +82,14 @@ void test_base(); void test_inst(); void test_base_returning(); -// void test_parameter_0(); -// void test_parameter_0V(); + void test_parameter_0(); + void test_parameter_0v(); }; CPPUNIT_TEST_SUITE_REGISTRATION(VisitableMockMethod_test); -#ifdef MOCKPP_XXX - class MyVisitableMockObject_0 : public mockpp::VisitableMockObject { public: @@ -106,42 +104,17 @@ { return visitable_mocker.forward(); } -i + void visitablev() { visitablev_mocker.forward(); } mockpp::VisitableMockMethod0<int> visitable_mocker; - mockpp::VisitableMockMethod0<void> visitable_mockerv; + mockpp::VisitableMockMethod0<void> visitablev_mocker; }; -void VisitableMockMethod_test::test_parameter_0() -{ - MyVisitableMockObject_0 mcm(MOCKPP_PCHAR("Visitable-object")); -/* - mockpp::VisitableMockMethod0<int>::ChainerFor chain(mcm.Visitable_mocker); - - MOCKPP_ASSERT_TRUE(mcm.Visitable() == 21); - MOCKPP_ASSERT_TRUE(mcm.Visitable() == 43); - - try - { - mcm.Visitable(56); - MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); - } - catch(mockpp::AssertionFailedError &ex) - { - MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); - } -*/ - mcm.verify(); -} - -#endif - - void VisitableMockMethod_test::test_inst() { mockpp::VisitableMockMethod0<void> mmv0(MOCKPP_PCHAR("mm0"), 0); @@ -328,7 +301,231 @@ } +void VisitableMockMethod_test::test_parameter_0() +{ + MyVisitableMockObject_0 vmo(MOCKPP_PCHAR("Visitable-object")); + mockpp::VisitableMockMethod0<int> &vmb (vmo.visitable_mocker); + + vmb.addThrowable(mockpp::make_throwable(333u)); + vmb.setDefaultThrowable(mockpp::make_throwable(444u)); + vmb.setDefaultReturnValue(999); + vmb.addReturnValue(888, 2); + vmo.reset(); + + ////////////////////////////////////////////////////// + + vmb.setDefaultReturnValue(123); + vmb.addReturnValue(321, 1); + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addReturnValue(432, 1); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitable(); + vmo.visitable(); + vmo.visitable(); + vmo.visitable(); + vmo.visitable(); + + vmo.activate(); + + MOCKPP_ASSERT_EQUALS(321, vmo.visitable()); + + MOCKPP_ASSERT_THROWING(vmo.visitable(), + MOCKPP_PCHAR("vmo.visitable()-1a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_EQUALS(432, vmo.visitable()); + + MOCKPP_ASSERT_THROWING(vmo.visitable(), + MOCKPP_PCHAR("vmo.visitable()-1b"), + unsigned, + unsigned(321)); + + MOCKPP_ASSERT_EQUALS(123, vmo.visitable()); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.unsetThrowablesInline(); + + vmb.setDefaultReturnValue(123); + + vmb.addReturnValue(321, 1); + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addReturnValue(432, 1); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitable(); + vmo.visitable(); + vmo.visitable(); + vmo.visitable(); + vmo.visitable(); + + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitable(), + MOCKPP_PCHAR("vmo.visitable()-2a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(), + MOCKPP_PCHAR("vmo.visitable()-2b"), + unsigned, + unsigned(321)); + + MOCKPP_ASSERT_EQUALS(321, vmo.visitable()); + MOCKPP_ASSERT_EQUALS(432, vmo.visitable()); + MOCKPP_ASSERT_EQUALS(123, vmo.visitable()); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.setDefaultThrowable(mockpp::make_throwable(111u)); + vmb.addThrowable(mockpp::make_throwable(123u)); + + vmo.visitable(); + vmo.visitable(); + vmo.visitable(); + + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitable(), + MOCKPP_PCHAR("vmo.visitable()-3a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(), + MOCKPP_PCHAR("vmo.visitable()-3b"), + unsigned, + unsigned(111)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(), + MOCKPP_PCHAR("vmo.visitable()-3c"), + unsigned, + unsigned(111)); + + vmo.verify(); + vmb.verify(); +} + + +void VisitableMockMethod_test::test_parameter_0v() +{ + MyVisitableMockObject_0 vmo(MOCKPP_PCHAR("Visitable-object")); + mockpp::VisitableMockMethod0<void> &vmb (vmo.visitablev_mocker); + mockpp::VisitableMockMethod0<int> &vmbi (vmo.visitable_mocker); + + vmb.setDefaultThrowable(mockpp::make_throwable(444u)); + vmb.addThrowable(mockpp::make_throwable(333u)); + vmo.reset(); + + vmbi.setDefaultReturnValue(999); + + ////////////////////////////////////////////////////// + + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitablev(); + vmo.visitablev(); + vmo.visitablev(); + vmo.visitable(); + vmo.visitable(); + vmo.visitablev(); + + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(), + MOCKPP_PCHAR("vmo.visitablev()-1a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(), + MOCKPP_PCHAR("vmo.visitablev()-1b"), + unsigned, + unsigned(321)); + + vmo.visitablev(); + vmo.visitable(); + vmo.visitable(); + vmo.visitablev(); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.unsetThrowablesInline(); + + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitablev(); + vmo.visitablev(); + vmo.visitablev(); + vmo.visitablev(); + vmo.visitablev(); + + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(), + MOCKPP_PCHAR("vmo.visitablev()-2a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(), + MOCKPP_PCHAR("vmo.visitablev()-2b"), + unsigned, + unsigned(321)); + + vmo.visitablev(); + vmo.visitablev(); + vmo.visitablev(); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.setDefaultThrowable(mockpp::make_throwable(111u)); + vmb.addThrowable(mockpp::make_throwable(123u)); + + vmo.visitablev(); + vmo.visitablev(); + vmo.visitablev(); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(), + MOCKPP_PCHAR("vmo.visitablev()-3a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(), + MOCKPP_PCHAR("vmo.visitablev()-3b"), + unsigned, + unsigned(111)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(), + MOCKPP_PCHAR("vmo.visitablev()-3c"), + unsigned, + unsigned(111)); + + vmo.verify(); + vmb.verify(); +} + + } // anon ns #endif // HAVE_CPPUNIT + |
From: Ewald A. <ewa...@us...> - 2005-11-15 19:19:37
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8942/mockpp/docs/en Modified Files: bookinfo.docbook Log Message: update Index: bookinfo.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/bookinfo.docbook,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- bookinfo.docbook 24 Jul 2005 12:54:37 -0000 1.8 +++ bookinfo.docbook 15 Nov 2005 19:19:25 -0000 1.9 @@ -30,7 +30,7 @@ <abstract> <para> &mockpp; is a platform independent generic unit testing framework for C++. It's goal -is to facilitate developing unit tests in the spirit of +is to facilitate developing unit tests and integration tests in the spirit of <ulink url="http://www.mockobjects.com/">Mock Objects for Java</ulink>, <ulink url="http://www.easymock.org/">EasyMock</ulink>. and <ulink url="http://www.jmock.org/">jMock</ulink>. |
From: Ewald A. <ewa...@us...> - 2005-11-14 19:42:48
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9506 Modified Files: configure.in Log Message: use public identifiers for docbook Index: configure.in =================================================================== RCS file: /cvsroot/mockpp/mockpp/configure.in,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- configure.in 31 Oct 2005 19:21:01 -0000 1.93 +++ configure.in 14 Nov 2005 19:42:39 -0000 1.94 @@ -461,7 +461,6 @@ mockpp/docs/Makefile \ mockpp/docs/api/Makefile \ mockpp/docs/en/Makefile \ - mockpp/docs/en/customize.xsl \ mockpp/docs/en/common/Makefile \ mockpp/docs/en/images/Makefile \ mockpp/docs/en/images/callouts/Makefile \ |
From: Ewald A. <ewa...@us...> - 2005-11-14 19:42:22
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9441/mockpp/docs/en Modified Files: .cvsignore Makefile.am Added Files: customize.xsl Removed Files: customize.xsl.in Log Message: use public identifiers Index: .cvsignore =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/.cvsignore,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- .cvsignore 29 May 2005 20:09:39 -0000 1.7 +++ .cvsignore 14 Nov 2005 19:42:14 -0000 1.8 @@ -5,4 +5,3 @@ Makefile.in index.cache.bz2 *.kdevses -customize.xsl --- customize.xsl.in DELETED --- --- NEW FILE: customize.xsl --- <?xml version='1.0'?> <!-- Common custumisation options $Id: customize.xsl,v 1.11 2005/11/14 19:42:14 ewald-arnold Exp $ --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/> <!-- <xsl:template name="user.footer.content"> <HR/><center><P class="copyright">© 2002 Megacorp, Inc.</P> <br /> </center> </xsl:template> user.header.navigation Called before standard navigational header. header.navigation The standard navigational header. user.header.content Called after standard navigational header but before any other content. user.footer.content Called after the chunk content but before the standard navigational footer. footer.navigation The standard navigational footer. user.footer.navigation Called after the standard navigational footer --> <xsl:param name="html.stylesheet" select="'common/mockpp.css'"/> <xsl:param name="admon.graphics" select="1"/> <xsl:param name="linenumbering.extension" select="1"/> <xsl:param name="chapter.autolabel" select="1"/> <xsl:param name="appendix.autolabel" select="1"/> <xsl:param name="section.autolabel" select="1"/> <!-- xsl:param name="section.autolabel.max.depth" select="4"/ --> <xsl:param name="section.label.includes.component.label" select="1"/> <xsl:param name="callout.graphics.number.limit" select="'15'"/> <xsl:param name="use.id.as.filename" select="'1'"/> <xsl:param name="use.extensions" select="'1'"/> </xsl:stylesheet> Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/Makefile.am,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- Makefile.am 14 Nov 2005 19:35:08 -0000 1.35 +++ Makefile.am 14 Nov 2005 19:42:14 -0000 1.36 @@ -24,10 +24,7 @@ ################################################################ -$(srcdir)/customize.xsl: customize.xsl - cp $< $@ - -html-chunk-files: $(srcdir)/customize.xsl +html-chunk-files: -test -L tutorial && rm tutorial ln -s ../../examples/tutorial/html tutorial -test -L api-doc && rm api-doc @@ -40,7 +37,7 @@ cp -R $(srcdir)/images var xsltproc --nonet -o var/ $(srcdir)/customize-chunked.xsl $(srcdir)/index.docbook -html-flat-files: $(srcdir)/customize.xsl +html-flat-files: -test -L tutorial && rm tutorial ln -s ../../examples/tutorial/html tutorial -test -L api-doc && rm api-doc |
From: Ewald A. <ewa...@us...> - 2005-11-14 19:35:17
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8246/mockpp/docs/en Modified Files: index.docbook Makefile.am Log Message: use public identifiers Index: index.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/index.docbook,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- index.docbook 23 Sep 2005 20:53:09 -0000 1.31 +++ index.docbook 14 Nov 2005 19:35:08 -0000 1.32 @@ -4,14 +4,14 @@ --> <!DOCTYPE book PUBLIC "-//OASIS//DTD Docbook XML V4.1.2//EN" - "/usr/share/xml/docbook/schema/dtd/4.2/docbookx.dtd" [ + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ <!ENTITY mockpp '<application>mockpp</application>' > <!ENTITY cppunit '<application>cppunit</application>' > <!ENTITY copyyears '2002-2005' > <!ENTITY mockpp_email 'mockpp at ewald-arnold dot de' > <!ENTITY release_date '<pubdate>Published: <?dbtimestamp format="Y-m-d"?></pubdate>' > - <!ENTITY release_info '<releaseinfo>1.09.04</releaseinfo>' > + <!ENTITY release_info '<releaseinfo>1.10.00</releaseinfo>' > <!ENTITY chap_bookinfo SYSTEM 'bookinfo.docbook' > <!ENTITY chap_intro SYSTEM 'intro.docbook' > Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/Makefile.am,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- Makefile.am 2 Nov 2005 19:36:18 -0000 1.34 +++ Makefile.am 14 Nov 2005 19:35:08 -0000 1.35 @@ -38,7 +38,7 @@ -rm -rf ./var/images cp -R $(srcdir)/common var cp -R $(srcdir)/images var - xsltproc -o var/ $(srcdir)/customize-chunked.xsl $(srcdir)/index.docbook + xsltproc --nonet -o var/ $(srcdir)/customize-chunked.xsl $(srcdir)/index.docbook html-flat-files: $(srcdir)/customize.xsl -test -L tutorial && rm tutorial @@ -51,7 +51,7 @@ -rm -rf ./var/images cp -R $(srcdir)/common var cp -R $(srcdir)/images var - xsltproc -o var/ $(srcdir)/customize-flat.xsl $(srcdir)/index.docbook + xsltproc --nonet -o var/ $(srcdir)/customize-flat.xsl $(srcdir)/index.docbook html-files: html-chunk-files @@ -63,11 +63,11 @@ -rm -rf ./var/*.pdf cp -R $(srcdir)/common var cp -R $(srcdir)/images var - xsltproc --output var/mockpp.fo /usr/share/xml/docbook/stylesheet/nwalsh/current/fo/docbook.xsl $(srcdir)/index.docbook + xsltproc --nonet --output var/mockpp.fo http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $(srcdir)/index.docbook fop var/mockpp.fo var/mockpp.pdf && cp -v var/mockpp.pdf $(top_builddir)/mockpp-$(VERSION)-handbook.pdf svg-files: - xsltproc --output var/mockpp.fo /usr/share/xml/docbook/stylesheet/nwalsh/current/fo/docbook.xsl $(srcdir)/index.docbook + xsltproc --nonet -output var/mockpp.fo http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $(srcdir)/index.docbook fop var/mockpp.fo -svg var/mockpp.svg .PHONY: html-files pdf-files doc-dist remote-install doc \ |
From: Ewald A. <ewa...@us...> - 2005-11-14 19:20:44
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5553/mockpp/tests Modified Files: VisitableMockMethod_1_test.cpp VisitableMockMethod_2_test.cpp Log Message: more tests Index: VisitableMockMethod_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockMethod_2_test.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VisitableMockMethod_2_test.cpp 14 Nov 2005 17:39:21 -0000 1.7 +++ VisitableMockMethod_2_test.cpp 14 Nov 2005 19:20:35 -0000 1.8 @@ -42,8 +42,6 @@ #include <mockpp/chaining/ChainingMockObjectSupport.h> -#include <mockpp/constraint/OutBound.h> - #include <cppunit/extensions/HelperMacros.h> namespace { // anon Index: VisitableMockMethod_1_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockMethod_1_test.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- VisitableMockMethod_1_test.cpp 15 Oct 2005 15:40:59 -0000 1.3 +++ VisitableMockMethod_1_test.cpp 14 Nov 2005 19:20:35 -0000 1.4 @@ -37,18 +37,16 @@ #else -#include <mockpp/VisitableMockMethod.h> +#include <mockpp/VisitableMockMethod1.h> #include <mockpp/VisitableMockObject.h> -#include <mockpp/constraint/OutBound.h> +#include <mockpp/chaining/ChainingMockObjectSupport.h> #include <cppunit/extensions/HelperMacros.h> namespace { // anon -#ifdef MOCKPP_XXX - class VisitableMockMethod_1_test : public CppUnit::TestFixture { public: @@ -56,12 +54,14 @@ CPPUNIT_TEST_SUITE( VisitableMockMethod_1_test ); CPPUNIT_TEST( test_parameter_1 ); + CPPUNIT_TEST( test_parameter_1v ); CPPUNIT_TEST_SUITE_END(); public: void test_parameter_1(); + void test_parameter_1v(); }; @@ -74,41 +74,301 @@ MyVisitableMockObject_1(const mockpp::String &name) : mockpp::VisitableMockObject(name, 0) - , visitable_mocker(MOCKPP_PCHAR("Visitable"), this) + , visitable_mocker(MOCKPP_PCHAR("visitablei1"), this) + , visitablev_mocker(MOCKPP_PCHAR("visitablev2"), this) {} + void visitable(const mockpp::ConstraintHolder<unsigned> &p1) + { + visitable_mocker.forward(p1); + } + int visitable(unsigned i) { return visitable_mocker.forward(i); } + void visitablev(const mockpp::ConstraintHolder<unsigned> &p1) + { + visitablev_mocker.forward(p1); + } + + void visitablev(unsigned i) + { + visitablev_mocker.forward(i); + } + mockpp::VisitableMockMethod1<int, unsigned> visitable_mocker; + mockpp::VisitableMockMethod1<void, unsigned> visitablev_mocker; }; void VisitableMockMethod_1_test::test_parameter_1() { - MyVisitableMockObject_1 mcm(MOCKPP_PCHAR("Visitable-object")); -/* - mockpp::VisitableMockMethod1<int, unsigned>::ChainerFor chain(mcm, mcm.Visitable_mocker); + MyVisitableMockObject_1 vmo(MOCKPP_PCHAR("Visitable-object")); + mockpp::VisitableMockMethod1<int, unsigned> &vmb (vmo.visitable_mocker); - MOCKPP_ASSERT_TRUE(mcm.Visitable(12) == 21); - MOCKPP_ASSERT_TRUE(mcm.Visitable(34) == 43); + vmb.addThrowable(mockpp::make_throwable(333u)); + vmb.setDefaultThrowable(mockpp::make_throwable(444u)); + vmb.setDefaultReturnValue(999); + vmb.addReturnValue(888, 2); + vmo.reset(); - try - { - mcm.Visitable(56); - MOCKPP_ASSERT_TRUE_MESSAGE(MOCKPP_PCHAR("should have thrown"), false); - } - catch(mockpp::AssertionFailedError &ex) - { - MOCKPP_ASSERT_TRUE(ex.getMessage().find(MOCKPP_PCHAR("unexpected invocation")) != mockpp::String::npos); - } -*/ - mcm.verify(); + ////////////////////////////////////////////////////// + + vmb.setDefaultReturnValue(123); + vmb.addReturnValue(321, 1); + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addReturnValue(432, 1); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitable(1); + vmo.visitable(2); + vmo.visitable(3); + vmo.visitable(4); + vmo.visitable(5); + vmo.visitable(12); + vmo.visitable(mockpp::eq<unsigned>(10, 2)); + vmo.visitable(13); + vmo.visitable(14); + vmo.visitable(15); + vmo.visitable(52); + vmb.addResponseValue(222, 12); + vmb.addResponseValue(333, 13); + vmb.addResponseValue(666, mockpp::eq<unsigned>(10, 1)); + vmb.addResponseThrowable(mockpp::make_throwable(444u), 14); + vmb.addResponseThrowable(mockpp::make_throwable(555u), 15); + vmb.addResponseThrowable(mockpp::make_throwable(666u), mockpp::eq<unsigned>(50, 2)); + + vmo.activate(); + + MOCKPP_ASSERT_EQUALS(321, vmo.visitable(1)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(2), + MOCKPP_PCHAR("vmo.visitable()-1a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_EQUALS(432, vmo.visitable(3)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(4), + MOCKPP_PCHAR("vmo.visitable()-1b"), + unsigned, + unsigned(321)); + + MOCKPP_ASSERT_EQUALS(123, vmo.visitable(5)); + + MOCKPP_ASSERT_EQUALS(222, vmo.visitable(12)); + MOCKPP_ASSERT_EQUALS(666, vmo.visitable(11)); + MOCKPP_ASSERT_EQUALS(333, vmo.visitable(13)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(14), + MOCKPP_PCHAR("vmo.visitable()-1a"), + unsigned, + unsigned(444)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(15), + MOCKPP_PCHAR("vmo.visitable()-1b"), + unsigned, + unsigned(555)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(52), + MOCKPP_PCHAR("vmo.visitable()-1c"), + unsigned, + unsigned(666)); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.unsetThrowablesInline(); + + vmb.setDefaultReturnValue(123); + + vmb.addReturnValue(321, 1); + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addReturnValue(432, 1); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitable(9); + vmo.visitable(8); + vmo.visitable(1); + vmo.visitable(2); + vmo.visitable(3); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitable(9), + MOCKPP_PCHAR("vmo.visitable()-2a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(9), + MOCKPP_PCHAR("vmo.visitable()-2b"), + unsigned, + unsigned(321)); + + MOCKPP_ASSERT_EQUALS(321, vmo.visitable(1)); + MOCKPP_ASSERT_EQUALS(432, vmo.visitable(2)); + MOCKPP_ASSERT_EQUALS(123, vmo.visitable(3)); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.setDefaultThrowable(mockpp::make_throwable(111u)); + vmb.addThrowable(mockpp::make_throwable(123u)); + + vmo.visitable(1); + vmo.visitable(2); + vmo.visitable(3); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitable(1), + MOCKPP_PCHAR("vmo.visitable()-3a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(2), + MOCKPP_PCHAR("vmo.visitable()-3b"), + unsigned, + unsigned(111)); + + MOCKPP_ASSERT_THROWING(vmo.visitable(3), + MOCKPP_PCHAR("vmo.visitable()-3c"), + unsigned, + unsigned(111)); + + vmo.verify(); + vmb.verify(); +} + + +void VisitableMockMethod_1_test::test_parameter_1v() +{ + MyVisitableMockObject_1 vmo(MOCKPP_PCHAR("Visitable-object")); + mockpp::VisitableMockMethod1<void, unsigned> &vmb (vmo.visitablev_mocker); + mockpp::VisitableMockMethod1<int, unsigned> &vmbi (vmo.visitable_mocker); + + vmb.setDefaultThrowable(mockpp::make_throwable(444u)); + vmb.addThrowable(mockpp::make_throwable(333u)); + vmo.reset(); + + vmbi.setDefaultReturnValue(999); + + ////////////////////////////////////////////////////// + + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitablev(1); + vmo.visitablev(2); + vmo.visitablev(2); + vmo.visitablev(mockpp::eq<unsigned>(10, 2)); + vmo.visitable(20); + vmo.visitable(200); + vmo.visitablev(3); + vmo.visitablev(14); + vmo.visitablev(15); + vmb.addResponseThrowable(mockpp::make_throwable(444u), 14); + vmb.addResponseThrowable(mockpp::make_throwable(555u), 15); + + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(2), + MOCKPP_PCHAR("vmo.visitablev()-1a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(4), + MOCKPP_PCHAR("vmo.visitablev()-1b"), + unsigned, + unsigned(321)); + + vmo.visitablev(2); + vmo.visitablev(11); + MOCKPP_ASSERT_EQUALS(999, vmo.visitable(20)); + MOCKPP_ASSERT_EQUALS(999, vmo.visitable(200)); + vmo.visitablev(3); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(14), + MOCKPP_PCHAR("vmo.visitablev()-2"), + unsigned, + unsigned(444)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(15), + MOCKPP_PCHAR("vmo.visitablev()-3"), + unsigned, + unsigned(555)); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.unsetThrowablesInline(); + + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitablev(9); + vmo.visitablev(8); + vmo.visitablev(1); + vmo.visitablev(2); + vmo.visitablev(3); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(9), + MOCKPP_PCHAR("vmo.visitablev()-2a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(8), + MOCKPP_PCHAR("vmo.visitablev()-2b"), + unsigned, + unsigned(321)); + + vmo.visitablev(1); + vmo.visitablev(2); + vmo.visitablev(3); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.setDefaultThrowable(mockpp::make_throwable(111u)); + vmb.addThrowable(mockpp::make_throwable(123u)); + + vmo.visitablev(1); + vmo.visitablev(2); + vmo.visitablev(3); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(1), + MOCKPP_PCHAR("vmo.visitablev()-3a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(2), + MOCKPP_PCHAR("vmo.visitablev()-3b"), + unsigned, + unsigned(111)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(3), + MOCKPP_PCHAR("vmo.visitablev()-3c"), + unsigned, + unsigned(111)); + + vmo.verify(); + vmb.verify(); } -#endif } // anon ns |
From: Ewald A. <ewa...@us...> - 2005-11-14 17:39:28
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14465/mockpp/tests Modified Files: VisitableMockMethod_2_test.cpp Log Message: more tests Index: VisitableMockMethod_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockMethod_2_test.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- VisitableMockMethod_2_test.cpp 14 Nov 2005 17:25:14 -0000 1.6 +++ VisitableMockMethod_2_test.cpp 14 Nov 2005 17:39:21 -0000 1.7 @@ -137,10 +137,15 @@ vmo.visitable(3, 3); vmo.visitable(4, 4); vmo.visitable(5, 5); + vmo.visitable(52, 58); vmb.addResponseValue(222, 2, 2); vmb.addResponseValue(333, 3, 3); + vmb.addResponseValue(666, mockpp::eq<unsigned>(2, 2), + mockpp::eq<unsigned>(20, 2)); vmb.addResponseThrowable(mockpp::make_throwable(444u), 4, 4); vmb.addResponseThrowable(mockpp::make_throwable(555u), 5, 5); + vmb.addResponseThrowable(mockpp::make_throwable(666u), mockpp::eq<unsigned>(50, 2), + mockpp::eq<unsigned>(60, 2)); vmo.activate(); @@ -161,7 +166,7 @@ MOCKPP_ASSERT_EQUALS(123, vmo.visitable(5, 6)); MOCKPP_ASSERT_EQUALS(222, vmo.visitable(2, 2)); - MOCKPP_ASSERT_EQUALS(123, vmo.visitable(3, 21)); + MOCKPP_ASSERT_EQUALS(666, vmo.visitable(3, 21)); MOCKPP_ASSERT_EQUALS(333, vmo.visitable(3, 3)); MOCKPP_ASSERT_THROWING(vmo.visitable(4, 4), @@ -174,6 +179,11 @@ unsigned, unsigned(555)); + MOCKPP_ASSERT_THROWING(vmo.visitable(52, 58), + MOCKPP_PCHAR("vmo.visitable()-3"), + unsigned, + unsigned(666)); + vmo.verify(); vmb.verify(); @@ -287,7 +297,7 @@ unsigned(321)); vmo.visitablev(2, 2); - vmo.visitablev(2, 20); + vmo.visitablev(1, 19); MOCKPP_ASSERT_EQUALS(999, vmo.visitable(20, 30)); MOCKPP_ASSERT_EQUALS(999, vmo.visitable(200, 300)); vmo.visitablev(3, 3); |
From: Ewald A. <ewa...@us...> - 2005-11-14 17:26:19
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11753 Modified Files: ChangeLog Log Message: wrong comparison on certain values Index: ChangeLog =================================================================== RCS file: /cvsroot/mockpp/mockpp/ChangeLog,v retrieving revision 1.74 retrieving revision 1.75 diff -u -d -r1.74 -r1.75 --- ChangeLog 13 Nov 2005 14:07:12 -0000 1.74 +++ ChangeLog 14 Nov 2005 17:26:11 -0000 1.75 @@ -12,6 +12,7 @@ - added template based classes to mock methods (chainable and visitable) - compatibilty break: cleanup and removed all methods clear() as they were mostly duplicates of reset() + - IsCloseTo compared wrong when passed scalar values exctly on the bounds 2005-10-11 1.9.5: |
From: Ewald A. <ewa...@us...> - 2005-11-14 17:25:27
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11563/mockpp/tests Modified Files: VisitableMockMethod_2_test.cpp Log Message: more tests and fixes Index: VisitableMockMethod_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockMethod_2_test.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- VisitableMockMethod_2_test.cpp 13 Nov 2005 14:07:12 -0000 1.5 +++ VisitableMockMethod_2_test.cpp 14 Nov 2005 17:25:14 -0000 1.6 @@ -40,6 +40,8 @@ #include <mockpp/VisitableMockMethod2.h> #include <mockpp/VisitableMockObject.h> +#include <mockpp/chaining/ChainingMockObjectSupport.h> + #include <mockpp/constraint/OutBound.h> #include <cppunit/extensions/HelperMacros.h> @@ -54,12 +56,14 @@ CPPUNIT_TEST_SUITE( VisitableMockMethod_2_test ); CPPUNIT_TEST( test_parameter_2 ); + CPPUNIT_TEST( test_parameter_2v ); CPPUNIT_TEST_SUITE_END(); public: void test_parameter_2(); + void test_parameter_2v(); }; @@ -76,11 +80,23 @@ , visitablev_mocker(MOCKPP_PCHAR("visitablev2"), this) {} + void visitable(const mockpp::ConstraintHolder<unsigned> &p1, + const mockpp::ConstraintHolder<unsigned> &p2) + { + visitable_mocker.forward(p1, p2); + } + int visitable(unsigned i, unsigned j) { return visitable_mocker.forward(i, j); } + void visitablev(const mockpp::ConstraintHolder<unsigned> &p1, + const mockpp::ConstraintHolder<unsigned> &p2) + { + visitablev_mocker.forward(p1, p2); + } + void visitablev(unsigned i, unsigned j) { visitablev_mocker.forward(i, j); @@ -94,8 +110,10 @@ void VisitableMockMethod_2_test::test_parameter_2() { MyVisitableMockObject_2 vmo(MOCKPP_PCHAR("Visitable-object")); - mockpp::VisitableMockMethod2<int, unsigned, unsigned> vmb (MOCKPP_PCHAR("methodbase"), &vmo); + mockpp::VisitableMockMethod2<int, unsigned, unsigned> &vmb (vmo.visitable_mocker); + vmb.addThrowable(mockpp::make_throwable(333u)); + vmb.setDefaultThrowable(mockpp::make_throwable(444u)); vmb.setDefaultReturnValue(999); vmb.addReturnValue(888, 2); vmo.reset(); @@ -108,15 +126,17 @@ vmb.addReturnValue(432, 1); vmb.addThrowable(mockpp::make_throwable(321u)); - vmb.forward(1, 2); - vmb.forward(2, 3); - vmb.forward(3, 4); - vmb.forward(4, 5); - vmb.forward(5, 6); - vmb.forward(2, 2); - vmb.forward(3, 3); - vmb.forward(4, 4); - vmb.forward(5, 5); + vmo.visitable(1, 2); + vmo.visitable(2, 3); + vmo.visitable(3, 4); + vmo.visitable(4, 5); + vmo.visitable(5, 6); + vmo.visitable(2, 2); + vmo.visitable(mockpp::eq<unsigned>(2, 2), + mockpp::eq<unsigned>(20, 2)); + vmo.visitable(3, 3); + vmo.visitable(4, 4); + vmo.visitable(5, 5); vmb.addResponseValue(222, 2, 2); vmb.addResponseValue(333, 3, 3); vmb.addResponseThrowable(mockpp::make_throwable(444u), 4, 4); @@ -124,32 +144,33 @@ vmo.activate(); - MOCKPP_ASSERT_EQUALS(321, vmb.forward(1, 2)); + MOCKPP_ASSERT_EQUALS(321, vmo.visitable(1, 2)); - MOCKPP_ASSERT_THROWING(vmb.forward(2, 3), - MOCKPP_PCHAR("vmb.forward()-1a"), + MOCKPP_ASSERT_THROWING(vmo.visitable(2, 3), + MOCKPP_PCHAR("vmo.visitable()-1a"), unsigned, unsigned(123)); - MOCKPP_ASSERT_EQUALS(432, vmb.forward(3, 4)); + MOCKPP_ASSERT_EQUALS(432, vmo.visitable(3, 4)); - MOCKPP_ASSERT_THROWING(vmb.forward(4, 5), - MOCKPP_PCHAR("vmb.forward()-1b"), + MOCKPP_ASSERT_THROWING(vmo.visitable(4, 5), + MOCKPP_PCHAR("vmo.visitable()-1b"), unsigned, unsigned(321)); - MOCKPP_ASSERT_EQUALS(123, vmb.forward(5, 6)); + MOCKPP_ASSERT_EQUALS(123, vmo.visitable(5, 6)); - MOCKPP_ASSERT_EQUALS(222, vmb.forward(2, 2)); - MOCKPP_ASSERT_EQUALS(333, vmb.forward(3, 3)); + MOCKPP_ASSERT_EQUALS(222, vmo.visitable(2, 2)); + MOCKPP_ASSERT_EQUALS(123, vmo.visitable(3, 21)); + MOCKPP_ASSERT_EQUALS(333, vmo.visitable(3, 3)); - MOCKPP_ASSERT_THROWING(vmb.forward(4, 4), - MOCKPP_PCHAR("vmb.forward()-2"), + MOCKPP_ASSERT_THROWING(vmo.visitable(4, 4), + MOCKPP_PCHAR("vmo.visitable()-2"), unsigned, unsigned(444)); - MOCKPP_ASSERT_THROWING(vmb.forward(5, 5), - MOCKPP_PCHAR("vmb.forward()-3"), + MOCKPP_ASSERT_THROWING(vmo.visitable(5, 5), + MOCKPP_PCHAR("vmo.visitable()-3"), unsigned, unsigned(555)); @@ -168,26 +189,26 @@ vmb.addReturnValue(432, 1); vmb.addThrowable(mockpp::make_throwable(321u)); - vmb.forward(9, 9); - vmb.forward(8, 8); - vmb.forward(1, 2); - vmb.forward(2, 3); - vmb.forward(3, 4); + vmo.visitable(9, 9); + vmo.visitable(8, 8); + vmo.visitable(1, 2); + vmo.visitable(2, 3); + vmo.visitable(3, 4); vmo.activate(); - MOCKPP_ASSERT_THROWING(vmb.forward(9, 9), - MOCKPP_PCHAR("vmb.forward()-2a"), + MOCKPP_ASSERT_THROWING(vmo.visitable(9, 9), + MOCKPP_PCHAR("vmo.visitable()-2a"), unsigned, unsigned(123)); - MOCKPP_ASSERT_THROWING(vmb.forward(9, 9), - MOCKPP_PCHAR("vmb.forward()-2b"), + MOCKPP_ASSERT_THROWING(vmo.visitable(9, 9), + MOCKPP_PCHAR("vmo.visitable()-2b"), unsigned, unsigned(321)); - MOCKPP_ASSERT_EQUALS(321, vmb.forward(1, 2)); - MOCKPP_ASSERT_EQUALS(432, vmb.forward(2, 3)); - MOCKPP_ASSERT_EQUALS(123, vmb.forward(3, 4)); + MOCKPP_ASSERT_EQUALS(321, vmo.visitable(1, 2)); + MOCKPP_ASSERT_EQUALS(432, vmo.visitable(2, 3)); + MOCKPP_ASSERT_EQUALS(123, vmo.visitable(3, 4)); vmo.verify(); vmb.verify(); @@ -198,23 +219,147 @@ vmb.setDefaultThrowable(mockpp::make_throwable(111u)); vmb.addThrowable(mockpp::make_throwable(123u)); - vmb.forward(1, 2); - vmb.forward(2, 3); - vmb.forward(3, 4); + vmo.visitable(1, 2); + vmo.visitable(2, 3); + vmo.visitable(3, 4); vmo.activate(); - MOCKPP_ASSERT_THROWING(vmb.forward(1, 2), - MOCKPP_PCHAR("vmb.forward()-3a"), + MOCKPP_ASSERT_THROWING(vmo.visitable(1, 2), + MOCKPP_PCHAR("vmo.visitable()-3a"), unsigned, unsigned(123)); - MOCKPP_ASSERT_THROWING(vmb.forward(2, 3), - MOCKPP_PCHAR("vmb.forward()-3b"), + MOCKPP_ASSERT_THROWING(vmo.visitable(2, 3), + MOCKPP_PCHAR("vmo.visitable()-3b"), unsigned, unsigned(111)); - MOCKPP_ASSERT_THROWING(vmb.forward(3, 4), - MOCKPP_PCHAR("vmb.forward()-3c"), + MOCKPP_ASSERT_THROWING(vmo.visitable(3, 4), + MOCKPP_PCHAR("vmo.visitable()-3c"), + unsigned, + unsigned(111)); + + vmo.verify(); + vmb.verify(); +} + + +void VisitableMockMethod_2_test::test_parameter_2v() +{ + MyVisitableMockObject_2 vmo(MOCKPP_PCHAR("Visitable-object")); + mockpp::VisitableMockMethod2<void, unsigned, unsigned> &vmb (vmo.visitablev_mocker); + mockpp::VisitableMockMethod2<int, unsigned, unsigned> &vmbi (vmo.visitable_mocker); + + vmb.setDefaultThrowable(mockpp::make_throwable(444u)); + vmb.addThrowable(mockpp::make_throwable(333u)); + vmo.reset(); + + vmbi.setDefaultReturnValue(999); + + ////////////////////////////////////////////////////// + + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitablev(1, 2); + vmo.visitablev(2, 3); + vmo.visitablev(2, 2); + vmo.visitablev(mockpp::eq<unsigned>(2, 1), + mockpp::eq<unsigned>(20, 3)); + vmo.visitable(20, 30); + vmo.visitable(200, 300); + vmo.visitablev(3, 3); + vmo.visitablev(4, 4); + vmo.visitablev(5, 5); + vmb.addResponseThrowable(mockpp::make_throwable(444u), 4, 4); + vmb.addResponseThrowable(mockpp::make_throwable(555u), 5, 5); + + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(2, 3), + MOCKPP_PCHAR("vmo.visitablev()-1a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(4, 5), + MOCKPP_PCHAR("vmo.visitablev()-1b"), + unsigned, + unsigned(321)); + + vmo.visitablev(2, 2); + vmo.visitablev(2, 20); + MOCKPP_ASSERT_EQUALS(999, vmo.visitable(20, 30)); + MOCKPP_ASSERT_EQUALS(999, vmo.visitable(200, 300)); + vmo.visitablev(3, 3); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(4, 4), + MOCKPP_PCHAR("vmo.visitablev()-2"), + unsigned, + unsigned(444)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(5, 5), + MOCKPP_PCHAR("vmo.visitablev()-3"), + unsigned, + unsigned(555)); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.unsetThrowablesInline(); + + vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmo.visitablev(9, 9); + vmo.visitablev(8, 8); + vmo.visitablev(1, 2); + vmo.visitablev(2, 3); + vmo.visitablev(3, 4); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(9, 9), + MOCKPP_PCHAR("vmo.visitablev()-2a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(8, 8), + MOCKPP_PCHAR("vmo.visitablev()-2b"), + unsigned, + unsigned(321)); + + vmo.visitablev(1, 2); + vmo.visitablev(2, 3); + vmo.visitablev(3, 4); + + vmo.verify(); + vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.setDefaultThrowable(mockpp::make_throwable(111u)); + vmb.addThrowable(mockpp::make_throwable(123u)); + + vmo.visitablev(1, 2); + vmo.visitablev(2, 3); + vmo.visitablev(3, 4); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(1, 2), + MOCKPP_PCHAR("vmo.visitablev()-3a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(2, 3), + MOCKPP_PCHAR("vmo.visitablev()-3b"), + unsigned, + unsigned(111)); + + MOCKPP_ASSERT_THROWING(vmo.visitablev(3, 4), + MOCKPP_PCHAR("vmo.visitablev()-3c"), unsigned, unsigned(111)); |
From: Ewald A. <ewa...@us...> - 2005-11-14 17:25:23
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11563/mockpp Modified Files: gen_visitablemethod_N.pl VisitableMockMethod0.h VisitableMockMethod1.h VisitableMockMethod2.h VisitableMockMethod3.h VisitableMockMethod4.h VisitableMockMethod5.h VisitableMockMethod6.h Log Message: more tests and fixes Index: VisitableMockMethod6.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod6.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VisitableMockMethod6.h 13 Nov 2005 14:07:12 -0000 1.7 +++ VisitableMockMethod6.h 14 Nov 2005 17:25:14 -0000 1.8 @@ -222,6 +222,7 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) const { this->forward_param(p1, p2, p3, p4, p5, p6); + if (this->getVisitableMockObject()->isActivated() ) { R ret_val; @@ -231,9 +232,11 @@ return this->determineReturnValue(); } else - return R(); + return R(); // only dummy value } + using VisitableMockMethod6Common<R, P1, P2, P3, P4, P5, P6>::forward; + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -307,6 +310,8 @@ { this->forward_param(p1, p2, p3, p4, p5, p6); } + + using VisitableMockMethod6Common<void, P1, P2, P3, P4, P5, P6>::forward; }; Index: VisitableMockMethod2.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod2.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod2.h 13 Nov 2005 14:07:12 -0000 1.9 +++ VisitableMockMethod2.h 14 Nov 2005 17:25:14 -0000 1.10 @@ -178,6 +178,7 @@ R forward(const P1 &p1, const P2 &p2) const { this->forward_param(p1, p2); + if (this->getVisitableMockObject()->isActivated() ) { R ret_val; @@ -187,9 +188,11 @@ return this->determineReturnValue(); } else - return R(); + return R(); // only dummy value } + using VisitableMockMethod2Common<R, P1, P2>::forward; + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -251,6 +254,8 @@ { this->forward_param(p1, p2); } + + using VisitableMockMethod2Common<void, P1, P2>::forward; }; Index: gen_visitablemethod_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_visitablemethod_N.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- gen_visitablemethod_N.pl 13 Nov 2005 14:07:12 -0000 1.11 +++ gen_visitablemethod_N.pl 14 Nov 2005 17:25:14 -0000 1.12 @@ -410,6 +410,8 @@ else return R(); // only dummy value } + + using VisitableMockMethod" . $numArgs . "Common<R" . $templateArgs_colon . ">::forward; "; if ($numArgs > 0) @@ -493,6 +495,8 @@ { this->forward_param(" . $args . "); } + + using VisitableMockMethod" . $numArgs . "Common<void" . $templateArgs_colon . ">::forward; }; Index: VisitableMockMethod3.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod3.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod3.h 13 Nov 2005 14:07:12 -0000 1.9 +++ VisitableMockMethod3.h 14 Nov 2005 17:25:14 -0000 1.10 @@ -189,6 +189,7 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3) const { this->forward_param(p1, p2, p3); + if (this->getVisitableMockObject()->isActivated() ) { R ret_val; @@ -198,9 +199,11 @@ return this->determineReturnValue(); } else - return R(); + return R(); // only dummy value } + using VisitableMockMethod3Common<R, P1, P2, P3>::forward; + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -265,6 +268,8 @@ { this->forward_param(p1, p2, p3); } + + using VisitableMockMethod3Common<void, P1, P2, P3>::forward; }; Index: VisitableMockMethod4.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod4.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod4.h 13 Nov 2005 14:07:12 -0000 1.9 +++ VisitableMockMethod4.h 14 Nov 2005 17:25:14 -0000 1.10 @@ -200,6 +200,7 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4) const { this->forward_param(p1, p2, p3, p4); + if (this->getVisitableMockObject()->isActivated() ) { R ret_val; @@ -209,9 +210,11 @@ return this->determineReturnValue(); } else - return R(); + return R(); // only dummy value } + using VisitableMockMethod4Common<R, P1, P2, P3, P4>::forward; + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -279,6 +282,8 @@ { this->forward_param(p1, p2, p3, p4); } + + using VisitableMockMethod4Common<void, P1, P2, P3, P4>::forward; }; Index: VisitableMockMethod0.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod0.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod0.h 13 Nov 2005 14:07:12 -0000 1.9 +++ VisitableMockMethod0.h 14 Nov 2005 17:25:14 -0000 1.10 @@ -109,14 +109,17 @@ R forward() const { this->forward_param(); + if (this->getVisitableMockObject()->isActivated() ) { return this->determineReturnValue(); } else - return R(); + return R(); // only dummy value } + using VisitableMockMethod0Common<R>::forward; + }; @@ -145,6 +148,8 @@ { this->forward_param(); } + + using VisitableMockMethod0Common<void>::forward; }; Index: VisitableMockMethod5.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod5.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod5.h 13 Nov 2005 14:07:12 -0000 1.9 +++ VisitableMockMethod5.h 14 Nov 2005 17:25:14 -0000 1.10 @@ -211,6 +211,7 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5) const { this->forward_param(p1, p2, p3, p4, p5); + if (this->getVisitableMockObject()->isActivated() ) { R ret_val; @@ -220,9 +221,11 @@ return this->determineReturnValue(); } else - return R(); + return R(); // only dummy value } + using VisitableMockMethod5Common<R, P1, P2, P3, P4, P5>::forward; + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -293,6 +296,8 @@ { this->forward_param(p1, p2, p3, p4, p5); } + + using VisitableMockMethod5Common<void, P1, P2, P3, P4, P5>::forward; }; Index: VisitableMockMethod1.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod1.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod1.h 13 Nov 2005 14:07:12 -0000 1.9 +++ VisitableMockMethod1.h 14 Nov 2005 17:25:14 -0000 1.10 @@ -167,6 +167,7 @@ R forward(const P1 &p1) const { this->forward_param(p1); + if (this->getVisitableMockObject()->isActivated() ) { R ret_val; @@ -176,9 +177,11 @@ return this->determineReturnValue(); } else - return R(); + return R(); // only dummy value } + using VisitableMockMethod1Common<R, P1>::forward; + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -237,6 +240,8 @@ { this->forward_param(p1); } + + using VisitableMockMethod1Common<void, P1>::forward; }; |
From: Ewald A. <ewa...@us...> - 2005-11-14 17:24:39
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11434/mockpp/tests Modified Files: IsCloseTo_test.cpp Log Message: wrong comparison on certain values Index: IsCloseTo_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/IsCloseTo_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- IsCloseTo_test.cpp 15 Oct 2005 15:40:59 -0000 1.8 +++ IsCloseTo_test.cpp 14 Nov 2005 17:24:24 -0000 1.9 @@ -92,6 +92,13 @@ MOCKPP_ASSERT_TRUE(myclose2a.eval(-2) == true); MOCKPP_ASSERT_TRUE(myclose2a.eval(-1) == false); MOCKPP_ASSERT_TRUE(myclose2a.eval(-3) == false); + + mockpp::IsCloseTo<unsigned> myclose3a (20, 1); + MOCKPP_ASSERT_TRUE(myclose3a.eval(20) == true); + MOCKPP_ASSERT_TRUE(myclose3a.eval(21) == true); + MOCKPP_ASSERT_TRUE(myclose3a.eval(19) == true); + MOCKPP_ASSERT_TRUE(myclose3a.eval(22) == false); + MOCKPP_ASSERT_TRUE(myclose3a.eval(18) == false); } |
From: Ewald A. <ewa...@us...> - 2005-11-14 17:24:20
|
Update of /cvsroot/mockpp/mockpp/mockpp/constraint In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11398/mockpp/constraint Modified Files: IsCloseTo.h Log Message: wrong comparison on certain values Index: IsCloseTo.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/constraint/IsCloseTo.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- IsCloseTo.h 6 Jan 2005 13:09:22 -0000 1.17 +++ IsCloseTo.h 14 Nov 2005 17:24:09 -0000 1.18 @@ -70,8 +70,8 @@ virtual bool eval( const NumberType &arg ) const { // don't use std::abs to better support user types - return (arg < value + deviation && arg > value - deviation) // positive deviation - || (arg < value - deviation && arg > value + deviation); // negative deviation + return (arg <= value + deviation && arg >= value - deviation) // positive deviation + || (arg <= value - deviation && arg >= value + deviation); // negative deviation } /** Appends the description of this object to the buffer. |
From: Ewald A. <ewa...@us...> - 2005-11-13 14:07:20
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22022/mockpp Modified Files: VisitableMockMethod.h VisitableMockMethod0.h VisitableMockMethod1.h VisitableMockMethod2.h VisitableMockMethod3.h VisitableMockMethod4.h VisitableMockMethod5.h VisitableMockMethod6.h gen_visitablemethod_N.pl Log Message: fix evaluation order Index: VisitableMockMethod6.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod6.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- VisitableMockMethod6.h 13 Nov 2005 11:52:26 -0000 1.6 +++ VisitableMockMethod6.h 13 Nov 2005 14:07:12 -0000 1.7 @@ -141,10 +141,8 @@ } } - public: - /** Adds another response throwable. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -224,12 +222,16 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) const { this->forward_param(p1, p2, p3, p4, p5, p6); + if (this->getVisitableMockObject()->isActivated() ) + { + R ret_val; + if (this->responseValues.find(ret_val, p1, p2, p3, p4, p5, p6)) + return ret_val; - R ret_val; - if (this->responseValues.find(ret_val, p1, p2, p3, p4, p5, p6)) - return ret_val; - - return this->determineReturnValue(); + return this->determineReturnValue(); + } + else + return R(); } /** Adds another response value. Index: VisitableMockMethod2.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod2.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VisitableMockMethod2.h 13 Nov 2005 11:52:26 -0000 1.8 +++ VisitableMockMethod2.h 13 Nov 2005 14:07:12 -0000 1.9 @@ -113,10 +113,8 @@ } } - public: - /** Adds another response throwable. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -180,12 +178,16 @@ R forward(const P1 &p1, const P2 &p2) const { this->forward_param(p1, p2); + if (this->getVisitableMockObject()->isActivated() ) + { + R ret_val; + if (this->responseValues.find(ret_val, p1, p2)) + return ret_val; - R ret_val; - if (this->responseValues.find(ret_val, p1, p2)) - return ret_val; - - return this->determineReturnValue(); + return this->determineReturnValue(); + } + else + return R(); } /** Adds another response value. Index: gen_visitablemethod_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_visitablemethod_N.pl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- gen_visitablemethod_N.pl 13 Nov 2005 11:52:26 -0000 1.10 +++ gen_visitablemethod_N.pl 13 Nov 2005 14:07:12 -0000 1.11 @@ -296,14 +296,12 @@ } print OUT " - public: "; if ($numArgs > 0) { print OUT " - /** Adds another response throwable. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -392,20 +390,25 @@ */ R forward(" . $parms . ") const { - this->forward_param(" . $args . ");"; + this->forward_param(" . $args . "); + + if (this->getVisitableMockObject()->isActivated() ) + {"; if ($numArgs > 0) { print OUT " - - R ret_val; - if (this->responseValues.find(ret_val, " . $args . ")) - return ret_val; + R ret_val; + if (this->responseValues.find(ret_val, " . $args . ")) + return ret_val; "; } print OUT " - return this->determineReturnValue(); + return this->determineReturnValue(); + } + else + return R(); // only dummy value } "; Index: VisitableMockMethod3.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod3.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VisitableMockMethod3.h 13 Nov 2005 11:52:26 -0000 1.8 +++ VisitableMockMethod3.h 13 Nov 2005 14:07:12 -0000 1.9 @@ -120,10 +120,8 @@ } } - public: - /** Adds another response throwable. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -191,12 +189,16 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3) const { this->forward_param(p1, p2, p3); + if (this->getVisitableMockObject()->isActivated() ) + { + R ret_val; + if (this->responseValues.find(ret_val, p1, p2, p3)) + return ret_val; - R ret_val; - if (this->responseValues.find(ret_val, p1, p2, p3)) - return ret_val; - - return this->determineReturnValue(); + return this->determineReturnValue(); + } + else + return R(); } /** Adds another response value. Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- VisitableMockMethod.h 13 Nov 2005 12:25:41 -0000 1.18 +++ VisitableMockMethod.h 13 Nov 2005 14:07:12 -0000 1.19 @@ -76,7 +76,8 @@ bool do_throw = true; if (throwablesInline) { - if (throwableInsteadReturn.size() != 0) + unsigned num = throwableInsteadReturn.size(); + if (num != 0) { do_throw = throwableInsteadReturn[0]; throwableInsteadReturn.erase(throwableInsteadReturn.begin()); @@ -261,7 +262,7 @@ */ R determineReturnValue() const { - throwableInsteadReturn.erase(throwableInsteadReturn.begin()); +// throwableInsteadReturn.erase(throwableInsteadReturn.begin()); if (returnValues.hasMoreObjects()) return returnValues.nextReturnObject(); Index: VisitableMockMethod4.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod4.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VisitableMockMethod4.h 13 Nov 2005 11:52:26 -0000 1.8 +++ VisitableMockMethod4.h 13 Nov 2005 14:07:12 -0000 1.9 @@ -127,10 +127,8 @@ } } - public: - /** Adds another response throwable. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -202,12 +200,16 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4) const { this->forward_param(p1, p2, p3, p4); + if (this->getVisitableMockObject()->isActivated() ) + { + R ret_val; + if (this->responseValues.find(ret_val, p1, p2, p3, p4)) + return ret_val; - R ret_val; - if (this->responseValues.find(ret_val, p1, p2, p3, p4)) - return ret_val; - - return this->determineReturnValue(); + return this->determineReturnValue(); + } + else + return R(); } /** Adds another response value. Index: VisitableMockMethod0.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod0.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VisitableMockMethod0.h 13 Nov 2005 11:52:26 -0000 1.8 +++ VisitableMockMethod0.h 13 Nov 2005 14:07:12 -0000 1.9 @@ -81,7 +81,6 @@ this->throwAvailableException(); } } - public: }; @@ -110,7 +109,12 @@ R forward() const { this->forward_param(); - return this->determineReturnValue(); + if (this->getVisitableMockObject()->isActivated() ) + { + return this->determineReturnValue(); + } + else + return R(); } }; Index: VisitableMockMethod5.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod5.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VisitableMockMethod5.h 13 Nov 2005 11:52:26 -0000 1.8 +++ VisitableMockMethod5.h 13 Nov 2005 14:07:12 -0000 1.9 @@ -134,10 +134,8 @@ } } - public: - /** Adds another response throwable. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -213,12 +211,16 @@ R forward(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5) const { this->forward_param(p1, p2, p3, p4, p5); + if (this->getVisitableMockObject()->isActivated() ) + { + R ret_val; + if (this->responseValues.find(ret_val, p1, p2, p3, p4, p5)) + return ret_val; - R ret_val; - if (this->responseValues.find(ret_val, p1, p2, p3, p4, p5)) - return ret_val; - - return this->determineReturnValue(); + return this->determineReturnValue(); + } + else + return R(); } /** Adds another response value. Index: VisitableMockMethod1.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod1.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- VisitableMockMethod1.h 13 Nov 2005 11:52:26 -0000 1.8 +++ VisitableMockMethod1.h 13 Nov 2005 14:07:12 -0000 1.9 @@ -106,10 +106,8 @@ } } - public: - /** Adds another response throwable. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -169,12 +167,16 @@ R forward(const P1 &p1) const { this->forward_param(p1); + if (this->getVisitableMockObject()->isActivated() ) + { + R ret_val; + if (this->responseValues.find(ret_val, p1)) + return ret_val; - R ret_val; - if (this->responseValues.find(ret_val, p1)) - return ret_val; - - return this->determineReturnValue(); + return this->determineReturnValue(); + } + else + return R(); } /** Adds another response value. |
From: Ewald A. <ewa...@us...> - 2005-11-13 14:07:20
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22022/mockpp/tests Modified Files: VisitableMockMethod_2_test.cpp VisitableMockMethod_test.cpp Log Message: fix evaluation order Index: VisitableMockMethod_2_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockMethod_2_test.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- VisitableMockMethod_2_test.cpp 13 Nov 2005 11:52:26 -0000 1.4 +++ VisitableMockMethod_2_test.cpp 13 Nov 2005 14:07:12 -0000 1.5 @@ -100,32 +100,49 @@ vmb.addReturnValue(888, 2); vmo.reset(); - ////////////////79////////////////////////////////////// + ////////////////////////////////////////////////////// vmb.setDefaultReturnValue(123); - vmb.addReturnValue(321, 2); + vmb.addReturnValue(321, 1); vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addReturnValue(432, 1); + vmb.addThrowable(mockpp::make_throwable(321u)); + vmb.forward(1, 2); vmb.forward(2, 3); vmb.forward(3, 4); vmb.forward(4, 5); + vmb.forward(5, 6); + vmb.forward(2, 2); + vmb.forward(3, 3); + vmb.forward(4, 4); + vmb.forward(5, 5); vmb.addResponseValue(222, 2, 2); vmb.addResponseValue(333, 3, 3); vmb.addResponseThrowable(mockpp::make_throwable(444u), 4, 4); vmb.addResponseThrowable(mockpp::make_throwable(555u), 5, 5); + vmo.activate(); MOCKPP_ASSERT_EQUALS(321, vmb.forward(1, 2)); - MOCKPP_ASSERT_EQUALS(321, vmb.forward(2, 3)); - MOCKPP_ASSERT_EQUALS(123, vmb.forward(3, 4)); - MOCKPP_ASSERT_EQUALS(222, vmb.forward(2, 2)); - MOCKPP_ASSERT_EQUALS(333, vmb.forward(3, 3)); - MOCKPP_ASSERT_THROWING(vmb.forward(9, 9), - MOCKPP_PCHAR("vmb.forward()-1"), + MOCKPP_ASSERT_THROWING(vmb.forward(2, 3), + MOCKPP_PCHAR("vmb.forward()-1a"), unsigned, unsigned(123)); + MOCKPP_ASSERT_EQUALS(432, vmb.forward(3, 4)); + + MOCKPP_ASSERT_THROWING(vmb.forward(4, 5), + MOCKPP_PCHAR("vmb.forward()-1b"), + unsigned, + unsigned(321)); + + MOCKPP_ASSERT_EQUALS(123, vmb.forward(5, 6)); + + MOCKPP_ASSERT_EQUALS(222, vmb.forward(2, 2)); + MOCKPP_ASSERT_EQUALS(333, vmb.forward(3, 3)); + MOCKPP_ASSERT_THROWING(vmb.forward(4, 4), MOCKPP_PCHAR("vmb.forward()-2"), unsigned, @@ -145,21 +162,63 @@ vmb.unsetThrowablesInline(); vmb.setDefaultReturnValue(123); - vmb.addReturnValue(321, 2); + + vmb.addReturnValue(321, 1); vmb.addThrowable(mockpp::make_throwable(123u)); + vmb.addReturnValue(432, 1); + vmb.addThrowable(mockpp::make_throwable(321u)); + + vmb.forward(9, 9); + vmb.forward(8, 8); + vmb.forward(1, 2); + vmb.forward(2, 3); + vmb.forward(3, 4); vmo.activate(); MOCKPP_ASSERT_THROWING(vmb.forward(9, 9), - MOCKPP_PCHAR("vmb.forward()-2"), + MOCKPP_PCHAR("vmb.forward()-2a"), unsigned, unsigned(123)); + MOCKPP_ASSERT_THROWING(vmb.forward(9, 9), + MOCKPP_PCHAR("vmb.forward()-2b"), + unsigned, + unsigned(321)); + MOCKPP_ASSERT_EQUALS(321, vmb.forward(1, 2)); - MOCKPP_ASSERT_EQUALS(321, vmb.forward(2, 3)); + MOCKPP_ASSERT_EQUALS(432, vmb.forward(2, 3)); MOCKPP_ASSERT_EQUALS(123, vmb.forward(3, 4)); vmo.verify(); vmb.verify(); + + ////////////////////////////////////////////////////// + + vmo.reset(); + vmb.setDefaultThrowable(mockpp::make_throwable(111u)); + vmb.addThrowable(mockpp::make_throwable(123u)); + + vmb.forward(1, 2); + vmb.forward(2, 3); + vmb.forward(3, 4); + vmo.activate(); + + MOCKPP_ASSERT_THROWING(vmb.forward(1, 2), + MOCKPP_PCHAR("vmb.forward()-3a"), + unsigned, + unsigned(123)); + + MOCKPP_ASSERT_THROWING(vmb.forward(2, 3), + MOCKPP_PCHAR("vmb.forward()-3b"), + unsigned, + unsigned(111)); + + MOCKPP_ASSERT_THROWING(vmb.forward(3, 4), + MOCKPP_PCHAR("vmb.forward()-3c"), + unsigned, + unsigned(111)); + + vmo.verify(); vmb.verify(); } Index: VisitableMockMethod_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockMethod_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- VisitableMockMethod_test.cpp 13 Nov 2005 11:52:26 -0000 1.12 +++ VisitableMockMethod_test.cpp 13 Nov 2005 14:07:12 -0000 1.13 @@ -286,6 +286,8 @@ MOCKPP_ASSERT_EQUALS(321, vmb.determineReturnValue()); MOCKPP_ASSERT_EQUALS(123, vmb.determineReturnValue()); + vmb.throwAvailableException(); + vmb.throwAvailableException(); MOCKPP_ASSERT_THROWING(vmb.throwAvailableException(), MOCKPP_PCHAR("vmb.throwAvailableException()-1"), unsigned, |
From: Ewald A. <ewa...@us...> - 2005-11-13 14:07:20
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22022 Modified Files: ChangeLog Log Message: fix evaluation order Index: ChangeLog =================================================================== RCS file: /cvsroot/mockpp/mockpp/ChangeLog,v retrieving revision 1.73 retrieving revision 1.74 diff -u -d -r1.73 -r1.74 --- ChangeLog 13 Nov 2005 11:53:18 -0000 1.73 +++ ChangeLog 13 Nov 2005 14:07:12 -0000 1.74 @@ -3,7 +3,7 @@ mockpp history -------------- -2005-10-00 1.9.6: +2005-11-13 1.10.0: - fixes for g++ 4.0 - format boolean as "true" istead "1" @@ -19,7 +19,7 @@ - isEqualComparison to customize comparison in IsEqual - removed superfluous Invocation::equals - new bcb6 project files - - VisitableMockObjectBase::visitableVerify()did not verify unused methods + - VisitableMockObjectBase::visitableVerify() did not verify unused methods 2005-09-24 1.9.4: |
From: Ewald A. <ewa...@us...> - 2005-11-13 12:25:49
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30224/mockpp Modified Files: VisitableMockMethod.h Log Message: reset all Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- VisitableMockMethod.h 13 Nov 2005 11:52:26 -0000 1.17 +++ VisitableMockMethod.h 13 Nov 2005 12:25:41 -0000 1.18 @@ -234,6 +234,7 @@ virtual void reset() { VisitableMockMethodBase::reset(); + this->returnValues.reset(); this->haveDefaultReturnValue = false; this->defaultReturnValueUsed = false; } @@ -271,7 +272,7 @@ protected: - mutable ReturnObjectList<R> returnValues; + mutable ReturnObjectList<R> returnValues; bool haveDefaultReturnValue; mutable bool defaultReturnValueUsed; R defaultReturnValue; |
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27653/mockpp/tests Modified Files: AbstractInvocationDispatcher_test.cpp ChainableMockObject_test.cpp ChainableMockObject_void_test.cpp ConstraintList_test.cpp ExpectationBoundary_test.cpp ExpectationConglomeration_test.cpp ExpectationCounterRange_test.cpp ExpectationCounter_test.cpp ExpectationList_test.cpp ExpectationMap_test.cpp ExpectationSegment_test.cpp ExpectationSet_test.cpp ExpectationValue_test.cpp MyBuilderNamespace.h ReturnObjectList_test.cpp ThrowableList_test.cpp Throwable_test.cpp TrackingCounter_test.cpp Log Message: cleanup: migrate clear() to reset() Index: ExpectationValue_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationValue_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ExpectationValue_test.cpp 15 Oct 2005 15:40:58 -0000 1.13 +++ ExpectationValue_test.cpp 13 Nov 2005 11:53:18 -0000 1.14 @@ -116,7 +116,7 @@ { mockpp::ExpectationValue<int> ec (MOCKPP_PCHAR("nothingValue"), 0); ec.setExpected(3); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); ec.verify(); // no fail because no expectations } Index: ExpectationList_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationList_test.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ExpectationList_test.cpp 15 Oct 2005 15:40:58 -0000 1.16 +++ ExpectationList_test.cpp 13 Nov 2005 11:53:18 -0000 1.17 @@ -140,7 +140,7 @@ { mockpp::ExpectationList<int> ec (MOCKPP_PCHAR("nothingValue"), 0); ec.addExpected(1234); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); ec.verify(); // no fail because no expectations } Index: ConstraintList_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ConstraintList_test.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ConstraintList_test.cpp 15 Oct 2005 15:40:58 -0000 1.2 +++ ConstraintList_test.cpp 13 Nov 2005 11:53:18 -0000 1.3 @@ -121,7 +121,7 @@ ab.addActual(18); ab.verify(); - ab.clear(); + ab.reset(); ab.addActual(22); ab.addActual(18); ab.addExpected(22); @@ -157,7 +157,7 @@ { mockpp::ConstraintList<int> ec (MOCKPP_PCHAR("nothingValue"), 0); ec.addExpected(1234); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); ec.verify(); // no fail because no expectations } Index: ExpectationConglomeration_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationConglomeration_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ExpectationConglomeration_test.cpp 15 Oct 2005 15:40:58 -0000 1.12 +++ ExpectationConglomeration_test.cpp 13 Nov 2005 11:53:18 -0000 1.13 @@ -151,7 +151,7 @@ { mockpp::ExpectationConglomeration<int> ec (MOCKPP_PCHAR("nothingValue"), 0); ec.addExpected(1234); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); ec.verify(); // no fail because no expectations } Index: ExpectationCounterRange_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationCounterRange_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ExpectationCounterRange_test.cpp 15 Oct 2005 15:40:58 -0000 1.12 +++ ExpectationCounterRange_test.cpp 13 Nov 2005 11:53:18 -0000 1.13 @@ -125,7 +125,7 @@ ec.inc(); ec.inc(); // no fail even now ec.verify(); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); } Index: MyBuilderNamespace.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/MyBuilderNamespace.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- MyBuilderNamespace.h 22 Mar 2005 22:03:26 -0000 1.13 +++ MyBuilderNamespace.h 13 Nov 2005 11:53:18 -0000 1.14 @@ -63,10 +63,10 @@ virtual ~MyBuilderNamespace() { - clear(); + reset(); } - virtual void clear() + virtual void reset() { while(idTable.size() != 0) { Index: ChainableMockObject_void_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_void_test.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ChainableMockObject_void_test.cpp 15 Oct 2005 15:40:58 -0000 1.10 +++ ChainableMockObject_void_test.cpp 13 Nov 2005 11:53:18 -0000 1.11 @@ -139,7 +139,7 @@ MOCKPP_ASSERT_TRUE(ae.getMessage().find(MOCKPP_PCHAR( "duplicate invocation named" )) != mockpp::String::npos); } - cm.clear(); + cm.reset(); MOCKPP_ASSERT_TRUE(0 == cm.lookupID(MOCKPP_PCHAR("second-name"))); } Index: ExpectationMap_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationMap_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ExpectationMap_test.cpp 15 Oct 2005 15:40:58 -0000 1.15 +++ ExpectationMap_test.cpp 13 Nov 2005 11:53:18 -0000 1.16 @@ -155,7 +155,7 @@ { mockpp::ExpectationMap<int, std::string> ec (MOCKPP_PCHAR("testMap"), 0); ec.addExpected(3, "three"); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); } Index: TrackingCounter_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/TrackingCounter_test.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- TrackingCounter_test.cpp 15 Oct 2005 15:40:59 -0000 1.6 +++ TrackingCounter_test.cpp 13 Nov 2005 11:53:18 -0000 1.7 @@ -162,7 +162,7 @@ mockpp::TrackingCounterClient ec (MOCKPP_PCHAR("client"), master); ec.setExpected(3); MOCKPP_ASSERT_TRUE(ec.inc() == 1); - ec.clear(); + ec.reset(); ec.verify(); // no fail because no expectations } @@ -183,7 +183,7 @@ ec.inc(); ec.inc(); // no fail even now ec.verify(); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); } Index: ChainableMockObject_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainableMockObject_test.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ChainableMockObject_test.cpp 18 Oct 2005 20:03:54 -0000 1.22 +++ ChainableMockObject_test.cpp 13 Nov 2005 11:53:18 -0000 1.23 @@ -235,7 +235,7 @@ MOCKPP_ASSERT_TRUE(ae.getMessage().find(MOCKPP_PCHAR( "duplicate invocation named" )) != mockpp::String::npos); } - cm.clear(); + cm.reset(); MOCKPP_ASSERT_TRUE(0 == cm.lookupID(MOCKPP_PCHAR("second-name"))); cm.verify(); Index: AbstractInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractInvocationDispatcher_test.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- AbstractInvocationDispatcher_test.cpp 15 Oct 2005 15:40:58 -0000 1.20 +++ AbstractInvocationDispatcher_test.cpp 13 Nov 2005 11:53:18 -0000 1.21 @@ -209,7 +209,7 @@ MOCKPP_ASSERT_TRUE( aid.describeTo(s) == MOCKPP_PCHAR( "??\n - t1\n - t2\n" )); MOCKPP_ASSERT_TRUE( s == MOCKPP_PCHAR( "??\n - t1\n - t2\n" )); - aid.clear(); + aid.reset(); s = MOCKPP_PCHAR(""); MOCKPP_ASSERT_TRUE( aid.describeTo(s) == MOCKPP_PCHAR( "no expectations set" )); } Index: ExpectationSet_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationSet_test.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ExpectationSet_test.cpp 15 Oct 2005 15:40:58 -0000 1.14 +++ ExpectationSet_test.cpp 13 Nov 2005 11:53:18 -0000 1.15 @@ -142,7 +142,7 @@ ec.addExpected(3); ec.addExpected(6); ec.addActual(3); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); ec.verify(); // no fail because no expectations } Index: ThrowableList_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ThrowableList_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ThrowableList_test.cpp 15 Oct 2005 15:40:59 -0000 1.13 +++ ThrowableList_test.cpp 13 Nov 2005 11:53:18 -0000 1.14 @@ -179,7 +179,7 @@ MOCKPP_ASSERT_TRUE(tl.nextThrowableObject() == tt1); - tl.clear(); + tl.reset(); MOCKPP_ASSERT_TRUE(tl.hasMoreObjects() == false); tl.verify(); } Index: ExpectationBoundary_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationBoundary_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ExpectationBoundary_test.cpp 15 Oct 2005 15:40:58 -0000 1.12 +++ ExpectationBoundary_test.cpp 13 Nov 2005 11:53:18 -0000 1.13 @@ -134,7 +134,7 @@ { mockpp::ExpectationBoundary<int> ec (MOCKPP_PCHAR("nothingValue"), 0); ec.setExpected(3, 5); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); } Index: Throwable_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Throwable_test.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Throwable_test.cpp 15 Oct 2005 15:40:59 -0000 1.12 +++ Throwable_test.cpp 13 Nov 2005 11:53:18 -0000 1.13 @@ -139,7 +139,7 @@ it.take(std::string("my-item")); MOCKPP_ASSERT_TRUE(it.get() != 0); - it.clear(); + it.reset(); MOCKPP_ASSERT_TRUE(it.get() == 0); } Index: ExpectationSegment_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationSegment_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ExpectationSegment_test.cpp 15 Oct 2005 15:40:58 -0000 1.13 +++ ExpectationSegment_test.cpp 13 Nov 2005 11:53:18 -0000 1.14 @@ -115,7 +115,7 @@ { mockpp::ExpectationSegment<mockpp::String> ec (MOCKPP_PCHAR("nothingValue"), 0); ec.setExpected(MOCKPP_PCHAR("1234")); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); ec.verify(); // no fail because no expectations } Index: ReturnObjectList_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ReturnObjectList_test.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ReturnObjectList_test.cpp 15 Oct 2005 15:40:59 -0000 1.15 +++ ReturnObjectList_test.cpp 13 Nov 2005 11:53:18 -0000 1.16 @@ -140,7 +140,7 @@ rol.verify(); rol.addObjectToReturn(456); - rol.clear(); + rol.reset(); MOCKPP_ASSERT_TRUE(!rol.hasMoreObjects()); } Index: ExpectationCounter_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ExpectationCounter_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ExpectationCounter_test.cpp 15 Oct 2005 15:40:58 -0000 1.13 +++ ExpectationCounter_test.cpp 13 Nov 2005 11:53:18 -0000 1.14 @@ -120,7 +120,7 @@ mockpp::ExpectationCounter ec (MOCKPP_PCHAR("nothingValue"), 0); ec.setExpected(3); ec.inc(); - ec.clear(); + ec.reset(); ec.verify(); // no fail because no expectations } @@ -137,7 +137,7 @@ ec.inc(); ec.inc(); // no fail even now ec.verify(); - ec.clear(); + ec.reset(); MOCKPP_ASSERT_TRUE(false == ec.hasExpectations()); } |