Files
UltraGrid/test/unit_common.h
Martin Pulec 4c114d0b33 unify test API for old and new tests
return int -1 if test failed; 0 if succeeded; 1 if not applicable (but
not failed)

As the old and new tests are mostly compatible now, do not take
different approach handling both groups.
2023-03-07 16:04:36 +01:00

23 lines
736 B
C++

#include <iostream>
#define ASSERT(expr) if (!(expr)) { \
std::cerr << "Assertion " << #expr << " failed!" << "\n"; \
return -1; \
}
#define ASSERT_MESSAGE(msg, expr) if (!(expr)) { \
std::cerr << "Assertion " << #expr << " failed: " << (msg) << "\n"; \
return -1; \
}
#define ASSERT_EQUAL(expected, actual) if ((expected) != (actual)) { \
std::cerr << "Assertion failed - expected " << (expected) << ", actual : " << (actual) << "\n"; \
return -1; \
}
#define ASSERT_EQUAL_MESSAGE(msg, expected, actual) if ((expected) != (actual)) { \
std::cerr << "Assertion failed - expected " << (expected) << ", actual : " << (actual) << ": " << (msg) << "\n"; \
return -1; \
}