CppUnit project page | FAQ |
Macros | |
#define | CPPUNIT_ASSERT(condition) |
Assertions that a condition is true . | |
#define | CPPUNIT_ASSERT_MESSAGE(message, condition) |
Assertion with a user specified message. | |
#define | CPPUNIT_FAIL(message) |
Fails with the specified message. | |
#define | CPPUNIT_ASSERT_EQUAL(expected, actual) |
Asserts that two values are equals. | |
#define | CPPUNIT_ASSERT_EQUAL_MESSAGE(message, expected, actual) |
Asserts that two values are equals, provides additional message on failure. | |
#define | CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, delta) |
Macro for primitive double value comparisons.The assertion pass if both expected and actual are finite and fabs ( expected - actual ) <= delta . If either expected or actual are infinite (+/- inf), the assertion pass if expected == actual . If either expected or actual is a NaN (not a number), then the assertion fails. | |
#define | CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(message, expected, actual, delta) |
Macro for primitive double value comparisons, setting a user-supplied message in case of failure. | |
#define | CPPUNIT_ASSERT_THROW(expression, ExceptionType) |
Asserts that the given expression throws an exception of the specified type. | |
#define | CPPUNIT_ASSERT_THROW_MESSAGE(message, expression, ExceptionType) |
Asserts that the given expression throws an exception of the specified type, setting a user supplied message in case of failure. | |
#define | CPPUNIT_ASSERT_NO_THROW(expression) |
Asserts that the given expression does not throw any exceptions. | |
#define | CPPUNIT_ASSERT_NO_THROW_MESSAGE(message, expression) |
Asserts that the given expression does not throw any exceptions, setting a user supplied message in case of failure. | |
#define | CPPUNIT_ASSERT_ASSERTION_FAIL(assertion) CPPUNIT_ASSERT_THROW( assertion, CPPUNIT_NS::Exception ) |
Asserts that an assertion fail. | |
#define | CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE(message, assertion) CPPUNIT_ASSERT_THROW_MESSAGE( message, assertion, CPPUNIT_NS::Exception ) |
Asserts that an assertion fail, with a user-supplied message in case of error. | |
#define | CPPUNIT_ASSERT_ASSERTION_PASS(assertion) CPPUNIT_ASSERT_NO_THROW( assertion ) |
Asserts that an assertion pass. | |
#define | CPPUNIT_ASSERT_ASSERTION_PASS_MESSAGE(message, assertion) CPPUNIT_ASSERT_NO_THROW_MESSAGE( message, assertion ) |
Asserts that an assertion pass, with a user-supplied message in case of failure. |
#define CPPUNIT_ASSERT | ( | condition | ) |
Assertions that a condition is true
.
#define CPPUNIT_ASSERT_ASSERTION_FAIL | ( | assertion | ) | CPPUNIT_ASSERT_THROW( assertion, CPPUNIT_NS::Exception ) |
Asserts that an assertion fail.
Use to test assertions. Example of usage:
#define CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE | ( | message, | |
assertion | |||
) | CPPUNIT_ASSERT_THROW_MESSAGE( message, assertion, CPPUNIT_NS::Exception ) |
Asserts that an assertion fail, with a user-supplied message in case of error.
Use to test assertions. Example of usage:
#define CPPUNIT_ASSERT_ASSERTION_PASS | ( | assertion | ) | CPPUNIT_ASSERT_NO_THROW( assertion ) |
Asserts that an assertion pass.
Use to test assertions. Example of usage:
#define CPPUNIT_ASSERT_ASSERTION_PASS_MESSAGE | ( | message, | |
assertion | |||
) | CPPUNIT_ASSERT_NO_THROW_MESSAGE( message, assertion ) |
Asserts that an assertion pass, with a user-supplied message in case of failure.
Use to test assertions. Example of usage:
#define CPPUNIT_ASSERT_DOUBLES_EQUAL | ( | expected, | |
actual, | |||
delta | |||
) |
Macro for primitive double value comparisons.The assertion pass if both expected and actual are finite and fabs
( expected
- actual
) <= delta
. If either expected
or actual are infinite (+/- inf), the assertion pass if expected
== actual
. If either expected
or actual
is a NaN (not a number), then the assertion fails.
#define CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE | ( | message, | |
expected, | |||
actual, | |||
delta | |||
) |
Macro for primitive double value comparisons, setting a user-supplied message in case of failure.
#define CPPUNIT_ASSERT_EQUAL | ( | expected, | |
actual | |||
) |
Asserts that two values are equals.
Equality and string representation can be defined with an appropriate CppUnit::assertion_traits class.
A diagnostic is printed if actual and expected values disagree.
Requirement for expected and actual parameters:
The last two requirements (serialization and comparison) can be removed by specializing the CppUnit::assertion_traits.
#define CPPUNIT_ASSERT_EQUAL_MESSAGE | ( | message, | |
expected, | |||
actual | |||
) |
Asserts that two values are equals, provides additional message on failure.
Equality and string representation can be defined with an appropriate assertion_traits class.
A diagnostic is printed if actual and expected values disagree. The message is printed in addition to the expected and actual value to provide additional information.
Requirement for expected and actual parameters:
The last two requirements (serialization and comparison) can be removed by specializing the CppUnit::assertion_traits.
#define CPPUNIT_ASSERT_MESSAGE | ( | message, | |
condition | |||
) |
Assertion with a user specified message.
message | Message reported in diagnostic if condition evaluates to false . |
condition | If this condition evaluates to false then the test failed. |
#define CPPUNIT_ASSERT_NO_THROW | ( | expression | ) |
Asserts that the given expression does not throw any exceptions.
Example of usage:
#define CPPUNIT_ASSERT_NO_THROW_MESSAGE | ( | message, | |
expression | |||
) |
Asserts that the given expression does not throw any exceptions, setting a user supplied message in case of failure.
Example of usage:
#define CPPUNIT_ASSERT_THROW | ( | expression, | |
ExceptionType | |||
) |
Asserts that the given expression throws an exception of the specified type.
Example of usage:
#define CPPUNIT_ASSERT_THROW_MESSAGE | ( | message, | |
expression, | |||
ExceptionType | |||
) |
Asserts that the given expression throws an exception of the specified type, setting a user supplied message in case of failure.
Example of usage:
#define CPPUNIT_FAIL | ( | message | ) |
Fails with the specified message.
message | Message reported in diagnostic. |
Send comments to: CppUnit Developers |