34#ifndef HYRAX_GIT_RUN_TESTS_CPPUNIT_H
35#define HYRAX_GIT_RUN_TESTS_CPPUNIT_H
38#include <cppunit/TextTestRunner.h>
39#include <cppunit/extensions/TestFactoryRegistry.h>
40#include <cppunit/extensions/HelperMacros.h>
47#define DBG(x) do { if (debug) (x); } while(false);
52#define DBG2(x) do { if (debug) (x); } while(false);
63bool bes_run_tests(
int argc,
char *argv[],
const std::string &besdebug_contexts)
65 CppUnit::TextTestRunner runner;
66 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
69 while ((option_char = getopt(argc, argv,
"dDbh")) != -1) {
70 switch (option_char) {
81 std::cerr <<
"Usage: the following tests can be run individually or in combination:" << std::endl;
82 auto &tests = CLASS::suite()->getTests();
83 unsigned int prefix_len = CLASS::suite()->getName().append(
"::").length();
84 for (
auto &t: tests) {
85 std::cerr << t->getName().replace(0, prefix_len,
"") << std::endl;
98 return runner.run(
"");
101 bool wasSuccessful =
true;
104 std::string test = CLASS::suite()->getName().append(
"::").append(argv[i++]);
105 if (debug) std::cerr <<
"Running " << test << std::endl;
106 wasSuccessful = wasSuccessful && runner.run(test);
108 return wasSuccessful;
static void SetUp(const std::string &values)
Sets up debugging for the bes.