debug: add CHECK_LIMIT

This commit is contained in:
Danny Robson 2015-05-29 15:51:25 +10:00
parent 8e0e65e2b8
commit 043523a794

View File

@ -177,6 +177,26 @@
} while (0)
///////////////////////////////////////////////////////////////////////////////
#define CHECK_LIMIT(VAL,LO,HI) do { \
DEBUG_ONLY( \
const auto __val = (VAL); \
const auto __hi = (HI); \
const auto __lo = (LO); \
\
_CHECK_META (__val >= __lo && __val <= __hi, \
{ ; }, \
{ \
std::ostringstream __os; \
__os << "expected satisifies limit\n" \
<< "__val: " << #VAL << " = " << __val << '\n' \
<< "__lo: " << #LO << " = " << __lo << '\n' \
<< "__hi: " << #HI << " = " << __hi << '\n'; \
panic (__os.str ()); \
}); \
); \
} while (0)
///////////////////////////////////////////////////////////////////////////////
#define CHECK_NEQ(A,B) do { \
DEBUG_ONLY( \