![]() |
Home | Libraries | People | FAQ | More |
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 two last parameters designate begin and end of the second collection.
Code |
---|
#define BOOST_TEST_MODULE example #include <boost/test/included/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 |
---|
> example Running 1 test case... test.cpp(11): error in "test": check { col1, col1+7 } == { col2, col2+7 } has failed. Mismatch in a position 2: 3 != 4 Mismatch in a position 5: 6 != 7 *** 1 failures is detected in test suite "example" |
See also: