]>
Commit | Line | Data |
---|---|---|
b32b8144 | 1 | // |
92f5a8d4 | 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) |
b32b8144 FG |
3 | // |
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) | |
6 | // | |
7 | // Official repository: https://github.com/boostorg/beast | |
8 | // | |
9 | ||
10 | // Test that header file is self-contained. | |
11 | #include <boost/beast/http/type_traits.hpp> | |
12 | ||
13 | #include <boost/beast/http/empty_body.hpp> | |
92f5a8d4 TL |
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> | |
b32b8144 FG |
18 | #include <string> |
19 | ||
20 | namespace boost { | |
21 | namespace beast { | |
22 | namespace http { | |
23 | ||
92f5a8d4 TL |
24 | // Buffers |
25 | ||
26 | BOOST_STATIC_ASSERT(net::is_const_buffer_sequence<chunk_crlf>::value); | |
27 | ||
28 | BOOST_STATIC_ASSERT(std::is_same< | |
29 | buffers_type<chunk_crlf>, | |
30 | net::const_buffer>::value); | |
31 | ||
32 | BOOST_STATIC_ASSERT(! std::is_same< | |
33 | buffers_type<chunk_crlf>, | |
34 | net::mutable_buffer>::value); | |
35 | ||
36 | BOOST_STATIC_ASSERT(std::is_convertible< | |
37 | decltype(*net::buffer_sequence_begin(std::declval<chunk_crlf const&>())), | |
38 | net::const_buffer | |
39 | >::value); | |
40 | ||
41 | BOOST_STATIC_ASSERT(! std::is_convertible< | |
42 | decltype(*net::buffer_sequence_begin(std::declval<chunk_crlf const&>())), | |
43 | net::mutable_buffer | |
44 | >::value); | |
45 | ||
46 | BOOST_STATIC_ASSERT(net::is_const_buffer_sequence< | |
47 | buffers_cat_view<net::const_buffer, chunk_crlf> | |
48 | >::value); | |
49 | ||
50 | BOOST_STATIC_ASSERT(std::is_same< | |
51 | buffers_type<buffers_cat_view<net::const_buffer, chunk_crlf>>, | |
52 | net::const_buffer>::value); | |
53 | ||
54 | BOOST_STATIC_ASSERT(! std::is_same< | |
55 | buffers_type<buffers_cat_view<net::const_buffer, chunk_crlf>>, | |
56 | net::mutable_buffer>::value); | |
57 | ||
58 | using bs_t = buffers_suffix<buffers_cat_view<net::const_buffer, chunk_crlf>>; | |
59 | ||
60 | BOOST_STATIC_ASSERT(std::is_same< | |
61 | buffers_type<bs_t>, | |
62 | net::const_buffer>::value); | |
63 | ||
64 | BOOST_STATIC_ASSERT(! std::is_same< | |
65 | buffers_type<bs_t>, | |
66 | net::mutable_buffer>::value); | |
67 | ||
68 | BOOST_STATIC_ASSERT(std::is_convertible< | |
69 | decltype(*std::declval<bs_t const&>().begin()), | |
70 | net::const_buffer>::value); | |
71 | ||
72 | BOOST_STATIC_ASSERT(! std::is_convertible< | |
73 | decltype(*std::declval<bs_t const&>().begin()), | |
74 | net::mutable_buffer>::value); | |
75 | ||
76 | BOOST_STATIC_ASSERT(std::is_same< | |
77 | buffers_iterator_type<bs_t>, | |
78 | decltype(std::declval<bs_t const&>().begin())>::value); | |
79 | ||
80 | using iter_t = bs_t::const_iterator; | |
81 | ||
82 | BOOST_STATIC_ASSERT(std::is_same< | |
83 | net::const_buffer, | |
84 | decltype(std::declval<iter_t const&>().operator*()) | |
85 | >::value); | |
86 | ||
87 | BOOST_STATIC_ASSERT(! std::is_same< | |
88 | net::mutable_buffer, | |
89 | decltype(std::declval<iter_t const&>().operator*()) | |
90 | >::value); | |
91 | ||
92 | BOOST_STATIC_ASSERT(std::is_constructible< | |
93 | net::const_buffer, | |
94 | decltype(std::declval<iter_t const&>().operator*())>::value); | |
95 | ||
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); | |
100 | ||
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 | |
104 | >>::value); | |
105 | ||
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); | |
110 | ||
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); | |
115 | ||
116 | BOOST_STATIC_ASSERT(std::is_same<net::const_buffer, decltype( | |
117 | std::declval<buffers_suffix< | |
118 | buffers_cat_view< | |
119 | beast::detail::buffers_ref<buffers_cat_view< | |
120 | net::const_buffer, | |
121 | net::const_buffer, | |
122 | net::const_buffer, | |
123 | http::basic_fields< | |
124 | std::allocator<char>>::writer::field_range, | |
125 | http::chunk_crlf> >, | |
126 | http::detail::chunk_size, | |
127 | net::const_buffer, | |
128 | http::chunk_crlf, | |
129 | http::basic_string_body< | |
130 | char, std::char_traits<char>, | |
131 | std::allocator<char>>::writer::const_buffers_type, | |
132 | http::chunk_crlf, | |
133 | net::const_buffer, | |
134 | net::const_buffer, | |
135 | http::chunk_crlf>>::const_iterator const&>( | |
136 | ).operator*())>::value); | |
137 | ||
138 | // Body | |
139 | ||
b32b8144 FG |
140 | BOOST_STATIC_ASSERT(! is_body_writer<int>::value); |
141 | ||
142 | BOOST_STATIC_ASSERT(is_body_writer<empty_body>::value); | |
143 | ||
144 | BOOST_STATIC_ASSERT(! is_body_reader<std::string>::value); | |
145 | ||
146 | namespace { | |
147 | ||
148 | struct not_fields {}; | |
149 | ||
150 | } // (anonymous) | |
151 | ||
152 | BOOST_STATIC_ASSERT(! is_fields<not_fields>::value); | |
153 | ||
154 | } // http | |
155 | } // beast | |
156 | } // boost |