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 an element by element comparison of two collections. They print all mismatched positions, collection elements at these positions and check that the collections have the same size.

The first two parameters designate begin and end of the first collection. The next two parameters designate begin and end of the second collection.

Example: test.cpp

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( test ) { 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 ); }

Output:

Running 1 test case...
test.cpp(9): error in "test": check { col1, col1+7 } == { col2, col2+7 } failed.
Mismatch in a position 2: 3 != 4
Mismatch in a position 5: 6 != 7

*** 1 failure detected in test suite "Master Test Suite"

See Also

BOOST_CHECK_EQUAL