diff --git a/unit-tests/DmrRoundTripTest.cc b/unit-tests/DmrRoundTripTest.cc index 3d8b2e4dd..49b8a5a31 100644 --- a/unit-tests/DmrRoundTripTest.cc +++ b/unit-tests/DmrRoundTripTest.cc @@ -24,9 +24,6 @@ #include "config.h" -#include -#include - #include #include "Array.h" @@ -45,23 +42,6 @@ #include "testFile.h" #include "test_config.h" -static bool debug2 = false; - -#undef DBG -#define DBG(x) \ - do { \ - if (debug) { \ - x; \ - } \ - } while (false) -#undef DBG2 -#define DBG2(x) \ - do { \ - if (debug2) { \ - x; \ - } \ - } while (false) - using namespace CppUnit; using namespace std; using namespace libdap; diff --git a/unit-tests/run_tests_cppunit.h b/unit-tests/run_tests_cppunit.h index 2f15e988e..f4291d14d 100644 --- a/unit-tests/run_tests_cppunit.h +++ b/unit-tests/run_tests_cppunit.h @@ -46,7 +46,16 @@ bool debug = false; #define DBG(x) \ do { \ if (debug) \ - (x); \ + x; \ + } while (false) + +bool debug2 = false; + +#undef DBG2 +#define DBG2(x) \ + do { \ + if (debug2) \ + x; \ } while (false) /** @@ -68,7 +77,7 @@ template bool run_tests(int argc, char *argv[]) { debug = true; // debug is a global break; case 'D': - debug = true; // debug is a global + debug2 = true; // debug is a global break; case 'h': { // help - show test names std::cerr << "Usage: the following tests can be run individually or in combination:" << std::endl; @@ -86,19 +95,20 @@ template bool run_tests(int argc, char *argv[]) { argc -= optind; argv += optind; - if (0 == argc) { // run them all + if (0 == argc) { + // run them all return runner.run(""); - } else { - bool wasSuccessful = true; - int i = 0; - while (i < argc) { - std::string test = CLASS::suite()->getName().append("::").append(argv[i++]); - if (debug) - std::cerr << "Running " << test << std::endl; - wasSuccessful = wasSuccessful && runner.run(test); - } - return wasSuccessful; } + + bool wasSuccessful = true; + int i = 0; + while (i < argc) { + std::string test = CLASS::suite()->getName().append("::").append(argv[i++]); + if (debug) + std::cerr << "Running " << test << std::endl; + wasSuccessful = wasSuccessful && runner.run(test); + } + return wasSuccessful; } #endif // HYRAX_GIT_RUN_TESTS_CPPUNIT_H