From 4c41439a2e84799246f0a1334a8ee35bed45b499 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 5 Feb 2015 20:35:11 +1100 Subject: [PATCH] debug: add CHECK_NEZ --- debug.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/debug.hpp b/debug.hpp index b0a260e2..2e90f6cf 100644 --- a/debug.hpp +++ b/debug.hpp @@ -199,6 +199,23 @@ } 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 { \ DEBUG_ONLY( \