summaryrefslogtreecommitdiff
path: root/src/utils/checkutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-03 00:22:11 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-03 00:22:11 +0300
commit972a7923355b87f7570bae37306d9ec8121c86da (patch)
tree332cac6474d3c33c8e032d21b32f293b69921a5d /src/utils/checkutils.cpp
parent9ffe81e93fe8561d01a4985e565d2f9664431338 (diff)
downloadmanaplus-972a7923355b87f7570bae37306d9ec8121c86da.tar.gz
manaplus-972a7923355b87f7570bae37306d9ec8121c86da.tar.bz2
manaplus-972a7923355b87f7570bae37306d9ec8121c86da.tar.xz
manaplus-972a7923355b87f7570bae37306d9ec8121c86da.zip
Add functions failFalse and failTrue and tests.
Diffstat (limited to 'src/utils/checkutils.cpp')
-rw-r--r--src/utils/checkutils.cpp28
1 files changed, 28 insertions, 0 deletions
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,