]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/websocket/error.cpp
2 // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
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)
7 // Official repository: https://github.com/boostorg/beast
10 // Test that header file is self-contained.
11 #include <boost/beast/websocket/error.hpp>
13 #include <boost/beast/unit_test/suite.hpp>
20 class error_test
: public unit_test::suite
23 void check(char const* name
, error ev
)
25 auto const ec
= make_error_code(ev
);
26 BEAST_EXPECT(std::string
{ec
.category().name()} == name
);
27 BEAST_EXPECT(! ec
.message().empty());
28 BEAST_EXPECT(std::addressof(ec
.category()) ==
29 std::addressof(detail::get_error_category()));
30 BEAST_EXPECT(detail::get_error_category().equivalent(
31 static_cast<std::underlying_type
<error
>::type
>(ev
),
32 ec
.category().default_error_condition(
33 static_cast<std::underlying_type
<error
>::type
>(ev
))));
34 BEAST_EXPECT(detail::get_error_category().equivalent(
35 ec
, static_cast<std::underlying_type
<error
>::type
>(ev
)));
40 check("boost.beast.websocket", error::closed
);
41 check("boost.beast.websocket", error::failed
);
42 check("boost.beast.websocket", error::handshake_failed
);
43 check("boost.beast.websocket", error::buffer_overflow
);
44 check("boost.beast.websocket", error::partial_deflate_block
);
48 BEAST_DEFINE_TESTSUITE(beast
,websocket
,error
);