debug: add CHECK_NEZ

This commit is contained in:
Danny Robson 2015-02-05 20:35:11 +11:00
parent 169bc5f62b
commit 4c41439a2e

View File

@ -199,6 +199,23 @@
} while (0) } while (0)
///////////////////////////////////////////////////////////////////////////////
#define CHECK_NEZ(A) do { \
DEBUG_ONLY( \
const auto __a = (A); \
_CHECK_META (!almost_zero (__a), \
{ ; }, \
{ \
std::ostringstream __debug_nez_os; \
__debug_nez_os << "unexpected zero.\n" \
<< "__a: " << #A << " is " << __a << ")"; \
panic (__debug_nez_os.str ()); \
}); \
); \
} while (0)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define CHECK_THROWS(E,C) do { \ #define CHECK_THROWS(E,C) do { \
DEBUG_ONLY( \ DEBUG_ONLY( \