Commit ac142f8d authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Mikaël Salson

unit-tests/testing.h: TEST_TAP_APPROX()

parent 9a186312
......@@ -44,6 +44,18 @@ if (test_results[id] <= TAP_MAX_FAILED) { \
}}}
#define TAP_TEST_APPROX(test, expected, approx, id, msg) { test_nb_executions[id]++; \
if (test_results[id] <= TAP_MAX_FAILED) { \
if ((abs((test) - expected)) > approx) { \
test_results[id]++; \
cerr << "Test " << #test << " failed (" << __FILE__ << ":" << __LINE__ << "): " \
<< " expected " << expected << " +/- " << approx << ", got " << (test) \
<< " " << msg << endl; \
cerr << TAP_ADDITIONAL_INFOS << endl; \
}}}
#define TAP_END_TEST tap_end_test(__FILE__)
inline bool tap_end_test(const char *filename) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment