]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/websocket/error.cpp
2 // Copyright (c) 2016-2019 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/_experimental/unit_test/suite.hpp>
20 class error_test
: public unit_test::suite
25 auto const ec
= make_error_code(e
);
27 BEAST_EXPECT(! ec
.message().empty());
28 BEAST_EXPECT(ec
!= condition::handshake_failed
);
29 BEAST_EXPECT(ec
!= condition::protocol_violation
);
32 void check(condition c
, error e
)
34 auto const ec
= make_error_code(e
);
35 BEAST_EXPECT(ec
.category().name() != nullptr);
36 BEAST_EXPECT(! ec
.message().empty());
37 BEAST_EXPECT(ec
== c
);
43 check(error::buffer_overflow
);
44 check(error::partial_deflate_block
);
45 check(error::message_too_big
);
47 check(condition::protocol_violation
, error::bad_opcode
);
48 check(condition::protocol_violation
, error::bad_data_frame
);
49 check(condition::protocol_violation
, error::bad_continuation
);
50 check(condition::protocol_violation
, error::bad_reserved_bits
);
51 check(condition::protocol_violation
, error::bad_control_fragment
);
52 check(condition::protocol_violation
, error::bad_control_size
);
53 check(condition::protocol_violation
, error::bad_unmasked_frame
);
54 check(condition::protocol_violation
, error::bad_masked_frame
);
55 check(condition::protocol_violation
, error::bad_size
);
56 check(condition::protocol_violation
, error::bad_frame_payload
);
57 check(condition::protocol_violation
, error::bad_close_code
);
58 check(condition::protocol_violation
, error::bad_close_size
);
59 check(condition::protocol_violation
, error::bad_close_payload
);
61 check(condition::handshake_failed
, error::bad_http_version
);
62 check(condition::handshake_failed
, error::bad_method
);
63 check(condition::handshake_failed
, error::no_host
);
64 check(condition::handshake_failed
, error::no_connection
);
65 check(condition::handshake_failed
, error::no_connection_upgrade
);
66 check(condition::handshake_failed
, error::no_upgrade
);
67 check(condition::handshake_failed
, error::no_upgrade_websocket
);
68 check(condition::handshake_failed
, error::no_sec_key
);
69 check(condition::handshake_failed
, error::bad_sec_key
);
70 check(condition::handshake_failed
, error::no_sec_version
);
71 check(condition::handshake_failed
, error::bad_sec_version
);
72 check(condition::handshake_failed
, error::no_sec_accept
);
73 check(condition::handshake_failed
, error::bad_sec_accept
);
74 check(condition::handshake_failed
, error::upgrade_declined
);
78 BEAST_DEFINE_TESTSUITE(beast
,websocket
,error
);