Inheritance diagram for Utils::CalitkoMocks::Testing::ExpectedFunctionTest:


ExpectedFunction is a template class representing a functions. A number of different template specializations are defined for functions taking from none to nine parameters. Adding further template instantiations can easily be done using a single line macro (see DEFINE_EXPECTED_FUNCTION() in ExpectationDriver.h).
Since all instantiations are defined using the same macro template it is not necessary to fully test all different instantiations. We have chosen to perform the following tests:
What is with const pointer to the host class and with const functions? It is now solved ugly by adding a new ctor to ExpectedFunction.
Definition at line 69 of file ExpectedFunctionTest.cpp.
Public Types | |
| typedef BoundFunction< ExpectedFunctionTest, void(int &)> | VoidVoidCallType |
| typedef BoundFunction< ExpectedFunctionTest, int()> | VoidVoidCall2Type |
Public Member Functions | |
| void | testVoidVoidChecked () |
| Verify that verifyChecked() doesn't throw if check() was called. | |
| void | testVoidVoidNotChecked () |
| Verify that verifyChecked() does throw if check() was not called. | |
| void | testIntIntOk () |
| Test that both expectated parameter value and return value are correct. | |
| void | testIntIntCallFails () |
| An exception should be thrown for an unexpected parameter value. | |
| void | testIntIntReturnFails () |
| Expecting a wrong return value should fail. | |
| void | testIntIntNoReturnSetFail () |
| If no return value was set using willReturn() an exception is thrown. | |
| void | testIntIntNoReturnSetFailWithContext () |
| Verify that if set, the correct contexts is specified in the exception. | |
| void | testIntRefVoidOk () |
| Test an instantiation returning an int &. | |
| void | testVoidConstIntRefOk () |
| Test an instantiation taking a const int &. | |
| void | testVoidIntRefOk () |
| An int & parameter expectation passes if the same identity is provided. | |
| void | testVoidIntRefNotSameIdentity () |
| Not passing the same identity for an int & should fail. | |
| void | VoidVoidCall (int &a) |
| void | testVoidVoidWithCallsOk () |
| Test a void() expectation calling two bound functions. | |
| int | VoidVoidCall2 () |
| void | testVoidVoidWithCallReturnIncorrect () |
| Test an expectation calling a function, whose return expectation fails. | |
Private Member Functions | |
| CPPUNIT_TEST_SUITE (ExpectedFunctionTest) | |
| CPPUNIT_TEST (testVoidVoidChecked) | |
| CPPUNIT_TEST (testVoidVoidNotChecked) | |
| CPPUNIT_TEST (testIntIntOk) | |
| CPPUNIT_TEST (testIntIntCallFails) | |
| CPPUNIT_TEST_FAIL (testIntIntReturnFails) | |
| CPPUNIT_TEST (testIntIntNoReturnSetFail) | |
| CPPUNIT_TEST (testIntIntNoReturnSetFailWithContext) | |
| CPPUNIT_TEST (testIntRefVoidOk) | |
| CPPUNIT_TEST (testVoidConstIntRefOk) | |
| CPPUNIT_TEST (testVoidIntRefOk) | |
| CPPUNIT_TEST_FAIL (testVoidIntRefNotSameIdentity) | |
| CPPUNIT_TEST (testVoidVoidWithCallsOk) | |
| CPPUNIT_TEST (testVoidVoidWithCallReturnIncorrect) | |
| CPPUNIT_TEST_SUITE_END () | |
|
|
Definition at line 237 of file ExpectedFunctionTest.cpp. |
|
|
Definition at line 214 of file ExpectedFunctionTest.cpp. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An exception should be thrown for an unexpected parameter value.
Definition at line 119 of file ExpectedFunctionTest.cpp. |
|
|
If no return value was set using willReturn() an exception is thrown.
Definition at line 143 of file ExpectedFunctionTest.cpp. |
|
|
Verify that if set, the correct contexts is specified in the exception.
Definition at line 158 of file ExpectedFunctionTest.cpp. |
|
|
Test that both expectated parameter value and return value are correct.
Definition at line 111 of file ExpectedFunctionTest.cpp. |
|
|
Expecting a wrong return value should fail.
Definition at line 135 of file ExpectedFunctionTest.cpp. |
|
|
Test an instantiation returning an int &.
Definition at line 175 of file ExpectedFunctionTest.cpp. |
|
|
Test an instantiation taking a const int &. The values of the objects referenced should be the same by value but not by address. ExpectedFunction stores an object of type T for a parameter of type T &. Definition at line 190 of file ExpectedFunctionTest.cpp. |
|
|
Not passing the same identity for an int & should fail.
Definition at line 205 of file ExpectedFunctionTest.cpp. |
|
|
An int & parameter expectation passes if the same identity is provided.
Definition at line 197 of file ExpectedFunctionTest.cpp. |
|
|
Verify that verifyChecked() doesn't throw if check() was called.
Definition at line 89 of file ExpectedFunctionTest.cpp. |
|
|
Verify that verifyChecked() does throw if check() was not called.
Definition at line 97 of file ExpectedFunctionTest.cpp. |
|
|
Test an expectation calling a function, whose return expectation fails.
Definition at line 239 of file ExpectedFunctionTest.cpp. |
|
|
Test a void() expectation calling two bound functions.
Definition at line 216 of file ExpectedFunctionTest.cpp. |
|
|
Definition at line 213 of file ExpectedFunctionTest.cpp. |
|
|
Definition at line 236 of file ExpectedFunctionTest.cpp. |