Ticket #6624: ticket6624.2.patch
File ticket6624.2.patch, 6.8 KB (added by , 11 years ago) |
---|
-
boost/test/tools/impl.hpp
166 166 CHECK_BITWISE_EQUAL, 167 167 CHECK_PRED_WITH_ARGS, 168 168 CHECK_EQUAL_COLL, 169 CHECK_NE_COLL, 169 170 CHECK_BUILT_ASSERTION 170 171 }; 171 172 … … 425 426 426 427 //____________________________________________________________________________// 427 428 429 struct ne_coll_impl { 430 template <typename Left, typename Right> 431 predicate_result operator()( Left left_begin, Left left_end, Right right_begin, Right right_end ) 432 { 433 predicate_result pr( true ); 434 Left left_begin_copy( left_begin ); 435 std::size_t pos = 0; 436 437 for( ; left_begin != left_end && right_begin != right_end; ++left_begin, ++right_begin, ++pos ) { 438 if( *left_begin != *right_begin ) { 439 return pr; 440 } 441 } 442 443 if ( left_begin != left_end || right_begin != right_end ) { 444 return pr; 445 } 446 447 pr = false; 448 pr.message() << "\nCollections have the same size (" << pos << ") and contents:"; 449 450 pos = 0; 451 for ( ; left_begin_copy != left_end; ++left_begin_copy, ++pos ) { 452 pr.message() << '\n' << pos << ": " << *left_begin_copy; 453 } 454 455 return pr; 456 } 457 }; 458 459 //____________________________________________________________________________// 460 428 461 struct bitwise_equal_impl { 429 462 template <class Left, class Right> 430 463 predicate_result operator()( Left const& left, Right const& right ) -
boost/test/impl/test_tools.ipp
Property changes on: boost/test/tools/impl.hpp ___________________________________________________________________ Modified: svn:mime-type - test/plain + text/plain
261 261 break; 262 262 } 263 263 264 case CHECK_NE_COLL: { 265 char const* left_begin_descr = va_arg( args, char const* ); 266 char const* left_end_descr = va_arg( args, char const* ); 267 char const* right_begin_descr = va_arg( args, char const* ); 268 char const* right_end_descr = va_arg( args, char const* ); 269 270 os << prefix << "{ " << left_begin_descr << ", " << left_end_descr << " } != { " 271 << right_begin_descr << ", " << right_end_descr << " }" 272 << suffix; 273 274 if( !pr.has_empty_message() ) 275 os << ". " << pr.message(); 276 break; 277 } 278 264 279 case CHECK_BITWISE_EQUAL: { 265 280 char const* left_descr = va_arg( args, char const* ); 266 281 char const* right_descr = va_arg( args, char const* ); -
boost/test/test_tools.hpp
284 284 285 285 //____________________________________________________________________________// 286 286 287 #define BOOST_WARN_NE_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ 288 BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::ne_coll_impl(), \ 289 "", WARN, CHECK_NE_COLL, (L_begin)(L_end)(R_begin)(R_end), BOOST_PP_EMPTY() ) \ 290 /**/ 291 #define BOOST_CHECK_NE_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ 292 BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::ne_coll_impl(), \ 293 "", CHECK, CHECK_NE_COLL, (L_begin)(L_end)(R_begin)(R_end), BOOST_PP_EMPTY() ) \ 294 /**/ 295 #define BOOST_REQUIRE_NE_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ 296 BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::ne_coll_impl(), \ 297 "", REQUIRE, CHECK_NE_COLL, (L_begin)(L_end)(R_begin)(R_end), BOOST_PP_EMPTY() )\ 298 /**/ 299 300 //____________________________________________________________________________// 301 287 302 #define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ 288 303 ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", WARN, CHECK_BITWISE_EQUAL, (L)(R), BOOST_PP_EMPTY() ) 289 304 #define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ -
libs/test/doc/src/utf.testing-tools.xml
688 688 <para role="first-line-indented"> 689 689 These tools are used to perform an element by element comparison of two collections. They print all mismatched 690 690 positions, collection elements at these positions and check that the collections have the same size. The first two 691 parameters designate begin and end of the first collection. The two parameters designate begin and end of the691 parameters designate begin and end of the first collection. The last two parameters designate begin and end of the 692 692 second collection. 693 693 </para> 694 694 … … 697 697 </btl-example> 698 698 699 699 <seealso> 700 <ref>BOOST_<level>_NE_COLLECTIONS</ref> 700 701 <ref>BOOST_<level>_EQUAL</ref> 701 702 </seealso> 702 703 </refentry> 703 704 705 <refentry name="BOOST_<level>_NE_COLLECTIONS"> 706 <inline-synopsis> 707 <macro name="BOOST_WARN_NE_COLLECTIONS" kind="functionlike" ref-id="utf.testing-tools.reference"> 708 <macro-parameter name="left_begin"/> 709 <macro-parameter name="left_end"/> 710 <macro-parameter name="right_begin"/> 711 <macro-parameter name="right_end"/> 712 </macro> 713 <macro name="BOOST_CHECK_NE_COLLECTIONS" kind="functionlike" ref-id="utf.testing-tools.reference"> 714 <macro-parameter name="left_begin"/> 715 <macro-parameter name="left_end"/> 716 <macro-parameter name="right_begin"/> 717 <macro-parameter name="right_end"/> 718 </macro> 719 <macro name="BOOST_REQUIRE_NE_COLLECTIONS" kind="functionlike" ref-id="utf.testing-tools.reference"> 720 <macro-parameter name="left_begin"/> 721 <macro-parameter name="left_end"/> 722 <macro-parameter name="right_begin"/> 723 <macro-parameter name="right_end"/> 724 </macro> 725 </inline-synopsis> 726 727 <para role="first-line-indented"> 728 These tools are used to perform a comparison of two collections to check that they are not equal. The first two 729 parameters designate begin and end of the first collection. The last two parameters designate begin and end of the 730 second collection. 731 </para> 732 733 <seealso> 734 <ref>BOOST_<level>_EQUAL_COLLECTIONS</ref> 735 <ref>BOOST_<level>_NE</ref> 736 </seealso> 737 </refentry> 738 704 739 <refentry name="BOOST_<level>_EXCEPTION"> 705 740 <inline-synopsis> 706 741 <macro name="BOOST_WARN_EXCEPTION" kind="functionlike" ref-id="utf.testing-tools.reference">