#include <CallDriver.h> [code]
A test driver class has the same functions as the class it is driving except the return values are substituted with CallDriver objects. These objects allow for the method chaining syntax to be used when modeling the object interactions in a test.
This class is used as a helper to build a tree of BoundFunction and ExpecedFunction objects and thus model an interaction between a object of the class being tested (represented by a test driver class) and its environment (represented by objects of mock classes). ExpectationDriver, as well as CallDriver and DelayedCallDriver manipulate the underlying BoundFunction and ExpectedFunction objects and their functions return objects or object references to each other depending on the context.
CallDriver objects are supposed to be created by the template factory method MockBase::call() for a BoundFunction. CallDriver's willCall() would create and return an ExpectationDriver object for an ExpectedFunction from a mock object. The context effectively changes and the user could set the properties of the ExpectedFunction over the interface of ExpectationDriver. To switch back to the context of CallDriver, ExpectationDriver::willReturn() should be called.
Definition at line 62 of file CallDriver.h.
Public Types | |
| typedef Function::ReturnType | ReturnType |
Public Member Functions | |
| CallDriver (auto_ptr< Function > foo) | |
| CallDriver (const CallDriver &other) | |
| ~CallDriver () | |
| template<typename Foo> | |
| ExpectationDriver< CallDriver, ExpectedFunction< Foo > > | willCall (ExpectationPair< ExpectedFunction< Foo > > expectation) |
| Express the expectation that a function will be called. | |
| template<typename Foo> | |
| ExpectationDriver< CallDriver, ExpectedFunction< Foo > > | willCallMsg (ExpectationPair< ExpectedFunction< Foo > > expectation, const std::string &expressionString, const SourceLine &sourceLine) |
| void | willReturn (const ReturnTypeWrapper< ReturnType > &returnValue) |
| Express the expectation for the return value of the bound function. | |
| void | willReturnMsg (const ReturnTypeWrapper< ReturnType > &returnValue, const std::string &expressionString, const SourceLine &sourceLine) |
| void | returns () |
| Express the expectation that the bound function returns void. | |
| template<typename Foo> | |
| CallDriver & | willEmit (ExpectationPair< ExpectedFunction< Foo > > expectation) |
| Express the expectation that a signal is emitted form bound function. | |
| template<typename Foo> | |
| CallDriver & | willEmitMsg (ExpectationPair< ExpectedFunction< Foo > > expectation, const std::string &expressionString, const CPPUNIT_NS::SourceLine &sourceLine) |
Private Attributes | |
| auto_ptr< Function > | f |
| bool | throwing |
Friends | |
| class | ExpectationDriver |
|
|||||
|
Definition at line 65 of file CallDriver.h. |
|
||||||||||
|
Definition at line 67 of file CallDriver.h. |
|
||||||||||
|
Definition at line 68 of file CallDriver.h. |
|
|||||||||
|
If we are owning a bound function will check whether it was called.
Definition at line 70 of file CallDriver.h. |
|
|||||||||
|
Express the expectation that the bound function returns void.
Definition at line 140 of file CallDriver.h. |
|
||||||||||||||
|
Express the expectation that a function will be called. This overload gets called when we want to model the expectation that a function of a mock object gets called. Definition at line 93 of file CallDriver.h. |
|
||||||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 107 of file CallDriver.h. |
|
||||||||||||||
|
Express the expectation that a signal is emitted form bound function.
Definition at line 148 of file CallDriver.h. |
|
||||||||||||||||||||||||
|
Definition at line 162 of file CallDriver.h. |
|
||||||||||
|
Express the expectation for the return value of the bound function.
Definition at line 116 of file CallDriver.h. |
|
||||||||||||||||||||
|
Definition at line 131 of file CallDriver.h. |
|
|||||
|
Definition at line 174 of file CallDriver.h. |
|
|||||
|
Definition at line 171 of file CallDriver.h. |
|
|||||
|
Definition at line 172 of file CallDriver.h. |