Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Test Assertions

Assertion Levels
BOOST_level_BITWISE_EQUAL
BOOST_level_CLOSE
BOOST_level_CLOSE_FRACTION
BOOST_level_EQUAL
BOOST_level_EQUAL_COLLECTIONS
BOOST_level_EXCEPTION
BOOST_FAIL
BOOST_level_GE
BOOST_level_GT
BOOST_level_LE
BOOST_level_LT
BOOST_level_MESSAGE
BOOST_level_NE
BOOST_level_NO_THROW
BOOST_level_PREDICATE
BOOST_level_SMALL
BOOST_level_THROW
BOOST_TEST_DONT_PRINT_LOG_VALUE

Assertions are used to validate the result of exercising the system under test. When an assertion fails, a diagnostic message is created and the failed assertion is recorded. Different assertion levels allow you to control how a failed assertion is interpreted by the test runner.

[Important] Important

When an assertion involves a user-defined datatype, a stream insertion operator (operator<<) must be defined for the user-defined datatype, or the assertion will fail to compile. Asserting a comparison operation on a value of a user-defined type will require the appropriate comparison operator (operator<, operator==, etc.) be defiend for the type or the assertion will fail to compile. The need to define operator<< can be eliminated by using BOOST_TEST_DONT_PRINT_LOG_VALUE.

The minimal header test framework does not provide the facilities described here.


PrevUpHomeNext