Jon Test
C++ Unit Test Tool. Not for production -- sample code only
Loading...
Searching...
No Matches
assertPtr_test.cpp

Actual test of assertNullPtr(), assertValidPtr().

Actual test of assertNullPtr(), assertValidPtr().

#include "JonTest/Assert.h"
TEST_SUITE(AssertPtr)
TEST_CASE(assertNullPtr_test)
{
assertNullPtr(nullptr, "nullptr should never fail");
EXPECTED_FAILURE(assertNullPtr(this, "this should fail"), "verifies false failed");
}
TEST_CASE(assertValidPtr_test)
{
assertValidPtr(this, "this should never fail");
EXPECTED_FAILURE(assertValidPtr(nullptr, "nullptr should fail"), "verifies true failed");
}
#define assertNullPtr(first, message)
Fail this test if (first) is not a nullptr with the given message as explanation.
Definition Assert.h:39
#define EXPECTED_FAILURE(expression, message)
Fail this test if evaluating (expression) does not result itself in a failed test.
Definition Assert.h:83
#define assertValidPtr(first, message)
Fail this test if (first) is nullptr with the given message as explanation.
Definition Assert.h:42
#define TEST_SUITE_END()
Finish definition of a Test Suite started with TEST_SUITE().
Definition TestSuite.h:77
#define TEST_CASE(testCaseName)
Defines a Test Case method named testCaseName within a Test Suite defined by TEST_SUITE().
Definition TestSuite.h:91
#define TEST_SUITE(testSuiteName)
Defines a Test Suite named testSuiteName.
Definition TestSuite.h:63