]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/core/error.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / beast / test / beast / core / error.cpp
1 //
2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/beast
8 //
9
10 // Test that header file is self-contained.
11 #include <boost/beast/core/error.hpp>
12
13 #include <boost/beast/_experimental/unit_test/suite.hpp>
14 #include <memory>
15
16 namespace boost {
17 namespace beast {
18
19 class error_test : public unit_test::suite
20 {
21 public:
22 // no condition
23 void check(error e)
24 {
25 auto const ec = make_error_code(e);
26 ec.category().name();
27 BEAST_EXPECT(! ec.message().empty());
28 }
29
30 void check(condition c, error e)
31 {
32 {
33 auto const ec = make_error_code(e);
34 BEAST_EXPECT(ec.category().name() != nullptr);
35 BEAST_EXPECT(! ec.message().empty());
36 BEAST_EXPECT(ec == c);
37 }
38 {
39 auto ec = make_error_condition(c);
40 BEAST_EXPECT(ec.category().name() != nullptr);
41 BEAST_EXPECT(! ec.message().empty());
42 BEAST_EXPECT(ec == c);
43 }
44 }
45
46 void run() override
47 {
48 check(condition::timeout, error::timeout);
49 }
50 };
51
52 BEAST_DEFINE_TESTSUITE(beast,core,error);
53
54 } // beast
55 } // boost