diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-04 15:38:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-04 15:38:52 +0300 |
commit | d0da3a7489670a202901ac32ca6e4bffb16d485b (patch) | |
tree | 77a04d9e7f318a171eb51289f82e16975c17e93d /src/utils/checkutils_unittest.cc | |
parent | 972a7923355b87f7570bae37306d9ec8121c86da (diff) | |
download | manaverse-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.gz manaverse-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.bz2 manaverse-d0da3a7489670a202901ac32ca6e4bffb16d485b.tar.xz manaverse-d0da3a7489670a202901ac32ca6e4bffb16d485b.zip |
Add macroses returnFalseV, returnTrueV, returnFalse, returnTrue.
Diffstat (limited to 'src/utils/checkutils_unittest.cc')
-rw-r--r-- | src/utils/checkutils_unittest.cc | 59 |
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); } |