ericw-tools/tests/test_main.cc

42 lines
904 B
C++

#include "test_main.hh"
#define DOCTEST_CONFIG_IMPLEMENT
#include <doctest/doctest.h>
#include <common/log.hh>
#include <common/threads.hh>
bool tests_verbose = false;
int main(int argc, char **argv)
{
logging::preinitialize();
// writing console colors within test case output breaks doctest/CLion integration
logging::enable_color_codes = false;
for (int i = 1; i < argc; ++i) {
// parse "-threads 1"
if (!strcmp("-threads", argv[i]) && (i + 1) < argc) {
configureTBB(atoi(argv[i + 1]), false);
continue;
}
// parse "-verbose"
if (!strcmp("-verbose", argv[i])) {
tests_verbose = true;
continue;
}
}
doctest::Context context;
context.applyCommandLine(argc, argv);
int res = context.run();
if (context.shouldExit()) {
return res;
}
return res;
}