|
Jon Test
C++ Unit Test Tool. Not for production -- sample code only
|
#include "JonTest/TestFailure.h"
Go to the source code of this file.
Macros | |
| #define | jontest__assert2arg(first, second, message, binaryOperator) |
| Internal compiler function macro to support the assert* macros. | |
| #define | assertFail(message) throw JonTest::TestFailure(__FILE__, __LINE__, (message)) |
| Explicitly fail the current test case with the given message as explanation. | |
| #define | assert(first, message) jontest__assert2arg(first, true, message, ==) |
| Fail this test if (first) is not true with the given message as explanation. | |
| #define | assertTrue(first, message) jontest__assert2arg(first, true, message, ==) |
| Fail this test if (first) is not true with the given message as explanation. | |
| #define | assertFalse(first, message) jontest__assert2arg(first, false, message, ==) |
| Fail this test if (first) is not false with the given message as explanation. | |
| #define | assertNullPtr(first, message) jontest__assert2arg(first, nullptr, message, ==) |
| Fail this test if (first) is not a nullptr with the given message as explanation. | |
| #define | assertValidPtr(first, message) jontest__assert2arg(first, nullptr, message, !=) |
| Fail this test if (first) is nullptr with the given message as explanation. | |
| #define | assertEqual(first, second, message) jontest__assert2arg(first, second, message, ==) |
| Fail this test if (first) is not equal to (second) with the given message as explanation. | |
| #define | assertNotEqual(first, second, message) jontest__assert2arg(first, second, message, !=) |
| Fail this test if (first) is equal to (second) with the given message as explanation. | |
| #define | assertLess(first, second, message) jontest__assert2arg(first, second, message, <) |
| Fail this test if (first) is not less than (second) with the given message as explanation. | |
| #define | assertLessEqual(first, second, message) jontest__assert2arg(first, second, message, <=) |
| Fail this test if (first) is not less than or equal to (second) with the given message as explanation. | |
| #define | assertGreater(first, second, message) jontest__assert2arg(first, second, message, >) |
| Fail this test if (first) is not greater than (second) with the given message as explanation. | |
| #define | assertGreaterEqual(first, second, message) jontest__assert2arg(first, second, message, >=) |
| Fail this test if (first) is not greater than or equal to (second) with the given message as explanation. | |
| #define | assertException(expression, expected, message) |
| Fail this test if (expression) does not throw the expected exception or a derived class exception with the given message as explanation. | |
| #define | EXPECTED_FAILURE(expression, message) assertException(expression, JonTest::TestFailure, message) |
| Fail this test if evaluating (expression) does not result itself in a failed test. | |
| #define assert | ( | first, | |
| message | |||
| ) | jontest__assert2arg(first, true, message, ==) |
Fail this test if (first) is not true with the given message as explanation.
| #define assertEqual | ( | first, | |
| second, | |||
| message | |||
| ) | jontest__assert2arg(first, second, message, ==) |
Fail this test if (first) is not equal to (second) with the given message as explanation.
| #define assertException | ( | expression, | |
| expected, | |||
| message | |||
| ) |
Fail this test if (expression) does not throw the expected exception or a derived class exception with the given message as explanation.
Note: We cannot explicitly wrap expected in parenthesis for safety as it is an operator.
catch(...) to report as "UNKNOWN EXCEPTION" – including throw int(0). | #define assertFail | ( | message | ) | throw JonTest::TestFailure(__FILE__, __LINE__, (message)) |
Explicitly fail the current test case with the given message as explanation.
| #define assertFalse | ( | first, | |
| message | |||
| ) | jontest__assert2arg(first, false, message, ==) |
Fail this test if (first) is not false with the given message as explanation.
| #define assertGreater | ( | first, | |
| second, | |||
| message | |||
| ) | jontest__assert2arg(first, second, message, >) |
| #define assertGreaterEqual | ( | first, | |
| second, | |||
| message | |||
| ) | jontest__assert2arg(first, second, message, >=) |
| #define assertLess | ( | first, | |
| second, | |||
| message | |||
| ) | jontest__assert2arg(first, second, message, <) |
| #define assertLessEqual | ( | first, | |
| second, | |||
| message | |||
| ) | jontest__assert2arg(first, second, message, <=) |
| #define assertNotEqual | ( | first, | |
| second, | |||
| message | |||
| ) | jontest__assert2arg(first, second, message, !=) |
Fail this test if (first) is equal to (second) with the given message as explanation.
| #define assertNullPtr | ( | first, | |
| message | |||
| ) | jontest__assert2arg(first, nullptr, message, ==) |
Fail this test if (first) is not a nullptr with the given message as explanation.
| #define assertTrue | ( | first, | |
| message | |||
| ) | jontest__assert2arg(first, true, message, ==) |
Fail this test if (first) is not true with the given message as explanation.
| #define assertValidPtr | ( | first, | |
| message | |||
| ) | jontest__assert2arg(first, nullptr, message, !=) |
Fail this test if (first) is nullptr with the given message as explanation.
| #define EXPECTED_FAILURE | ( | expression, | |
| message | |||
| ) | assertException(expression, JonTest::TestFailure, message) |
Fail this test if evaluating (expression) does not result itself in a failed test.
If evaluating (expression) does result in a failed test, this test will pass.
| #define jontest__assert2arg | ( | first, | |
| second, | |||
| message, | |||
| binaryOperator | |||
| ) |
Internal compiler function macro to support the assert* macros.
/warn Not for direct usage in testing.
Evaluates first and second once only. Compares precisely according to oper. If the precise oper comparising fails, fails the current test, with the given message as explanation.
Note: We cannot explicitly wrap binaryOperator in parenthesis for safety as it is an operator.