debug: add CHECK_FINITE assertion

This commit is contained in:
Danny Robson 2018-04-13 18:49:36 +10:00
parent 64ea4fb6d4
commit 42ab7543a7

View File

@ -18,6 +18,7 @@
#define __DEBUG_HPP
//#include "maths.hpp" // XXX: See notes at the end of file for maths.hpp inclusion
#include <cmath>
#include <algorithm>
#include <stdexcept>
#include <string>
@ -288,6 +289,21 @@
#endif
#if !defined(NDEBUG)
#define CHECK_FINITE(V) do { \
const auto &__v = (V); \
if (!std::isfinite (__v)) { \
_CHECK_PANIC ("expected finite value\n" \
"__v: %! is %!", \
#V, __v); \
} \
} while (0)
#else
#define CHECK_FINITE(V,...)
#endif
///////////////////////////////////////////////////////////////////////////////
#define CHECK_THROWS(E,C) do { \