I’m using Boost unit tests BOOST_AUTO_TEST_CASE
It requires to remove main() function to execute the test cases.
The question is
What directives should be used for switching between Normal/UnitTest modes? I have cross-platform application for Windows and Unix.
I have only one suggestion: use something like #ifndef TESTING in main.cpp and use manual change #define TESTING line ?
Is there any better solution?
Thanks
Unit tests should go into a separate translation unit. If you have
foo.hppandfoo.cppfor your library, you have something likefoo_test.cppfor the unit tests. Your build environment would then be made aware of a new “test” target which builds and runs those tests.