]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/http/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/http/error.hpp>
13 #include <boost/beast/_experimental/unit_test/suite.hpp>
20 class error_test
: public unit_test::suite
24 check(char const* name
, error ev
)
26 auto const ec
= make_error_code(ev
);
27 auto const& cat
= make_error_code(
28 static_cast<http::error
>(0)).category();
29 BEAST_EXPECT(std::string(ec
.category().name()) == name
);
30 BEAST_EXPECT(! ec
.message().empty());
32 std::addressof(ec
.category()) == std::addressof(cat
));
33 BEAST_EXPECT(cat
.equivalent(
34 static_cast<std::underlying_type
<error
>::type
>(ev
),
35 ec
.category().default_error_condition(
36 static_cast<std::underlying_type
<error
>::type
>(ev
))));
37 BEAST_EXPECT(cat
.equivalent(ec
,
38 static_cast<std::underlying_type
<error
>::type
>(ev
)));
44 check("beast.http", error::end_of_stream
);
45 check("beast.http", error::partial_message
);
46 check("beast.http", error::need_more
);
47 check("beast.http", error::unexpected_body
);
48 check("beast.http", error::need_buffer
);
49 check("beast.http", error::end_of_chunk
);
50 check("beast.http", error::buffer_overflow
);
51 check("beast.http", error::header_limit
);
52 check("beast.http", error::body_limit
);
53 check("beast.http", error::bad_alloc
);
55 check("beast.http", error::bad_line_ending
);
56 check("beast.http", error::bad_method
);
57 check("beast.http", error::bad_target
);
58 check("beast.http", error::bad_version
);
59 check("beast.http", error::bad_status
);
60 check("beast.http", error::bad_reason
);
61 check("beast.http", error::bad_field
);
62 check("beast.http", error::bad_value
);
63 check("beast.http", error::bad_content_length
);
64 check("beast.http", error::bad_transfer_encoding
);
65 check("beast.http", error::bad_chunk
);
66 check("beast.http", error::bad_chunk_extension
);
67 check("beast.http", error::bad_obs_fold
);
69 check("beast.http", error::stale_parser
);
70 check("beast.http", error::short_read
);
74 BEAST_DEFINE_TESTSUITE(beast
,http
,error
);