BOOST_WARN_EQUAL_COLLECTIONS( left_begin, left_end, right_begin, right_end )
BOOST_CHECK_EQUAL_COLLECTIONS( left_begin, left_end, right_begin, right_end )
BOOST_REQUIRE_EQUAL_COLLECTIONS( left_begin, left_end, right_begin, right_end )

These tools are used to perform by element comparison of two (left and right) collections. They show all mismatched elements in a collections (if any) and check that the collections have the same size.

The first two parameters designate begin and end of the left collection. The second two parameters designate begin and end 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, col2+7 );
    
    return 0;
}

Output:

test.cpp(4) : error in test_main: check {col1, col1+7} == {col2,col2+77} failed
Mismatch in a position 2: 4 != 3
Mismatch in a position 5: 7 != 6

See Also

BOOST_CHECK_EQUAL