BOOST_CHECK_EQUAL( left, right )

The same as BOOST_CHECK( left == right ). Use this tool to see mismatched values. Note that it most probably bad idea to use this tool to compare floating point values. Use BOOST_CHECK_CLOSE tool instead.

If comparison is successful, 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 <left argument name> == <right argument name> failed [ <left argument value> != <right argument value>]".

The tool's first parameter is the left compared value. Second parameter is the right compared value. Parameters are not required to be of the same type. But there should exist comparison operator for left and right type (this may involve implicit conversions).

Example: test.cpp

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

    return 0;
}

Output:

test.cpp(4) : error in test_main: test i == j failed [2 != 1]

See Also

BOOST_CHECK, BOOST_CHECK_CLOSE