BOOST_CHECK( predicate )

This tool is used to validate the predicate value.

If predicate value is true, the tool produces a confirmation message (note: to manage what messages appear in the test output stream set the proper log level) in other case it produces an error message in a form "error in <test case name>: test <predicate> failed".

The only parameter of this tool is the boolean predicate value that gets validated. This 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

int test_main( int, char* [] ) {
    int i=2;
    BOOST_CHECK( i == 1 );

    return 0;
}

Output:

test.cpp(3) : error in test_main: test i==1 failed

See Also

BOOST_CHECK_MESSAGE