#define CATCH_CONFIG_RUNNER #include "catch_test_runner.h" #include "catch/catch.hpp" #include "lib/logging/logging.h" #include "lib/config/config.h" #include "lib/config/protos/logging.pb.h" #include "lib/utils/bts_assert.h" #include "lib/utils/is_unittest_environment.h" namespace bts { int run_tests (std::vector const&args) { utils::internal::force_unittest_environment(); auto cfg = config::get (); cfg.mutable_console()->set_default_level("Fatal"); log::configure_logging(cfg); bts_assert(args.size() < 100); char const *argv[100]; argv[0] = "test"; //the cmd processor takes the first arg away for (size_t i = 0; i < args.size();i++) argv[i+1] = args[i].c_str(); int result = Catch::Session().run( args.size() + 1, argv ); // NOLINT return ( result < 0xff ? result : 0xff ); } }