example18.run-fail.cpp 731 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. struct F {
  10. F() : i( 0 ) { BOOST_TEST_MESSAGE( "setup fixture" ); }
  11. ~F() { BOOST_TEST_MESSAGE( "teardown fixture" ); }
  12. int i;
  13. };
  14. BOOST_FIXTURE_TEST_CASE( test_case1, F )
  15. {
  16. BOOST_TEST( i == 1 );
  17. ++i;
  18. }
  19. BOOST_FIXTURE_TEST_CASE( test_case2, F )
  20. {
  21. BOOST_CHECK_EQUAL( i, 1 );
  22. }
  23. BOOST_AUTO_TEST_CASE( test_case3 )
  24. {
  25. BOOST_TEST( true );
  26. }
  27. //]