Test macros: add parentheses around arguments
This commit is contained in:
parent
90479419cc
commit
c9bb6102c0
@ -15,7 +15,7 @@
|
||||
#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 << "\tgot '" << (a) << "' and '" << (b) << "'" << std::endl; \
|
||||
std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
exit(1); \
|
||||
}
|
||||
@ -23,15 +23,15 @@
|
||||
#define SG_CHECK_EQUAL_EP(a, b) \
|
||||
if (std::fabs((a) - (b)) > SG_EPSILON) { \
|
||||
std::cerr << "failed: " << #a << " ~= " << #b << std::endl; \
|
||||
std::cerr << "\tgot '" << a << "' and '" << 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) { \
|
||||
if (std::fabs((a) - (b)) > (ep)) { \
|
||||
std::cerr << "failed: " << #a << " ~= " << #b << std::endl; \
|
||||
std::cerr << "\tgot '" << a << "' and '" << b << "'" << std::endl; \
|
||||
std::cerr << "\tgot '" << (a) << "' and '" << (b) << "'" << std::endl; \
|
||||
std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
exit(1); \
|
||||
}
|
||||
@ -39,7 +39,7 @@
|
||||
#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 << "\tgot '" << (a) << "' and '" << (b) << "'" << std::endl; \
|
||||
std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
exit(1); \
|
||||
}
|
||||
@ -47,7 +47,7 @@
|
||||
#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 << "\tgot '" << (a) << "' and '" << (b) << "'" << std::endl; \
|
||||
std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
exit(1); \
|
||||
}
|
||||
@ -55,7 +55,7 @@
|
||||
#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 << "\tgot '" << (a) << "' and '" << (b) << "'" << std::endl; \
|
||||
std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
exit(1); \
|
||||
}
|
||||
@ -63,7 +63,7 @@
|
||||
#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 << "\tgot '" << (a) << "' and '" << (b) << "'" << std::endl; \
|
||||
std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
exit(1); \
|
||||
}
|
||||
@ -71,7 +71,7 @@
|
||||
#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 << "\tgot '" << (a) << "' and '" << (b) << "'" << std::endl; \
|
||||
std::cerr << "\tat " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
exit(1); \
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user