summaryrefslogtreecommitdiff
path: root/src/utils/checkutils_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-04 22:46:17 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-04 22:46:17 +0300
commitb0227c5cbf0dada9fc46ade54686da369629de5e (patch)
tree133cc32e9fa8582d9e819c2c6ffb924c7f1e3a02 /src/utils/checkutils_unittest.cc
parentbf9c58df65f48416dd7ae02cae96228ab6bec6d4 (diff)
downloadmanaverse-b0227c5cbf0dada9fc46ade54686da369629de5e.tar.gz
manaverse-b0227c5cbf0dada9fc46ade54686da369629de5e.tar.bz2
manaverse-b0227c5cbf0dada9fc46ade54686da369629de5e.tar.xz
manaverse-b0227c5cbf0dada9fc46ade54686da369629de5e.zip
Add macroses returnNullptr and returnNullptrV
Diffstat (limited to 'src/utils/checkutils_unittest.cc')
-rw-r--r--src/utils/checkutils_unittest.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils/checkutils_unittest.cc b/src/utils/checkutils_unittest.cc
index 4cce96725..981e08f72 100644
--- a/src/utils/checkutils_unittest.cc
+++ b/src/utils/checkutils_unittest.cc
@@ -58,6 +58,19 @@ static int testReturnTrue(const bool val)
return 1;
}
+static int testReturnNullptr(void *val)
+{
+ returnNullptr(0, val);
+ return 1;
+}
+
+static void testReturnNullptrV(void *val)
+{
+ flag = false;
+ returnNullptrV(val);
+ flag = true;
+}
+
TEST_CASE("CheckUtils")
{
logger = new Logger;
@@ -114,5 +127,19 @@ TEST_CASE("CheckUtils")
REQUIRE(testReturnTrue(true) == 0);
}
+ SECTION("returnNullptr")
+ {
+ REQUIRE(testReturnNullptr(nullptr) == 0);
+ REQUIRE(testReturnNullptr((void*)1) == 1);
+ }
+
+ SECTION("returnNullptrV")
+ {
+ testReturnNullptrV(nullptr);
+ REQUIRE(flag == false);
+ testReturnNullptrV((void*)1);
+ REQUIRE(flag == true);
+ }
+
delete2(logger);
}