carb::extras::isTestEnvironment
Defined in carb/extras/TestEnvironment.h
-
inline bool carb::extras::isTestEnvironment()
Queries whether the calling process is the Carbonite unit tests.
#include <carb/Defines.h> CARB_EXPORT int32_t g_carbUnitTests; int32_t g_carbUnitTests = 1; int main(int, char**) { // unittest driver return 0; }
Note
This requires the symbol “g_carbUnitTests” defined in the unittest module. on linux, if the symbol is declared in the executable and not in a shared library, the executable must be linked with -rdynamic or -Wl,—export-dynamic, otherwise getLibrarySymbol() will fail. typical usage would be to define g_carbUnitTests near the unittest module’s main(), for example:
- Returns
true
if the calling process is the Carbonite unit tests.- Returns
false
otherwise.