xtd 0.2.0
Loading...
Searching...
No Matches

◆ is_not_null_

#define is_not_null_ (   ...)

#include <xtd.tunit/include/xtd/tunit/assert.h>

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
messageAn optional user message to display if the assertion fails. This message can be seen in the unit test results.
Remarks
Contains information about current file and current line.
Can be used with xtd::tunit::assert, xtd::tunit::assume and xtd::tunit::valid classes.
Examples
std::string str = "Anything";
std::string* s1 = &str;
std::string* s2 = nullptr;
xtd::tunit::assert::is_not_null_(s1); // test ok.
xtd::tunit::assert::is_not_null_(s2, "User message..."); // test error.
xtd::tunit::assume::is_not_null_(s1); // test ok.
xtd::tunit::assume::is_not_null_(s2, "User message..."); // test error.
xtd::tunit::valid::is_not_null_(s1); // test ok.
xtd::tunit::valid::is_not_null_(s2, "User message..."); // test error.