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