example31.run-fail.cpp 852 B

12345678910111213141516171819202122232425262728293031323334
  1. // (C) Copyright Gennadiy Rozental 2011-2015.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //[example_code
  7. #define BOOST_TEST_MODULE example
  8. #include <boost/test/included/unit_test.hpp>
  9. boost::test_tools::predicate_result
  10. compare_lists( std::list<int> const& l1, std::list<int> const& l2 )
  11. {
  12. if( l1.size() != l2.size() )
  13. {
  14. boost::test_tools::predicate_result res( false );
  15. res.message() << "Different sizes [" << l1.size() << "!=" << l2.size() << "]";
  16. return res;
  17. }
  18. return true;
  19. }
  20. BOOST_AUTO_TEST_CASE( test_list_comparison )
  21. {
  22. std::list<int> l1, l2;
  23. l1.push_back( 1 );
  24. l1.push_back( 2 );
  25. BOOST_TEST( compare_lists( l1, l2 ) );
  26. }
  27. //]