Add CHECK_GE and CHECK_LE

This commit is contained in:
Danny Robson 2014-02-12 17:05:37 +11:00
parent 7121465c0a
commit db62693535

View File

@ -128,6 +128,23 @@
} while (0) } 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 { \ #define CHECK_GT(A,B) do { \
const auto __a = (A); \ const auto __a = (A); \
const auto __b = (B); \ const auto __b = (B); \
@ -145,6 +162,23 @@
} while (0) } 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 { \ #define CHECK_NEQ(A,B) do { \
const auto __a = (A); \ const auto __a = (A); \
const auto __b = (B); \ const auto __b = (B); \