diff --git a/CHANGELOG.md b/CHANGELOG.md index 617c271e..8aad90f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Version 200 * Refactor static_buffer * HTTP tidying * Adjust static_asio lib options in Jamfile +* Add type_traits tests API Changes: diff --git a/test/beast/http/type_traits.cpp b/test/beast/http/type_traits.cpp index e1a507bf..2994bfbc 100644 --- a/test/beast/http/type_traits.cpp +++ b/test/beast/http/type_traits.cpp @@ -11,12 +11,132 @@ #include #include +#include +#include +#include +#include #include namespace boost { namespace beast { namespace http { +// Buffers + +BOOST_STATIC_ASSERT(net::is_const_buffer_sequence::value); + +BOOST_STATIC_ASSERT(std::is_same< + buffers_type, + net::const_buffer>::value); + +BOOST_STATIC_ASSERT(! std::is_same< + buffers_type, + net::mutable_buffer>::value); + +BOOST_STATIC_ASSERT(std::is_convertible< + decltype(*net::buffer_sequence_begin(std::declval())), + net::const_buffer + >::value); + +BOOST_STATIC_ASSERT(! std::is_convertible< + decltype(*net::buffer_sequence_begin(std::declval())), + net::mutable_buffer + >::value); + +BOOST_STATIC_ASSERT(net::is_const_buffer_sequence< + buffers_cat_view + >::value); + +BOOST_STATIC_ASSERT(std::is_same< + buffers_type>, + net::const_buffer>::value); + +BOOST_STATIC_ASSERT(! std::is_same< + buffers_type>, + net::mutable_buffer>::value); + +using bs_t = buffers_suffix>; + +BOOST_STATIC_ASSERT(std::is_same< + buffers_type, + net::const_buffer>::value); + +BOOST_STATIC_ASSERT(! std::is_same< + buffers_type, + net::mutable_buffer>::value); + +BOOST_STATIC_ASSERT(std::is_convertible< + decltype(*std::declval().begin()), + net::const_buffer>::value); + +BOOST_STATIC_ASSERT(! std::is_convertible< + decltype(*std::declval().begin()), + net::mutable_buffer>::value); + +BOOST_STATIC_ASSERT(std::is_same< + buffers_iterator_type, + decltype(std::declval().begin())>::value); + +using iter_t = bs_t::const_iterator; + +BOOST_STATIC_ASSERT(std::is_same< + net::const_buffer, + decltype(std::declval().operator*()) + >::value); + +BOOST_STATIC_ASSERT(! std::is_same< + net::mutable_buffer, + decltype(std::declval().operator*()) + >::value); + +BOOST_STATIC_ASSERT(std::is_constructible< + net::const_buffer, + decltype(std::declval().operator*())>::value); + +BOOST_STATIC_ASSERT(std::is_same< + net::const_buffer, buffers_suffix< + buffers_cat_view + >::const_iterator::value_type>::value); + +BOOST_STATIC_ASSERT(std::is_same< + net::const_buffer, buffers_type< + std::decay>::type + >>::value); + +BOOST_STATIC_ASSERT(std::is_same + >::const_iterator const&>().operator*())>::value); + +BOOST_STATIC_ASSERT(std::is_same + >::const_iterator const&>().operator*())>::value); + +BOOST_STATIC_ASSERT(std::is_same>::writer::field_range, + http::chunk_crlf> >, + http::detail::chunk_size, + net::const_buffer, + http::chunk_crlf, + http::basic_string_body< + char, std::char_traits, + std::allocator>::writer::const_buffers_type, + http::chunk_crlf, + net::const_buffer, + net::const_buffer, + http::chunk_crlf>>::const_iterator const&>( + ).operator*())>::value); + +// Body + BOOST_STATIC_ASSERT(! is_body_writer::value); BOOST_STATIC_ASSERT(is_body_writer::value);