]>
git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/test/http/error.cpp
2 // Copyright (c) 2013-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)
8 // Test that header file is self-contained.
9 #include <beast/http/error.hpp>
11 #include <beast/unit_test/suite.hpp>
17 class error_test
: public unit_test::suite
21 check(char const* name
, error ev
)
23 auto const ec
= make_error_code(ev
);
24 BEAST_EXPECT(std::string(ec
.category().name()) == name
);
25 BEAST_EXPECT(! ec
.message().empty());
26 BEAST_EXPECT(std::addressof(ec
.category()) ==
27 std::addressof(detail::get_http_error_category()));
28 BEAST_EXPECT(detail::get_http_error_category().equivalent(
29 static_cast<std::underlying_type
<error
>::type
>(ev
),
30 ec
.category().default_error_condition(
31 static_cast<std::underlying_type
<error
>::type
>(ev
))));
32 BEAST_EXPECT(detail::get_http_error_category().equivalent(
33 ec
, static_cast<std::underlying_type
<error
>::type
>(ev
)));
39 check("http", error::end_of_stream
);
40 check("http", error::partial_message
);
41 check("http", error::buffer_overflow
);
42 check("http", error::bad_line_ending
);
43 check("http", error::bad_method
);
44 check("http", error::bad_path
);
45 check("http", error::bad_version
);
46 check("http", error::bad_status
);
47 check("http", error::bad_reason
);
48 check("http", error::bad_field
);
49 check("http", error::bad_value
);
50 check("http", error::bad_content_length
);
51 check("http", error::bad_transfer_encoding
);
52 check("http", error::bad_chunk
);
56 BEAST_DEFINE_TESTSUITE(error
,http
,beast
);