I need to temporarily put a main() function in my object to test alternate functionality (beyond a simple unit test), but I keep having to comment out my main() function to run my unit tests.
Is there a #define _KEYWORD_ for CxxTest to allow this to happen automatically?
You simply need to encapsulate the offending code with a compiler directive based on the definition of the
CXXTEST_RUNNINGkeyword.For example:
In this case, when using the CxxTest framework the
main()function will be ignored in favor of themain()created by the testing framework. Otherwise, themain()function you have provided will be used.