1.5.4. Selecting a Framework at Compile Time

Since each of the frameworks has its special advantage it may be necessary to switch at compile time under different environments. On a desktop computer Boost.Test may be appropriate but for special tests on embedded platforms you may prefer CxxTest.

mockpp uses some compiler switches and conditional macros to support the formerly mentioned frameworks. The tests itself remain unchanged. Only the method to register the tests and the invocation within main() differs. Please see the various tests files *_tests.cpp and mock_test.cpp in the tests directory. Depending on the definition in the configuration file one of the following macros is used to generate the according code. SelectUnittestFramework.h contains all the definitions and includes the needed header files.


#include <mockpp/SelectUnittestFramework.h>

#if defined (MOCKPP_USE_CXXTEST)

#elif defined(MOCKPP_USE_BOOSTTEST)

#elif defined(MOCKPP_USE_CXXTEST)

#endif