Add CHECK_GE and CHECK_LE
This commit is contained in:
parent
7121465c0a
commit
db62693535
34
debug.hpp
34
debug.hpp
@ -128,6 +128,23 @@
|
||||
} while (0)
|
||||
|
||||
|
||||
#define CHECK_LE(A,B) do { \
|
||||
const auto __a = (A); \
|
||||
const auto __b = (B); \
|
||||
_CHECK_META (__a <= __b, \
|
||||
{ ; }, \
|
||||
{ \
|
||||
std::ostringstream __debug_check_lt_os; \
|
||||
__debug_check_lt_os \
|
||||
<< "expected less or equal to\n" \
|
||||
<< "__a: " << #A << " is " << __a << ")" \
|
||||
<< "\n > \n" \
|
||||
<< "__b: " << #B << " is " << __b << ")"; \
|
||||
panic (__debug_check_lt_os.str ()); \
|
||||
}); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define CHECK_GT(A,B) do { \
|
||||
const auto __a = (A); \
|
||||
const auto __b = (B); \
|
||||
@ -145,6 +162,23 @@
|
||||
} while (0)
|
||||
|
||||
|
||||
#define CHECK_GE(A,B) do { \
|
||||
const auto __a = (A); \
|
||||
const auto __b = (B); \
|
||||
_CHECK_META (__a >= __b, \
|
||||
{ ; }, \
|
||||
{ \
|
||||
std::ostringstream __debug_check_gt_os; \
|
||||
__debug_check_gt_os \
|
||||
<< "expected greater or equal to.\n" \
|
||||
<< "__a: " << #A << " is " << __a << ")" \
|
||||
<< "\n < \n" \
|
||||
<< "__b: " << #B << " is " << __b << ")"; \
|
||||
panic (__debug_check_gt_os.str ()); \
|
||||
}); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define CHECK_NEQ(A,B) do { \
|
||||
const auto __a = (A); \
|
||||
const auto __b = (B); \
|
||||
|
Loading…
Reference in New Issue
Block a user