Opmock comes currently with a simple helper script to generate test files for you.
If you've chosen to use the unit testing framework that comes with opmock, then every time you add a new test, you need to:
It is somewhat tedious to maintain all these files, and one can easily forget to register a test. Opmock provides a very simple utility script in the scripts folder:
refresh_tests.sh.
This script will:
Calling the script is simple:
refresh_tests.sh fizzbuzz_test.c fizzbuzz_test2.c
Will generate 2 header files and a main.c file. You may have to rename the main.c to main.cpp if you have link time errors with a mix of C and CPP files.
There's a fully working example, including Makefile rules, in the samples/test_gen folder of the Opmock distribution.
Accepted extensions for C test files are:
.c, .C, and will result in .h files.
Accepted extensions for C++ test files are:
.cc; .cpp, .c++, .CC, and will result in .hpp files.