Currently I have a test folder with multiple source files for each test. On CMake, I previously defined a binary for each source file but decided that I should now combine all of them into a single binary and make use of the filters in GTest to select which tests I want to run. None of these source files has a main() function but I guess the GTest framework just implicitly calls it during runtime.
So now I created a test manager source file which has nothing except a main() which calls InitGoogleTests and RUN_ALL_TESTS() and includes all the test source files. According to Google, that's a 'hack to be used at last resort'.
How should I then properly do this? Should I really go and create header files for each of my test sources and write the declarations there and then include all these headers in my test manager source? Is there any other...easier... way to do this?
Aucun commentaire:
Enregistrer un commentaire