mockpp::ExpectationBoundary< T > Class Template Reference
[Basic Mock Objects]

A class to verify that an actual value lies between two boundary values. More...

Inheritance diagram for mockpp::ExpectationBoundary< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ExpectationBoundary (const String &name, VerifiableList *parent=0)
 Constructs the expectation.
void setActual (const T &value)
 Sets the actual value.
void setExpected (const T &lower, const T &upper)
 Sets the expectation value boundaries.
void setExpectedDelta (const T &median, const T &delta)
 Sets the expectation value boundaries.
virtual void reset ()
 Resets the internal state completely.
virtual void clearActual ()
 Resets the internal state to reflect that there is no actual value set.
virtual void setExpectNothing ()
 Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error.
virtual void verify ()
 Verify that the expected value is within the allowed bounds.

Protected Member Functions

virtual void clearExpectation ()
 Clears the expectation list.

Detailed Description

template<class T>
class mockpp::ExpectationBoundary< T >

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.

Definition at line 49 of file ExpectationBoundary.h.


Constructor & Destructor Documentation

template<class T >
mockpp::ExpectationBoundary< T >::ExpectationBoundary ( const String name,
VerifiableList parent = 0 
) [inline]

Constructs the expectation.

Parameters:
name human readable description about the expectation
parent parent verifiable

Definition at line 65 of file ExpectationBoundary.h.


Member Function Documentation

template<class T >
void mockpp::ExpectationBoundary< T >::setActual ( const T &  value  )  [inline]

Sets the actual value.

Parameters:
value the actual value

Definition at line 76 of file ExpectationBoundary.h.

template<class T >
void mockpp::ExpectationBoundary< T >::setExpected ( const T &  lower,
const T &  upper 
) [inline]

Sets the expectation value boundaries.

Parameters:
lower lowest value
upper highest value

Definition at line 91 of file ExpectationBoundary.h.

template<class T >
void mockpp::ExpectationBoundary< T >::setExpectedDelta ( const T &  median,
const T &  delta 
) [inline]

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 to activate it.

  #undef  MOCKPP_BOUNDARY_DELTA  // after inclusion of mockpp.h!
  #define MOCKPP_BOUNDARY_DELTA 1
 

Additionally operator+() and operator-() must exist for your expected objects, that's the reason why it is disabled by default.

Parameters:
median expected value
delta allowed difference range

Definition at line 117 of file ExpectationBoundary.h.

template<class T >
virtual void mockpp::ExpectationBoundary< T >::setExpectNothing (  )  [inline, virtual]

Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error.

The Expectation will fail if any actual values are set.

Note that this is not the same as not setting any expectations, in which case verify() will do nothing.

Implements mockpp::Expectation.

Definition at line 160 of file ExpectationBoundary.h.

template<class T >
virtual void mockpp::ExpectationBoundary< T >::verify (  )  [inline, virtual]

Verify that the expected value is within the allowed bounds.

If it fails, an AssertionFailedError is thrown

Implements mockpp::AbstractExpectation< T >.

Definition at line 171 of file ExpectationBoundary.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines

Generated on Tue Jan 5 09:48:58 2010 for mockpp by  doxygen 1.6.1