]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/contract/test/constructor/decl_exit_static_inv_none.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / contract / test / constructor / decl_exit_static_inv_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 exit static invariants.
8
9 #define BOOST_CONTRACT_TEST_NO_A_STATIC_INV
10 #define BOOST_CONTRACT_TEST_NO_B_STATIC_INV
11 #define BOOST_CONTRACT_TEST_NO_C_STATIC_INV
12 #include "decl.hpp"
13
14 #include <boost/preprocessor/control/iif.hpp>
15 #include <boost/detail/lightweight_test.hpp>
16 #include <sstream>
17
18 int main() {
19 std::ostringstream ok; ok // Test nothing fails.
20 #ifndef BOOST_CONTRACT_NO_PRECONDITIONS
21 << "a::ctor::pre" << std::endl
22 << "b::ctor::pre" << std::endl
23 << "c::ctor::pre" << std::endl
24 #endif
25
26 #ifndef BOOST_CONTRACT_NO_OLDS
27 << "c::ctor::old" << std::endl
28 #endif
29 << "c::ctor::body" << std::endl
30 #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
31 << "c::inv" << std::endl
32 #endif
33 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
34 << "c::ctor::post" << std::endl
35 #endif
36
37 #ifndef BOOST_CONTRACT_NO_OLDS
38 << "b::ctor::old" << std::endl
39 #endif
40 << "b::ctor::body" << std::endl
41 #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
42 << "b::inv" << std::endl
43 #endif
44 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
45 << "b::ctor::post" << std::endl
46 #endif
47
48 #ifndef BOOST_CONTRACT_NO_OLDS
49 << "a::ctor::old" << std::endl
50 #endif
51 << "a::ctor::body" << std::endl
52 #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
53 << "a::inv" << std::endl
54 #endif
55 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
56 << "a::ctor::post" << std::endl
57 #endif
58 ;
59
60 #ifdef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
61 #define BOOST_CONTRACT_TEST_entry_inv 0
62 #else
63 #define BOOST_CONTRACT_TEST_entry_inv 1
64 #endif
65
66 a_exit_static_inv = true;
67 b_exit_static_inv = true;
68 c_exit_static_inv = true;
69 a_entering_static_inv = b_entering_static_inv = c_entering_static_inv =
70 BOOST_PP_IIF(BOOST_CONTRACT_TEST_entry_inv, true, false);
71 {
72 out.str("");
73 a aa;
74 BOOST_TEST(out.eq(ok.str()));
75 }
76
77 a_exit_static_inv = false;
78 b_exit_static_inv = true;
79 c_exit_static_inv = true;
80 a_entering_static_inv = b_entering_static_inv = c_entering_static_inv =
81 BOOST_PP_IIF(BOOST_CONTRACT_TEST_entry_inv, true, false);
82 {
83 out.str("");
84 a aa;
85 BOOST_TEST(out.eq(ok.str()));
86 }
87
88 a_exit_static_inv = true;
89 b_exit_static_inv = false;
90 c_exit_static_inv = true;
91 a_entering_static_inv = b_entering_static_inv = c_entering_static_inv =
92 BOOST_PP_IIF(BOOST_CONTRACT_TEST_entry_inv, true, false);
93 {
94 out.str("");
95 a aa;
96 BOOST_TEST(out.eq(ok.str()));
97 }
98
99 a_exit_static_inv = true;
100 b_exit_static_inv = true;
101 c_exit_static_inv = false;
102 a_entering_static_inv = b_entering_static_inv = c_entering_static_inv =
103 BOOST_PP_IIF(BOOST_CONTRACT_TEST_entry_inv, true, false);
104 {
105 out.str("");
106 a aa;
107 BOOST_TEST(out.eq(ok.str()));
108 }
109
110 a_exit_static_inv = false;
111 b_exit_static_inv = false;
112 c_exit_static_inv = false;
113 a_entering_static_inv = b_entering_static_inv = c_entering_static_inv =
114 BOOST_PP_IIF(BOOST_CONTRACT_TEST_entry_inv, true, false);
115 {
116 out.str("");
117 a aa;
118 BOOST_TEST(out.eq(ok.str()));
119 }
120
121 return boost::report_errors();
122 }
123