[Mockpp-commits] mockpp/mockpp ResponseVector6.h,NONE,1.1 VisitableMockMethod6.h,NONE,1.1 Makefile.a
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-10-29 18:17:39
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11255/mockpp Modified Files: Makefile.am ResponseVector1.h ResponseVector2.h ResponseVector3.h ResponseVector4.h ResponseVector5.h VisitableMockMethod0.h VisitableMockMethod1.h VisitableMockMethod2.h VisitableMockMethod3.h VisitableMockMethod4.h VisitableMockMethod5.h gen_visitablemethod_N.pl Added Files: ResponseVector6.h VisitableMockMethod6.h Log Message: provide up to 6 parameters --- NEW FILE: VisitableMockMethod6.h --- /** @file @brief Visitable Mock Method with 6 parameters. Generated with gen_visitablemethod_N.pl. $Id: VisitableMockMethod6.h,v 1.1 2005/10/29 18:17:30 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Thu Oct 22 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_VisitableMockMethod6_H #define MOCKPP_VisitableMockMethod6_H #include <mockpp/mockpp.h> #include <mockpp/VisitableMockObject.h> #include <mockpp/VisitableMockMethod.h> #include <mockpp/ResponseVector6.h> namespace mockpp { /** Common stuff to set up visitable mock method expectations with 6 parameters. * @ingroup grp_controller */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> class VisitableMockMethod6Common : public VisitableMockReturningMethodBase<R> { public: /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent Visitable mock object */ VisitableMockMethod6Common(const String &name, VisitableMockObject *parent = 0) : VisitableMockReturningMethodBase<R>(name, parent) , responseThrowables(this->getMethodName() + MOCKPP_PCHAR("/responseThrowables") , this) , parameter1(this->getMethodName() + MOCKPP_PCHAR("/parameter1"), this) , parameter2(this->getMethodName() + MOCKPP_PCHAR("/parameter2"), this) , parameter3(this->getMethodName() + MOCKPP_PCHAR("/parameter3"), this) , parameter4(this->getMethodName() + MOCKPP_PCHAR("/parameter4"), this) , parameter5(this->getMethodName() + MOCKPP_PCHAR("/parameter5"), this) , parameter6(this->getMethodName() + MOCKPP_PCHAR("/parameter6"), this) { } /** Set up expectations with constraints. * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 */ void forward (const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6) const { MOCKPP_ASSERT_FALSE(this->getVisitableMockObject()->isActivated()); this->getVisitableMockObject()->addExpectedMethod(this->getMethodIdentifier()); parameter1.addExpected(p1); parameter2.addExpected(p2); parameter3.addExpected(p3); parameter4.addExpected(p4); parameter5.addExpected(p5); parameter6.addExpected(p6); } protected: /** Perform the internals to verify a mocked method. * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 */ void forward_param(const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) const { if (!this->getVisitableMockObject()->isActivated() ) { this->getVisitableMockObject()->addExpectedMethod(this->getMethodIdentifier()); parameter1.addExpected(p1); parameter2.addExpected(p2); parameter3.addExpected(p3); parameter4.addExpected(p4); parameter5.addExpected(p5); parameter6.addExpected(p6); } else { try { this->getVisitableMockObject()->addActualMethod(this->getMethodIdentifier()); Throwable *t; if (this->responseValues.find(t, p1, p2, p3, p4, p5, p6)) t->throw_me(); this->throwAvailableException(); } catch(...) { parameter1.balanceActual(); parameter2.balanceActual(); parameter3.balanceActual(); parameter4.balanceActual(); parameter5.balanceActual(); parameter6.balanceActual(); throw; } parameter1.addActual(p1); parameter2.addActual(p2); parameter3.addActual(p3); parameter4.addActual(p4); parameter5.addActual(p5); parameter6.addActual(p6); } } public: /** Helper object to easily set up the visitable expectations. * @ingroup grp_controller */ class ControllerFor : public VisitableMockReturningMethodBase<R>::ControllerFor { public: typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; /** Construct the controller object. * @meth pointer to according method mock. */ ControllerFor (VisitableMockReturningMethodBase<R> *meth) : Inherited(meth) { } /** 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. * @param t the throwable object * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 * @param count the number of times this value shall be returned. Default is unlimited. */ void addResponseThrowable(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count = MOCKPP_UNLIMITED) { MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->responseValues.add(t, p1, p2, p3, p4, p5, p6, count); } /** 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. * @param t the throwable object * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 * @param count the number of times this value shall be returned. Default is unlimited. */ void addResponseThrowable(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count = MOCKPP_UNLIMITED) { MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->responseValues.add(t, p1, p2, p3, p4, p5, p6, count); } }; friend class ControllerFor; private: mutable ResponseThrowableVector6<P1, P2, P3, P4, P5, P6> responseThrowables; mutable ConstraintList<P1> parameter1; mutable ConstraintList<P2> parameter2; mutable ConstraintList<P3> parameter3; mutable ConstraintList<P4> parameter4; mutable ConstraintList<P5> parameter5; mutable ConstraintList<P6> parameter6; }; /** Set up visitable mock method expectations with 6 parameters. * @ingroup grp_controller */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> class VisitableMockMethod6 : public VisitableMockMethod6Common<R, P1, P2, P3, P4, P5, P6> { public: /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent Visitable mock object */ VisitableMockMethod6(const String &name, VisitableMockObject *parent = 0) : VisitableMockMethod6Common<R, P1, P2, P3, P4, P5, P6>(name, parent) , responseValues(this->getMethodName() + MOCKPP_PCHAR("/responseValues") , this) { } /** Actually verifies the mocked method. Must be called by the client code. * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 */ 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); R ret_val; if (this->method->responseValues.find(ret_val, p1, p2, p3, p4, p5, p6)) return ret_val; return this->determineReturnValue(); } /** Helper object to easily set up the visitable expectations. * @ingroup grp_controller */ class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor { public: typedef typename VisitableMockReturningMethodBase<R>::ControllerFor Inherited; /** Construct the controller object. * @meth pointer to according method mock. */ ControllerFor (VisitableMockReturningMethodBase<R> *meth) : Inherited(meth) { } /** 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. * @param rv the return value * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 * @param count the number of times this value shall be returned. Default is unlimited. */ void addResponseValue(const R &rv, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count = MOCKPP_UNLIMITED) { MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->responseValues.add(rv, p1, p2, p3, p4, p5, p6, count); } /** 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. * @param rv the return value * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 * @param count the number of times this value shall be returned. Default is unlimited. */ void addResponseValue(const R &rv, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count = MOCKPP_UNLIMITED) { MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->responseValues.add(rv, p1, p2, p3, p4, p5, p6, count); } }; friend class ControllerFor; private: mutable ResponseVector6<R, P1, P2, P3, P4, P5, P6> responseValues; }; /** Set up visitable mock method expectations with 6 parameters. * Partial specialisation for a void return value. * @ingroup grp_controller */ template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> class VisitableMockMethod6<void, P1, P2, P3, P4, P5, P6> : public VisitableMockMethod6Common<void, P1, P2, P3, P4, P5, P6> { public: /** Constructs the mock object. * @param name human readable description about the expectation * @param parent parent Visitable mock object */ VisitableMockMethod6(const String &name, VisitableMockObject *parent = 0) : VisitableMockMethod6Common<void, P1, P2, P3, P4, P5, P6>(name, parent) { } /** Actually verifies the mocked method. Must be called by the client code. * @param p1 mock method parameter 1 * @param p2 mock method parameter 2 * @param p3 mock method parameter 3 * @param p4 mock method parameter 4 * @param p5 mock method parameter 5 * @param p6 mock method parameter 6 */ void 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); } /** Helper object to easily set up the visitable expectations. * @ingroup grp_controller */ class ControllerFor : public VisitableMockReturningMethodBase<void>::ControllerFor { public: typedef VisitableMockReturningMethodBase<void>::ControllerFor Inherited; /** Construct the controller object. * @meth pointer to according method mock. */ ControllerFor (VisitableMockReturningMethodBase<void> *meth) : Inherited(meth) { } }; friend class ControllerFor; }; } // ns mockpp #endif // MOCKPP_VisitableMockMethod6_H Index: VisitableMockMethod2.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod2.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VisitableMockMethod2.h 28 Oct 2005 20:35:13 -0000 1.2 +++ VisitableMockMethod2.h 29 Oct 2005 18:17:30 -0000 1.3 @@ -35,7 +35,7 @@ #include <mockpp/VisitableMockObject.h> #include <mockpp/VisitableMockMethod.h> -//#include <mockpp/ResponseVector2.h> +#include <mockpp/ResponseVector2.h> namespace mockpp { Index: gen_visitablemethod_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/gen_visitablemethod_N.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- gen_visitablemethod_N.pl 26 Oct 2005 20:05:43 -0000 1.5 +++ gen_visitablemethod_N.pl 29 Oct 2005 18:17:30 -0000 1.6 @@ -55,8 +55,12 @@ #include <mockpp/mockpp.h> #include <mockpp/VisitableMockObject.h> -#include <mockpp/VisitableMockMethod.h> -//#include <mockpp/ResponseVector" . $numArgs . ".h> +#include <mockpp/VisitableMockMethod.h>"; + +if ($numArgs > 0){ print OUT " +#include <mockpp/ResponseVector" . $numArgs . ".h>"; } + +print OUT " namespace mockpp { Index: VisitableMockMethod3.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod3.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VisitableMockMethod3.h 28 Oct 2005 20:35:13 -0000 1.2 +++ VisitableMockMethod3.h 29 Oct 2005 18:17:30 -0000 1.3 @@ -35,7 +35,7 @@ #include <mockpp/VisitableMockObject.h> #include <mockpp/VisitableMockMethod.h> -//#include <mockpp/ResponseVector3.h> +#include <mockpp/ResponseVector3.h> namespace mockpp { Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/Makefile.am,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- Makefile.am 28 Oct 2005 20:35:13 -0000 1.92 +++ Makefile.am 29 Oct 2005 18:17:30 -0000 1.93 @@ -37,11 +37,13 @@ VisitableMockMethod3.h \ VisitableMockMethod4.h \ VisitableMockMethod5.h \ + VisitableMockMethod6.h \ ResponseVector1.h \ ResponseVector2.h \ ResponseVector3.h \ ResponseVector4.h \ - ResponseVector5.h + ResponseVector5.h \ + ResponseVector6.h EXTRA_DIST = \ mockpp_config-bcb5.h \ Index: VisitableMockMethod4.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod4.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VisitableMockMethod4.h 28 Oct 2005 20:35:13 -0000 1.2 +++ VisitableMockMethod4.h 29 Oct 2005 18:17:30 -0000 1.3 @@ -35,7 +35,7 @@ #include <mockpp/VisitableMockObject.h> #include <mockpp/VisitableMockMethod.h> -//#include <mockpp/ResponseVector4.h> +#include <mockpp/ResponseVector4.h> namespace mockpp { --- NEW FILE: ResponseVector6.h --- /** @file @internal NOT INTENDED FOR PUBLIC INCLUSION @brief Generated with gen_responsevector_N.pl. $Id: ResponseVector6.h,v 1.1 2005/10/29 18:17:30 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Sat Feb 15 2003 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_ResponseVector6_H #define MOCKPP_ResponseVector6_H #include <mockpp/constraint/ConstraintHolder.h> #include <mockpp/constraint/IsEqual.h> namespace mockpp { /** Class returning a throwable depending on the parameters * passed to a method. */ template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> class ResponseThrowableVector6 : public ResponseVectorBase { public: /** * Construct a new empty vector * @param aName Label used to identify vector * @param parent parent verifiable */ ResponseThrowableVector6(const String &aName, VerifiableList *parent) : ResponseVectorBase(aName, parent) {} /** Destroys the vector */ virtual ~ResponseThrowableVector6() { reset(); } /** Adds a throwable. * @param t the throwable * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @param count the number of times the object may be used */ void add(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count) { const ConstraintHolder<P1> h1 = new IsEqual<P1>(p1); const ConstraintHolder<P2> h2 = new IsEqual<P2>(p2); const ConstraintHolder<P3> h3 = new IsEqual<P3>(p3); const ConstraintHolder<P4> h4 = new IsEqual<P4>(p4); const ConstraintHolder<P5> h5 = new IsEqual<P5>(p5); const ConstraintHolder<P6> h6 = new IsEqual<P6>(p6); add(t, h1, h2, h3, h4, h5, h6, count); } /** Adds a throwable. * @param t the throwable * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @param count the number of times the object may be used */ void add(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count) { counter.push_back(count); tvec.push_back(t); typename mockpp::Constraint<P1>::AP cons1 (p1); typename mockpp::Constraint<P2>::AP cons2 (p2); typename mockpp::Constraint<P3>::AP cons3 (p3); typename mockpp::Constraint<P4>::AP cons4 (p4); typename mockpp::Constraint<P5>::AP cons5 (p5); typename mockpp::Constraint<P6>::AP cons6 (p6); t1vec.push_back(cons1.release()); t2vec.push_back(cons2.release()); t3vec.push_back(cons3.release()); t4vec.push_back(cons4.release()); t5vec.push_back(cons5.release()); t6vec.push_back(cons6.release()); } /** Removes all the objects from the list. */ virtual void reset() { clear(); } /** Removes all the objects from the list. */ void clear() { counter.clear(); tvec.clear(); for (unsigned i1 = 0; i1 < t1vec.size(); ++i1) delete t1vec[i1]; t1vec.clear(); for (unsigned i2 = 0; i2 < t2vec.size(); ++i2) delete t2vec[i2]; t2vec.clear(); for (unsigned i3 = 0; i3 < t3vec.size(); ++i3) delete t3vec[i3]; t3vec.clear(); for (unsigned i4 = 0; i4 < t4vec.size(); ++i4) delete t4vec[i4]; t4vec.clear(); for (unsigned i5 = 0; i5 < t5vec.size(); ++i5) delete t5vec[i5]; t5vec.clear(); for (unsigned i6 = 0; i6 < t6vec.size(); ++i6) delete t6vec[i6]; t6vec.clear(); } /** Finds a throwable for a set of parameters. * @param t the throwable * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @return true: throwable found for parameters */ bool find(Throwable * &t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) { for (unsigned i = 0; i < t1vec.size(); ++i) if ( counter[i] > 0 && t1vec[i]->eval(p1) && t2vec[i]->eval(p2) && t3vec[i]->eval(p3) && t4vec[i]->eval(p4) && t5vec[i]->eval(p5) && t6vec[i]->eval(p6) ) { if (tvec.at(i) == 0) return false; if (counter[i] != MOCKPP_UNLIMITED) --counter[i]; t = tvec.at(i); return true; } return false; } protected: std::vector<Constraint<P1>*> t1vec; std::vector<Constraint<P2>*> t2vec; std::vector<Constraint<P3>*> t3vec; std::vector<Constraint<P4>*> t4vec; std::vector<Constraint<P5>*> t5vec; std::vector<Constraint<P6>*> t6vec; }; /** Class returning a throwable depending on the parameters * passed to a method. */ template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6> class ResponseVector6 : public ResponseThrowableVector6<P1, P2, P3, P4, P5, P6> { public: /** Construct a new empty vector * @param aName Label used to identify vector * @param parent parent verifiable */ ResponseVector6(const String &aName, VerifiableList *parent) : ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>(aName, parent) {} /** Adds a throwable. * @param t the throwable * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @param count the number of times the object may be used */ void add(Throwable *t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count) { MOCKPP_ASSERT_TRUE(t != 0); ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>::add(t, p1, p2, p3, p4, p5, p6, count); R r; rvec.push_back(r); } /** Adds a throwable. * @param t the throwable * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @param count the number of times the object may be used */ void add(Throwable *t, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count) { MOCKPP_ASSERT_TRUE(t != 0); ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>::add (t, p1, p2, p3, p4, p5, p6, count); R r; rvec.push_back(r); } /** Adds a return value. * @param r the return value * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @param count the number of times the object may be used */ void add(const R &r, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, unsigned count) { ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>::add((Throwable*)0, p1, p2, p3, p4, p5, p6, count); rvec.push_back(r); } /** Adds a return value. * @param r the return value * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @param count the number of times the object may be used */ void add(const R &r, const ConstraintHolder<P1> &p1, const ConstraintHolder<P2> &p2, const ConstraintHolder<P3> &p3, const ConstraintHolder<P4> &p4, const ConstraintHolder<P5> &p5, const ConstraintHolder<P6> &p6, unsigned count) { ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>::add((Throwable*)0, p1, p2, p3, p4, p5, p6, count); rvec.push_back(r); } /** Removes all the objects from the list. */ virtual void reset() { clear(); } /** Removes all the objects from the list. */ void clear() { ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>::clear(); rvec.clear(); } #if defined(__BORLANDC__) || (__GNUC__ < 3) // ==> BCB5.5.1 ?? F1004 Internal compiler error at 0x12548c1 with base 0x1200000 bool find(Throwable * &t, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) { return ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>::find(t, p1, p2, p3, p4, p5, p6); } #else using ResponseThrowableVector6<P1, P2, P3, P4, P5, P6>::find; #endif /** Finds a return value for a set of parameters. * @param r the value * @param p1 the parameter 1 upon which to return * @param p2 the parameter 2 upon which to return * @param p3 the parameter 3 upon which to return * @param p4 the parameter 4 upon which to return * @param p5 the parameter 5 upon which to return * @param p6 the parameter 6 upon which to return * @return true: return value found for parameters */ bool find(R &r, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6) { for (unsigned i = 0; i < this->t1vec.size(); ++i) if ( this->counter[i] > 0 && this->t1vec[i]->eval(p1) && this->t2vec[i]->eval(p2) && this->t3vec[i]->eval(p3) && this->t4vec[i]->eval(p4) && this->t5vec[i]->eval(p5) && this->t6vec[i]->eval(p6) ) { if (this->tvec.at(i) != 0) return false; if (this->counter[i] != MOCKPP_UNLIMITED) --this->counter[i]; r = rvec[i]; return true; } return false; } private: std::vector<R> rvec; }; } // ns mockpp #endif // MOCKPP_ResponseVector6_H Index: VisitableMockMethod0.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod0.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VisitableMockMethod0.h 28 Oct 2005 20:35:13 -0000 1.2 +++ VisitableMockMethod0.h 29 Oct 2005 18:17:30 -0000 1.3 @@ -35,7 +35,6 @@ #include <mockpp/VisitableMockObject.h> #include <mockpp/VisitableMockMethod.h> -//#include <mockpp/ResponseVector0.h> namespace mockpp { Index: VisitableMockMethod5.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod5.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VisitableMockMethod5.h 28 Oct 2005 20:35:13 -0000 1.2 +++ VisitableMockMethod5.h 29 Oct 2005 18:17:30 -0000 1.3 @@ -35,7 +35,7 @@ #include <mockpp/VisitableMockObject.h> #include <mockpp/VisitableMockMethod.h> -//#include <mockpp/ResponseVector5.h> +#include <mockpp/ResponseVector5.h> namespace mockpp { Index: VisitableMockMethod1.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod1.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VisitableMockMethod1.h 28 Oct 2005 20:35:13 -0000 1.2 +++ VisitableMockMethod1.h 29 Oct 2005 18:17:30 -0000 1.3 @@ -35,7 +35,7 @@ #include <mockpp/VisitableMockObject.h> #include <mockpp/VisitableMockMethod.h> -//#include <mockpp/ResponseVector1.h> +#include <mockpp/ResponseVector1.h> namespace mockpp { |