]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/contract/test/public_function/decl_pre_none.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / contract / test / public_function / decl_pre_none.cpp
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 all derived and base classes without preconditions.
8
9 #define BOOST_CONTRACT_TEST_NO_A_PRE
10 #define BOOST_CONTRACT_TEST_NO_B_PRE
11 #define BOOST_CONTRACT_TEST_NO_C_PRE
12 #include "decl.hpp"
13
14 #include <boost/detail/lightweight_test.hpp>
15 #include <sstream>
16
17 int main() {
18 std::ostringstream ok; ok // Test nothing fails.
19 #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
20 << "c::static_inv" << std::endl
21 << "c::inv" << std::endl
22 << "b::static_inv" << std::endl
23 << "b::inv" << std::endl
24 << "a::static_inv" << std::endl
25 << "a::inv" << std::endl
26 #endif
27 // No preconditions here.
28 #ifndef BOOST_CONTRACT_NO_OLDS
29 << "c::f::old" << std::endl
30 << "b::f::old" << std::endl
31 << "a::f::old" << std::endl
32 #endif
33 << "a::f::body" << std::endl
34 #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
35 << "c::static_inv" << std::endl
36 << "c::inv" << std::endl
37 << "b::static_inv" << std::endl
38 << "b::inv" << std::endl
39 << "a::static_inv" << std::endl
40 << "a::inv" << std::endl
41 #endif
42 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
43 << "c::f::old" << std::endl // Old only if post (or except) run.
44 << "c::f::post" << std::endl
45 << "b::f::old" << std::endl
46 << "b::f::post" << std::endl
47 << "a::f::post" << std::endl
48 #endif
49 ;
50
51 a aa;
52
53 a_pre = true;
54 b_pre = true;
55 c_pre = true;
56 out.str("");
57 aa.f();
58 BOOST_TEST(out.eq(ok.str()));
59
60 a_pre = true;
61 b_pre = false;
62 c_pre = false;
63 out.str("");
64 aa.f();
65 BOOST_TEST(out.eq(ok.str()));
66
67 a_pre = false;
68 b_pre = true;
69 c_pre = false;
70 out.str("");
71 aa.f();
72 BOOST_TEST(out.eq(ok.str()));
73
74 a_pre = false;
75 b_pre = false;
76 c_pre = true;
77 out.str("");
78 aa.f();
79 BOOST_TEST(out.eq(ok.str()));
80
81 a_pre = false;
82 b_pre = false;
83 c_pre = false;
84 out.str("");
85 aa.f();
86 BOOST_TEST(out.eq(ok.str()));
87
88 return boost::report_errors();
89 }
90