The userSetup.cpp and userShutdown.cpp files contain code used to specify any required "scaffolding" code to be executed before constructors for a test case (userSetup.cpp) and after each test case (userShutdown.cpp).
As an example, a distributed system might require that a function register with an application server task before being permitted to execute a function. Both files apply globally to any function being test with the Ballista test suite, and are implemented via a #include rather than execution of a constructor.
For scaffolding that is specific to a particular function, use phantom parameters instead of userSetup.cpp and userShutdown.cpp. For scaffolding that is appropriate for all functions in the callTable.all, use the userSetup.cpp and userShutdown.cpp files. By way of example, in most situations a userSetup.cpp file could be replaced with a leading phantom parameter having a single test value, with the constructor code being the same as the code in a userSetup.cpp file. Similarly, a userShutdown.cpp file is in general equivalent to a trailing phantom parameter with the userShutdown.cpp code put into the destructor of a the sole test value in the testing object.
The userSetup.cpp and userShutdown.cpp files are treated as being entirely C++ code, so comments can be inserted with “/* … */” and “//” as in any C++ program.
The Ballista test suite automatically processes anything placed in the files userSetup.cpp and userShutdown.cpp in the /ballista directory.