debug: add CHECK_FINITE assertion
This commit is contained in:
parent
64ea4fb6d4
commit
42ab7543a7
16
debug.hpp
16
debug.hpp
@ -18,6 +18,7 @@
|
|||||||
#define __DEBUG_HPP
|
#define __DEBUG_HPP
|
||||||
|
|
||||||
//#include "maths.hpp" // XXX: See notes at the end of file for maths.hpp inclusion
|
//#include "maths.hpp" // XXX: See notes at the end of file for maths.hpp inclusion
|
||||||
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -288,6 +289,21 @@
|
|||||||
#endif
|
#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 { \
|
#define CHECK_THROWS(E,C) do { \
|
||||||
|
Loading…
Reference in New Issue
Block a user