diff --git a/simgear/misc/test_macros.hxx b/simgear/misc/test_macros.hxx index ee4f5314..4e6e5a94 100644 --- a/simgear/misc/test_macros.hxx +++ b/simgear/misc/test_macros.hxx @@ -1,42 +1,43 @@ - #ifndef SG_MISC_TEST_MACROS_HXX #define SG_MISC_TEST_MACROS_HXX +#include #include // for std::fabs() -#define SG_CHECK_EQUAL(a, b) \ - if ((a) != (b)) { \ - std::cerr << "failed:" << #a << " != " << #b << std::endl; \ - std::cerr << "\tgot:'" << a << "'" << std::endl; \ - std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \ - exit(1); \ - } #define SG_VERIFY(a) \ if (!(a)) { \ - std::cerr << "failed:" << #a << std::endl; \ - std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \ + std::cerr << "failed: " << #a << std::endl; \ + std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \ + exit(1); \ + } + +#define SG_CHECK_EQUAL(a, b) \ + if ((a) != (b)) { \ + std::cerr << "failed: " << #a << " != " << #b << std::endl; \ + std::cerr << "\tgot '" << a << "' and '" << b << "'" << std::endl; \ + std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \ exit(1); \ } #define SG_CHECK_EQUAL_EP(a, b) \ if (std::fabs((a) - (b)) > SG_EPSILON) { \ - std::cerr << "failed with epsilon:" << #a << " != " << #b << std::endl; \ - std::cerr << "\tgot:'" << a << "'" << std::endl; \ - std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \ + std::cerr << "failed with epsilon: " << #a << " != " << #b << std::endl; \ + std::cerr << "\tgot '" << a << "' and '" << b << "'" << std::endl; \ + std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \ exit(1); \ } #define SG_CHECK_EQUAL_EP2(a, b, ep) \ if (std::fabs((a) - (b)) > ep) { \ - std::cerr << "failed with epsilon:" << #a << " != " << #b << std::endl; \ - std::cerr << "\tgot:'" << a << "'" << std::endl; \ - std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \ + std::cerr << "failed with epsilon: " << #a << " != " << #b << std::endl; \ + std::cerr << "\tgot '" << a << "' and '" << b << "'" << std::endl; \ + std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \ exit(1); \ } #define SG_TEST_FAIL(msg) \ - std::cerr << "failure:" << msg; \ + std::cerr << "failure: " << msg; \ exit(1);