summaryrefslogtreecommitdiff
path: root/src/utils/checkutils_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-04 15:38:52 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-04 15:38:52 +0300
commitd0da3a7489670a202901ac32ca6e4bffb16d485b (patch)
tree77a04d9e7f318a171eb51289f82e16975c17e93d /src/utils/checkutils_unittest.cc
parent972a7923355b87f7570bae37306d9ec8121c86da (diff)
downloadplus-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.gz
plus-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.bz2
plus-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.xz
plus-d0da3a7489670a202901ac32ca6e4bffb16d485b.zip
Add macroses returnFalseV, returnTrueV, returnFalse, returnTrue.
Diffstat (limited to 'src/utils/checkutils_unittest.cc')
-rw-r--r--src/utils/checkutils_unittest.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/utils/checkutils_unittest.cc b/src/utils/checkutils_unittest.cc
index a9b2db798..4cce96725 100644
--- a/src/utils/checkutils_unittest.cc
+++ b/src/utils/checkutils_unittest.cc
@@ -27,6 +27,37 @@
#include "debug.h"
+namespace
+{
+ bool flag = false;
+} // namespace
+
+static void testReturnFalseV(const bool val)
+{
+ flag = false;
+ returnFalseV(val);
+ flag = true;
+}
+
+static void testReturnTrueV(const bool val)
+{
+ flag = false;
+ returnTrueV(val);
+ flag = true;
+}
+
+static int testReturnFalse(const bool val)
+{
+ returnFalse(0, val);
+ return 1;
+}
+
+static int testReturnTrue(const bool val)
+{
+ returnTrue(0, val);
+ return 1;
+}
+
TEST_CASE("CheckUtils")
{
logger = new Logger;
@@ -55,5 +86,33 @@ TEST_CASE("CheckUtils")
REQUIRE_THROWS(failTrue(true) == true);
}
+ SECTION("returnFalseV")
+ {
+ testReturnFalseV(false);
+ REQUIRE(flag == false);
+ testReturnFalseV(true);
+ REQUIRE(flag == true);
+ }
+
+ SECTION("returnTrueV")
+ {
+ testReturnTrueV(false);
+ REQUIRE(flag == true);
+ testReturnTrueV(true);
+ REQUIRE(flag == false);
+ }
+
+ SECTION("returnFalse")
+ {
+ REQUIRE(testReturnFalse(false) == 0);
+ REQUIRE(testReturnFalse(true) == 1);
+ }
+
+ SECTION("returnTrue")
+ {
+ REQUIRE(testReturnTrue(false) == 1);
+ REQUIRE(testReturnTrue(true) == 0);
+ }
+
delete2(logger);
}