Index: boost/test/tools/impl.hpp =================================================================== --- boost/test/tools/impl.hpp (revision 77128) +++ boost/test/tools/impl.hpp (working copy) @@ -166,6 +166,7 @@ CHECK_BITWISE_EQUAL, CHECK_PRED_WITH_ARGS, CHECK_EQUAL_COLL, + CHECK_NE_COLL, CHECK_BUILT_ASSERTION }; @@ -425,6 +426,38 @@ //____________________________________________________________________________// +struct ne_coll_impl { + template + predicate_result operator()( Left left_begin, Left left_end, Right right_begin, Right right_end ) + { + predicate_result pr( true ); + Left left_begin_copy( left_begin ); + std::size_t pos = 0; + + for( ; left_begin != left_end && right_begin != right_end; ++left_begin, ++right_begin, ++pos ) { + if( *left_begin != *right_begin ) { + return pr; + } + } + + if ( left_begin != left_end || right_begin != right_end ) { + return pr; + } + + pr = false; + pr.message() << "\nCollections have the same size (" << pos << ") and contents:"; + + pos = 0; + for ( ; left_begin_copy != left_end; ++left_begin_copy, ++pos ) { + pr.message() << '\n' << pos << ": " << *left_begin_copy; + } + + return pr; + } +}; + +//____________________________________________________________________________// + struct bitwise_equal_impl { template predicate_result operator()( Left const& left, Right const& right ) Property changes on: boost/test/tools/impl.hpp ___________________________________________________________________ Modified: svn:mime-type - test/plain + text/plain Index: boost/test/impl/test_tools.ipp =================================================================== --- boost/test/impl/test_tools.ipp (revision 77128) +++ boost/test/impl/test_tools.ipp (working copy) @@ -261,6 +261,21 @@ break; } + case CHECK_NE_COLL: { + char const* left_begin_descr = va_arg( args, char const* ); + char const* left_end_descr = va_arg( args, char const* ); + char const* right_begin_descr = va_arg( args, char const* ); + char const* right_end_descr = va_arg( args, char const* ); + + os << prefix << "{ " << left_begin_descr << ", " << left_end_descr << " } != { " + << right_begin_descr << ", " << right_end_descr << " }" + << suffix; + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + } + case CHECK_BITWISE_EQUAL: { char const* left_descr = va_arg( args, char const* ); char const* right_descr = va_arg( args, char const* ); Index: boost/test/test_tools.hpp =================================================================== --- boost/test/test_tools.hpp (revision 77128) +++ boost/test/test_tools.hpp (working copy) @@ -284,6 +284,21 @@ //____________________________________________________________________________// +#define BOOST_WARN_NE_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::ne_coll_impl(), \ + "", WARN, CHECK_NE_COLL, (L_begin)(L_end)(R_begin)(R_end), BOOST_PP_EMPTY() ) \ +/**/ +#define BOOST_CHECK_NE_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::ne_coll_impl(), \ + "", CHECK, CHECK_NE_COLL, (L_begin)(L_end)(R_begin)(R_end), BOOST_PP_EMPTY() ) \ +/**/ +#define BOOST_REQUIRE_NE_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::ne_coll_impl(), \ + "", REQUIRE, CHECK_NE_COLL, (L_begin)(L_end)(R_begin)(R_end), BOOST_PP_EMPTY() )\ +/**/ + +//____________________________________________________________________________// + #define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", WARN, CHECK_BITWISE_EQUAL, (L)(R), BOOST_PP_EMPTY() ) #define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ Index: libs/test/doc/src/utf.testing-tools.xml =================================================================== --- libs/test/doc/src/utf.testing-tools.xml (revision 77128) +++ libs/test/doc/src/utf.testing-tools.xml (working copy) @@ -688,7 +688,7 @@ 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 parameters designate begin and end of the + parameters designate begin and end of the first collection. The last two parameters designate begin and end of the second collection. @@ -697,10 +697,45 @@ + BOOST_<level>_NE_COLLECTIONS BOOST_<level>_EQUAL + + + + + + + + + + + + + + + + + + + + + + + + These tools are used to perform a comparison of two collections to check that they are not equal. The first two + parameters designate begin and end of the first collection. The last two parameters designate begin and end of the + second collection. + + + + BOOST_<level>_EQUAL_COLLECTIONS + BOOST_<level>_NE + + +