]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/http/type_traits.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/type_traits.hpp>
13 #include <boost/beast/http/empty_body.hpp>
14 #include <boost/beast/http/string_body.hpp>
15 #include <boost/beast/core/buffer_traits.hpp>
16 #include <boost/beast/core/buffers_cat.hpp>
17 #include <boost/beast/core/buffers_suffix.hpp>
26 BOOST_STATIC_ASSERT(net::is_const_buffer_sequence
<chunk_crlf
>::value
);
28 BOOST_STATIC_ASSERT(std::is_same
<
29 buffers_type
<chunk_crlf
>,
30 net::const_buffer
>::value
);
32 BOOST_STATIC_ASSERT(! std::is_same
<
33 buffers_type
<chunk_crlf
>,
34 net::mutable_buffer
>::value
);
36 BOOST_STATIC_ASSERT(std::is_convertible
<
37 decltype(*net::buffer_sequence_begin(std::declval
<chunk_crlf
const&>())),
41 BOOST_STATIC_ASSERT(! std::is_convertible
<
42 decltype(*net::buffer_sequence_begin(std::declval
<chunk_crlf
const&>())),
46 BOOST_STATIC_ASSERT(net::is_const_buffer_sequence
<
47 buffers_cat_view
<net::const_buffer
, chunk_crlf
>
50 BOOST_STATIC_ASSERT(std::is_same
<
51 buffers_type
<buffers_cat_view
<net::const_buffer
, chunk_crlf
>>,
52 net::const_buffer
>::value
);
54 BOOST_STATIC_ASSERT(! std::is_same
<
55 buffers_type
<buffers_cat_view
<net::const_buffer
, chunk_crlf
>>,
56 net::mutable_buffer
>::value
);
58 using bs_t
= buffers_suffix
<buffers_cat_view
<net::const_buffer
, chunk_crlf
>>;
60 BOOST_STATIC_ASSERT(std::is_same
<
62 net::const_buffer
>::value
);
64 BOOST_STATIC_ASSERT(! std::is_same
<
66 net::mutable_buffer
>::value
);
68 BOOST_STATIC_ASSERT(std::is_convertible
<
69 decltype(*std::declval
<bs_t
const&>().begin()),
70 net::const_buffer
>::value
);
72 BOOST_STATIC_ASSERT(! std::is_convertible
<
73 decltype(*std::declval
<bs_t
const&>().begin()),
74 net::mutable_buffer
>::value
);
76 BOOST_STATIC_ASSERT(std::is_same
<
77 buffers_iterator_type
<bs_t
>,
78 decltype(std::declval
<bs_t
const&>().begin())>::value
);
80 using iter_t
= bs_t::const_iterator
;
82 BOOST_STATIC_ASSERT(std::is_same
<
84 decltype(std::declval
<iter_t
const&>().operator*())
87 BOOST_STATIC_ASSERT(! std::is_same
<
89 decltype(std::declval
<iter_t
const&>().operator*())
92 BOOST_STATIC_ASSERT(std::is_constructible
<
94 decltype(std::declval
<iter_t
const&>().operator*())>::value
);
96 BOOST_STATIC_ASSERT(std::is_same
<
97 net::const_buffer
, buffers_suffix
<
98 buffers_cat_view
<net::const_buffer
, net::const_buffer
, chunk_crlf
>
99 >::const_iterator::value_type
>::value
);
101 BOOST_STATIC_ASSERT(std::is_same
<
102 net::const_buffer
, buffers_type
<
103 std::decay
<buffers_cat_view
<net::const_buffer
, net::const_buffer
, chunk_crlf
>>::type
106 BOOST_STATIC_ASSERT(std::is_same
<net::const_buffer
, decltype(
107 std::declval
<buffers_suffix
<buffers_cat_view
<
108 net::const_buffer
, net::const_buffer
, chunk_crlf
>
109 >::const_iterator
const&>().operator*())>::value
);
111 BOOST_STATIC_ASSERT(std::is_same
<net::const_buffer
, decltype(
112 std::declval
<buffers_suffix
<buffers_cat_view
<
113 net::const_buffer
, net::const_buffer
, chunk_crlf
>
114 >::const_iterator
const&>().operator*())>::value
);
116 BOOST_STATIC_ASSERT(std::is_same
<net::const_buffer
, decltype(
117 std::declval
<buffers_suffix
<
119 beast::detail::buffers_ref
<buffers_cat_view
<
124 std::allocator
<char>>::writer::field_range
,
126 http::detail::chunk_size
,
129 http::basic_string_body
<
130 char, std::char_traits
<char>,
131 std::allocator
<char>>::writer::const_buffers_type
,
135 http::chunk_crlf
>>::const_iterator
const&>(
136 ).operator*())>::value
);
140 BOOST_STATIC_ASSERT(! is_body_writer
<int>::value
);
142 BOOST_STATIC_ASSERT(is_body_writer
<empty_body
>::value
);
144 BOOST_STATIC_ASSERT(! is_body_reader
<std::string
>::value
);
148 struct not_fields
{};
152 BOOST_STATIC_ASSERT(! is_fields
<not_fields
>::value
);