]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/contract/test/specify/old_post.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / contract / test / specify / old_post.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 specifying old and post, no pre or except (same if not free func).
8
9 #include "../detail/oteststream.hpp"
10 #include <boost/contract/function.hpp>
11 #include <boost/contract/check.hpp>
12 #include <boost/detail/lightweight_test.hpp>
13 #include <sstream>
14
15 boost::contract::test::detail::oteststream out;
16
17 void f() {
18 boost::contract::check c = boost::contract::function()
19 .old([] { out << "f::old" << std::endl; })
20 .postcondition([] { out << "f::post" << std::endl; })
21 ;
22 out << "f::body" << std::endl;
23 }
24
25 int main() {
26 std::ostringstream ok;
27
28 out.str("");
29 f();
30 ok.str("");
31 ok
32 #ifndef BOOST_CONTRACT_NO_OLDS
33 << "f::old" << std::endl
34 #endif
35 << "f::body" << std::endl
36 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
37 << "f::post" << std::endl
38 #endif
39 ;
40 BOOST_TEST(out.eq(ok.str()));
41
42 return boost::report_errors();
43 }
44