lib_x.cpp 955 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (C) 2008-2018 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0 (see accompanying
  3. // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
  4. // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
  5. // Force .cpp never check post/except.
  6. #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
  7. #error "build must define NO_POSTCONDITIONS"
  8. #endif
  9. #ifndef BOOST_CONTRACT_NO_EXCEPTS
  10. #error "build must define NO_EXCEPTS"
  11. #endif
  12. #define BOOST_CONTRACT_TEST_LIB_X_SOURCE
  13. #include "lib_x.hpp"
  14. #include <boost/contract.hpp> // All headers so test ODR for entire lib.
  15. #include "../detail/out_inlined.hpp"
  16. void x() {
  17. using boost::contract::test::detail::out;
  18. boost::contract::check c = boost::contract::function()
  19. .precondition([] { out("x::pre\n"); })
  20. .old([] { out("x::old\n"); })
  21. .postcondition([] { out("x::post\n"); })
  22. ;
  23. out("x::body\n");
  24. }