Add test macros: SG_CHECK_NE, SG_CHECK_LT, SG_CHECK_LE, SG_CHECK_GT, SG_CHECK_GE
This commit is contained in:
parent
b4178ae888
commit
90479419cc
@ -36,6 +36,46 @@
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
#define SG_CHECK_NE(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_LT(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_LE(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_GT(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_GE(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_TEST_FAIL(msg) \
|
||||
std::cerr << "failure: " << msg; \
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user