2.1. | I have the following simple method but it does not compile.
const X& method(int p1);
|
Since mockpp emulates all method calls there is no variable to which you can return a reference. One solution is, to use a shadow method. The trick is to separate the mocking elements and the method in question which contains a real variable. MOCKPP_VISITABLE1(ClassName, shadow_method, int); X shadow_variable; // the variable is a class member const X& method(int p1) { shadow_variable = shadow_method(p1); return shadow; }
| |
2.2. | How should one organise production code and test code? |
There is no general solution how to organise the sources to both run the tests and create a releasable binary without debugging and test code. A flexible and clean approach is the one used within mockpp:
So the layout of your project tree might look like this: projectroot \_ main() | \_ subproject1 | \_ tests | \_ subproject2 \_ tests
| |
2.3. | Where can I ask a question regarding mockpp? |
Send a mail to the according mailing list or point your browser to the forum. |