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 // Test without preconditions. 8 9 #define BOOST_CONTRACT_TEST_NO_F_PRE 10 #include "decl.hpp" 11 12 #include <boost/detail/lightweight_test.hpp> 13 #include <sstream> 14 main()15int main() { 16 std::ostringstream ok; ok // Test nothing fails. 17 #ifndef BOOST_CONTRACT_NO_OLDS 18 << "f::old" << std::endl 19 #endif 20 << "f::body" << std::endl 21 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS 22 << "f::post" << std::endl 23 #endif 24 ; 25 26 f_pre = true; 27 out.str(""); 28 f(); 29 BOOST_TEST(out.eq(ok.str())); 30 31 f_pre = false; 32 out.str(""); 33 f(); 34 BOOST_TEST(out.eq(ok.str())); 35 36 return boost::report_errors(); 37 } 38 39