[Mockpp-commits] mockpp/mockpp ChainableMockObject.h,1.27,1.28 ExpectationBoundary.h,1.19,1.20 Mixed
Brought to you by:
ewald-arnold
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19293/mockpp Modified Files: ChainableMockObject.h ExpectationBoundary.h MixedMockObject.h MockObject.h ResponseVector1.h ResponseVector2.h ResponseVector3.h ResponseVector4.h ResponseVector5.h ResponseVector6.h VisitableMockMethod.cpp VisitableMockMethod.h VisitableMockMethod0.h VisitableMockMethod1.h VisitableMockMethod2.h VisitableMockMethod3.h VisitableMockMethod4.h VisitableMockMethod5.h VisitableMockMethod6.h Log Message: cleanup in docs Index: VisitableMockMethod.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- VisitableMockMethod.cpp 25 Oct 2005 19:06:10 -0000 1.3 +++ VisitableMockMethod.cpp 29 Oct 2005 21:00:26 -0000 1.4 @@ -30,6 +30,7 @@ #include <mockpp/mockpp.h> // always first +#include <mockpp/mockpp_dbc.h> #include <mockpp/VisitableMockMethod.h> @@ -43,6 +44,8 @@ , throwables (name + MOCKPP_PCHAR("/throwables"), this) , throwablesInline (true) { + MOCKPP_PRE(parent != 0); + MOCKPP_PRE(name.length() != 0); } Index: ChainableMockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ChainableMockObject.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- ChainableMockObject.h 19 Sep 2005 18:42:08 -0000 1.27 +++ ChainableMockObject.h 29 Oct 2005 21:00:25 -0000 1.28 @@ -111,7 +111,7 @@ protected: - /** Verifies the object and the mock objects it contains.. + /** Verifies the object and the mock objects it contains. * If it fails, an AssertionFailedError is thrown */ void chainableVerify(); @@ -158,7 +158,7 @@ */ virtual ~ChainableMockObject(); - /** Verifies the object and the mock objects it contains.. + /** Verifies the object and the mock objects it contains. * If it fails, an AssertionFailedError is thrown */ virtual void verify(); Index: MixedMockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/MixedMockObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MixedMockObject.h 6 Mar 2005 21:45:52 -0000 1.1 +++ MixedMockObject.h 29 Oct 2005 21:00:26 -0000 1.2 @@ -66,7 +66,7 @@ */ virtual void reset(); - /** Verifies the object and the mock objects it contains.. + /** Verifies the object and the mock objects it contains. * If it fails, an AssertionFailedError is thrown */ virtual void verify(); Index: MockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/MockObject.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- MockObject.h 6 Apr 2005 20:15:20 -0000 1.21 +++ MockObject.h 29 Oct 2005 21:00:26 -0000 1.22 @@ -63,7 +63,7 @@ */ void notImplemented(); - /** Verifies the object and the mock objects it contains.. + /** Verifies the object and the mock objects it contains. * If it fails, an AssertionFailedError is thrown */ virtual void verify(); Index: VisitableMockMethod.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockMethod.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- VisitableMockMethod.h 25 Oct 2005 19:06:10 -0000 1.9 +++ VisitableMockMethod.h 29 Oct 2005 21:00:26 -0000 1.10 @@ -47,7 +47,7 @@ * @param name the method name to mock * @param parent parent Visitable mock object */ - VisitableMockMethodBase(const String &methodname, VisitableMockObject *parent); + VisitableMockMethodBase(const String &name, VisitableMockObject *parent); String getMethodName() const; @@ -89,6 +89,9 @@ { public: + /** Construct the item. + * @param meth pointer to the method mock + */ ControllerFor (VMM *meth) : method(meth) , object(meth->getVisitableMockObject()) @@ -96,25 +99,41 @@ this->object->addController(this); } + /** Destruct the item. + */ virtual ~ControllerFor () { this->object->removeController(this); } + /** Switches exception handling back to pre-1.2 behaviour. + * @see VisitableMockObject::Controller::unsetThrowablesInline() + */ void unsetThrowablesInline() { MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->throwablesInline = false; }; - void addThrowable(Throwable *t_) + /** Adds another throwable to the method. + * The throwables are thrown one after the other when the method is + * called after activating until all of them are used. + * @param t a pointer to the throwable + */ + void addThrowable(Throwable *t) { - std::auto_ptr<Throwable> at (t_); + std::auto_ptr<Throwable> at (t); MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->throwables.push_back(at.release()); this->method->throwableInsteadReturn.push_back(true); } + /** Adds another throwable to the method. + * The throwables are thrown one after the other when the method is + * called after activating until all of them are used. + * @param w the value to throw + * @param count how often to throw the value + */ template <class T> void addThrowable(const T &w, unsigned count = 1) { @@ -122,9 +141,14 @@ addThrowable(make_throwable(w)); } - void setDefaultThrowable(Throwable *t_) + /** Sets the default throwable. + * Once the list of throwables is empty this one is thrown. This also + * means that your method never processes the parameters passed to it. + * @param t a pointer to the throwable + */ + void setDefaultThrowable(Throwable *t) { - std::auto_ptr<Throwable> at (t_); + std::auto_ptr<Throwable> at (t); MOCKPP_ASSERT_FALSE(this->object->isActivated()); this->method->defaultThrowable.take(at.release()); } @@ -199,11 +223,19 @@ public: + /** Construct the item. + * @param meth pointer to the method mock + */ ControllerFor (VisitableMockReturningMethodBase<R> *meth) : Inherited(meth) { } + /** Sets the default return value. + * This value is returned if there are no throwables available and if there + * are no other possible return values in a list. + * @param rv the default return value + */ void setDefaultReturnValue(const R &rv) { MOCKPP_ASSERT_FALSE(this->object->isActivated()); @@ -211,6 +243,12 @@ this->method->defaultReturnValue = rv; } + /** Adds another return value. + * The values from this list are return one after the other unless there + * are no other throwables or response values available. + * @param rv the next return value + * @param count the number of times this value shall be returned + */ void addReturnValue(const R &rv, unsigned count = 1) { MOCKPP_ASSERT_FALSE(this->object->isActivated()); @@ -221,6 +259,10 @@ } } + /** Determines the current return value. + * The values from the default value or the list are returned one after + * the other. + */ R determineReturnValue() { if (this->method->returnValues.hasMoreObjects()) @@ -231,6 +273,8 @@ return this->method->defaultReturnValue; } + /** Sets all internal objects to the state after construction. + */ virtual void reset() { Inherited::reset(); @@ -238,6 +282,9 @@ this->method->defaultReturnValueUsed = false; } + /** Verify that the expected and actual values are equal. + * If it fails, an AssertionFailedError is thrown + */ virtual void verify() { Inherited::verify(); @@ -275,6 +322,9 @@ : VisitableMockMethodBase(name, parent) {} + /** Construct the item. + * @param meth pointer to the method mock + */ class ControllerFor : public VisitableMockMethodBase::ControllerFor<VisitableMockReturningMethodBase<void> > { typedef VisitableMockMethodBase::ControllerFor<VisitableMockReturningMethodBase<void> > Inherited; Index: ExpectationBoundary.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ExpectationBoundary.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- ExpectationBoundary.h 7 May 2005 12:45:10 -0000 1.19 +++ ExpectationBoundary.h 29 Oct 2005 21:00:26 -0000 1.20 @@ -40,7 +40,7 @@ namespace mockpp { -/** A class to verify that an actual value lies between two boundary values.. +/** A class to verify that an actual value lies between two boundary values. * Since it uses operator<() and operator==() for verification * it can handle all objects that implement those operators not just numerics. * \ingroup grp_basic_mo @@ -99,14 +99,15 @@ #if MOCKPP_BOUNDARY_DELTA != 0 + /** Sets the expectation value boundaries. * Differs from the normal setExpected() method only in the parameters. * Since this method is not activated by default, you must add the - * following lines to your source code before #include'ing ExpectationBoundery.h + * following lines to your source code before \#include'ing ExpectationBoundery.h * to activate it. * <pre> - * #undef MOCKPP_BOUNDARY_DELTA // after inclusion of mockpp.h! - * #define MOCKPP_BOUNDARY_DELTA 1 + * \#undef MOCKPP_BOUNDARY_DELTA // after inclusion of mockpp.h! + * \#define MOCKPP_BOUNDARY_DELTA 1 * </pre> * Additionally operator+() and operator-() must exist for your * expected objects, that's the reason why it is disabled by default. |