ZeroErr
|
Assertion library provided a list of marcos and functions for you to check condition in both your source code and unit testing code.
A basic assertion marco is in one the following format:
CHECK(<expr> [, <message>, <args>...])
or
CHECK(<expr> OP <expr> [, <message>, <args>...]) which OP could be one of the ==
, !=
, <
, >
, <=
, >=
or
CHECK(<cond> OP <cond> [, <message>, <args>...]) which OP could be AND
/OR
, <cond> could be an <expr>
or <expr> OP <expr>
To reduce the complexity of parsing the expression and improve performance, we also provided a list of old style marcos:
==
!=
<
>
<=
>=
There are 3 levels of assertion marcos, you can replace CHECK to REQUIRE or ASSERT:
CHECK_NOT, REQUIRE_NOT, and ASSERT_NOT will check the condition which is expected not true.
CHECK_THROWS, REQUIRE_THROWS, and ASSERT_THROWS will expect the expression will throw an exception.