boost_test_macro2.run-fail.cpp 722 B

12345678910111213141516171819202122232425262728
  1. // (C) Copyright Raffi Enficiaud 2014.
  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 boost_test_macro2
  8. #include <boost/test/included/unit_test.hpp>
  9. BOOST_AUTO_TEST_CASE( test_op_precedence )
  10. {
  11. int a = 13, b = 2, c = 12;
  12. // left term of == is expanded in the logs
  13. BOOST_TEST(a % b == c);
  14. // right term of == is not expanded in the logs
  15. BOOST_TEST(a == c % b);
  16. }
  17. BOOST_AUTO_TEST_CASE( test_op_right_associative )
  18. {
  19. int a = 1;
  20. BOOST_TEST(a);
  21. BOOST_TEST(!a);
  22. BOOST_TEST(--a);
  23. }
  24. //]