BOOST_CHECK_EQUAL_COLLECTIONS( left_begin, left_end, right_begin )

This tool is used to perform by element comparison of two (left and right) collections. This tool shows all mismatched elements in a collections. Note though that right collection may have extra elements. This is does not get checked by this tool. You may need to check explicitly that collections have the same size.

If comparisons are successful, the tool produces a confirmation messages (note: to manage what messages appear in the test output stream set the proper log level) in other case it produces an error messages in a form "error in <test case name>: test {<left_begin argument name>,<left_end argument name>} == {<right_begin argument name>,....} failed [ <left mismatching value> != <right mismatching value>]".

The tool's first parameter designate begin of the left collection. The tool's second parameter designate end of the left collection. Last third parameter designate begin of the right collection.

Example: test.cpp

int test_main( int, char* [] ) {
    int col1 [] = { 1, 2, 3, 4, 5, 6, 7 };
    int col2 [] = { 1, 2, 4, 4, 5, 7, 7 };

    BOOST_CHECK_EQUAL_COLLECTIONS( col1, col1+7, col2);
    
    return 0;
}

Output:

test.cpp(4) : error in test_main: test {col1, col1+7} == {col2,...} failed [3 != 4]
test.cpp(4) : error in test_main: test {col1, col1+7} == {col2,...} failed [6 != 7]

See Also

BOOST_CHECK_EQUAL