BOOST_WARN_MESSAGE( predicate, message )
BOOST_CHECK_MESSAGE( predicate, message )
BOOST_REQUIRE_MESSAGE( predicate, message )

This group of tools works the same way as their non _MESSAGE form. The only difference is that instead of generating an error/confirm message these tools use the supplied one.

The tool's first parameter should be boolean predicate value that gets validated. The tool's second parameter is the message logged in case of check failure. The message argument can be of any type and can be a result of concatenations using the operator <<(). See BOOST_MESSAGE tool for complex message examples.

Example: test.cpp

int test.cpp( int, char* [] ) {
    double res = sin( 45 );

    BOOST_CHECK_MESSAGE( res > 3, "Why not?!?!" );

    return 0;
}

Output:

test.cpp(3) : error in test_main: Why not?!?!

See Also

BOOST_CHECK, BOOST_WARN, BOOST_REQUIRE, BOOST_MESSAGE