BOOST_WARN( predicate )
BOOST_CHECK( predicate )
BOOST_REQUIRE( predicate )

These tools are used to validate the predicate value. The only parameter for these tools is a boolean predicate value that gets validated. It could be any expression that could be evaluated and converted to boolean value. The expression gets evaluated only once, so it's safe to pass complex expression for validation.

Example: test.cpp

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( test ) { int i=2; BOOST_WARN( sizeof(int) == sizeof(short) ); BOOST_CHECK( i == 1 ); BOOST_REQUIRE( i > 5 ); BOOST_CHECK( i == 6 ); // will never reach this check }

Output:

Running 1 test case...
test.cpp(7): warning in "test": condition sizeof(int) == sizeof(short) is not satisfied
test.cpp(8): error in "test": check i == 1 failed
test.cpp(9): fatal error in "test": critical check i > 5 failed

*** 2 failures detected in test suite "Master Test Suite"

See Also

BOOST_CHECK_MESSAGE