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