From 972a7923355b87f7570bae37306d9ec8121c86da Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 3 May 2016 00:22:11 +0300 Subject: Add functions failFalse and failTrue and tests. --- src/utils/checkutils.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/utils/checkutils.cpp') diff --git a/src/utils/checkutils.cpp b/src/utils/checkutils.cpp index 4953314e1..3161c8f46 100644 --- a/src/utils/checkutils.cpp +++ b/src/utils/checkutils.cpp @@ -52,6 +52,34 @@ bool reportTrueReal(const bool val, return val; } +bool failFalseReal(const bool val, + const char *const text, + const char *const file, + const unsigned line, + const char *const func) +{ + if (!val) + { + reportStack(file, line, func, "Detected false value", text); + throw new std::exception; + } + return val; +} + +bool failTrueReal(const bool val, + const char *const text, + const char *const file, + const unsigned line, + const char *const func) +{ + if (val) + { + reportStack(file, line, func, "Detected true value", text); + throw new std::exception; + } + return val; +} + void reportStack(const char *const file, const unsigned int line, const char *const func, -- cgit v1.2.3-60-g2f50