String comparisons are public interfaces

This commit is contained in:
Vinnie Falco
2017-06-16 09:38:53 -07:00
parent f631e086e3
commit b5306a5712
42 changed files with 176 additions and 198 deletions

View File

@@ -1,3 +1,9 @@
Version 60:
* String comparisons are public interfaces
--------------------------------------------------------------------------------
Version 59:
* Integrated Beast INTERFACE (cmake)

View File

@@ -142,10 +142,10 @@
<colspec colname="e"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="d">
<entry valign="center" namest="a" nameend="e">
<bridgehead renderas="sect2">Core</bridgehead>
</entry>
<entry valign="center" namest="e" nameend="e">
<entry valign="center" namest="f" nameend="f">
<bridgehead renderas="sect2">ZLib</bridgehead>
</entry>
</row>
@@ -169,10 +169,17 @@
<member><link linkend="beast.ref.beast__error_category">error_category</link></member>
<member><link linkend="beast.ref.beast__error_code">error_code</link></member>
<member><link linkend="beast.ref.beast__error_condition">error_condition</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">&nbsp;</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="beast.ref.beast__flat_buffer">flat_buffer</link></member>
<member><link linkend="beast.ref.beast__handler_alloc">handler_alloc</link></member>
<member><link linkend="beast.ref.beast__handler_ptr">handler_ptr</link></member>
<member><link linkend="beast.ref.beast__handler_type">handler_type</link></member>
<member><link linkend="beast.ref.beast__iequal">iequal</link></member>
<member><link linkend="beast.ref.beast__iless">iless</link></member>
<member><link linkend="beast.ref.beast__multi_buffer">multi_buffer</link></member>
<member><link linkend="beast.ref.beast__static_buffer">static_buffer</link></member>
<member><link linkend="beast.ref.beast__static_buffer_n">static_buffer_n</link></member>
@@ -189,6 +196,7 @@
<member><link linkend="beast.ref.beast__buffer_cat">buffer_cat</link></member>
<member><link linkend="beast.ref.beast__buffer_prefix">buffer_prefix</link></member>
<member><link linkend="beast.ref.beast__buffers">buffers</link></member>
<member><link linkend="beast.ref.beast__iequals">iequals</link></member>
<member><link linkend="beast.ref.beast__ostream">ostream</link></member>
<member><link linkend="beast.ref.beast__read_size">read_size</link></member>
<member><link linkend="beast.ref.beast__read_size_or_throw">read_size_or_throw</link></member>

View File

@@ -8,7 +8,7 @@
#ifndef BEAST_EXAMPLE_HTTP_MIME_TYPE_H_INCLUDED
#define BEAST_EXAMPLE_HTTP_MIME_TYPE_H_INCLUDED
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <boost/filesystem/path.hpp>
#include <string>

View File

@@ -11,7 +11,7 @@
#include <beast/core/async_result.hpp>
#include <beast/core/bind_handler.hpp>
#include <beast/core/flat_buffer.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/type_traits.hpp>
#include <beast/websocket/teardown.hpp>
#include <beast/test/fail_counter.hpp>

View File

@@ -28,7 +28,7 @@
#include <beast/core/static_buffer.hpp>
#include <beast/core/static_string.hpp>
#include <beast/core/string_param.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/type_traits.hpp>
#endif

View File

@@ -1,105 +0,0 @@
//
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_DETAIL_CI_CHAR_TRAITS_HPP
#define BEAST_DETAIL_CI_CHAR_TRAITS_HPP
#include <beast/core/string_view.hpp>
#include <boost/range/algorithm/equal.hpp>
namespace beast {
namespace detail {
inline
char
tolower(signed char c)
{
static unsigned char constexpr tab[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
};
return static_cast<char>(
tab[static_cast<unsigned char>(c)]);
}
template<std::size_t N>
inline
string_view
string_helper(const char (&s)[N])
{
return string_view{s, N-1};
}
template<class T>
inline
T const&
string_helper(T const& t)
{
return t;
}
// Case-insensitive less
struct ci_less
{
static bool const is_transparent = true;
template<class S1, class S2>
bool
operator()(S1 const& lhs, S2 const& rhs) const noexcept
{
using std::begin;
using std::end;
auto const s1 = string_helper(lhs);
auto const s2 = string_helper(rhs);
return std::lexicographical_compare(
begin(s1), end(s1), begin(s2), end(s2),
[](char lhs, char rhs)
{
return tolower(lhs) < tolower(rhs);
}
);
}
};
// Case-insensitive equal
struct ci_equal_pred
{
bool
operator()(char c1, char c2) const noexcept
{
return tolower(c1) == tolower(c2);
}
};
// Case-insensitive equal
template<class S1, class S2>
bool
ci_equal(S1 const& lhs, S2 const& rhs)
{
return boost::range::equal(
string_helper(lhs), string_helper(rhs),
ci_equal_pred{});
}
} // detail
} // beast
#endif

View File

@@ -8,7 +8,7 @@
#ifndef BEAST_DETAIL_STATIC_STRING_HPP
#define BEAST_DETAIL_STATIC_STRING_HPP
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <iterator>
#include <type_traits>

View File

@@ -9,7 +9,7 @@
#define BEAST_STATIC_STRING_HPP
#include <beast/config.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/detail/static_string.hpp>
#include <algorithm>
#include <cstdint>

View File

@@ -0,0 +1,104 @@
//
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_STRING_HPP
#define BEAST_STRING_HPP
#include <boost/spirit/home/support/char_encoding/ascii.hpp>
#include <boost/utility/string_ref.hpp>
namespace beast {
/// The type of string view used by the library
using string_view = boost::string_ref;
/// The type of basic string view used by the library
template<class CharT, class Traits>
using basic_string_view =
boost::basic_string_ref<CharT, Traits>;
namespace detail {
template<class = void>
bool
iequals(
beast::string_view const& lhs,
beast::string_view const& rhs)
{
auto n = lhs.size();
if(rhs.size() != n)
return false;
auto p1 = lhs.data();
auto p2 = rhs.data();
using namespace boost::spirit::char_encoding;
while(n--)
if(ascii::tolower(*p1) != ascii::tolower(*p2))
return false;
return true;
}
} // detail
/** Returns `true` if two strings are equal, using a case-insensitive comparison.
The case-comparison operation is defined only for low-ASCII characters.
@param lhs The string on the left side of the equality
@param rhs The string on the right side of the equality
*/
inline
bool
iequals(
beast::string_view const& lhs,
beast::string_view const& rhs)
{
return detail::iequals(lhs, rhs);
}
/** A strictly less predicate for strings, using a case-insensitive comparison.
The case-comparison operation is defined only for low-ASCII characters.
*/
struct iless
{
bool
operator()(
beast::string_view const& lhs,
beast::string_view const& rhs) const
{
using std::begin;
using std::end;
using namespace boost::spirit::char_encoding;
return std::lexicographical_compare(
begin(lhs), end(lhs), begin(rhs), end(rhs),
[](char lhs, char rhs)
{
return ascii::tolower(lhs) < ascii::tolower(rhs);
}
);
}
};
/** A predicate for string equality, using a case-insensitive comparison.
The case-comparison operation is defined only for low-ASCII characters.
*/
struct iequal
{
bool
operator()(
beast::string_view const& lhs,
beast::string_view const& rhs) const
{
return iequals(lhs, rhs);
}
};
} // beast
#endif

View File

@@ -9,7 +9,7 @@
#define BEAST_STRING_PARAM_HPP
#include <beast/config.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/detail/static_ostream.hpp>
#include <beast/core/detail/type_traits.hpp>

View File

@@ -1,25 +0,0 @@
//
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_STRING_VIEW_HPP
#define BEAST_STRING_VIEW_HPP
#include <boost/utility/string_ref.hpp>
namespace beast {
/// The type of string view used by the library
using string_view = boost::string_ref;
/// The type of basic string view used by the library
template<class CharT, class Traits>
using basic_string_view =
boost::basic_string_ref<CharT, Traits>;
} // beast
#endif

View File

@@ -10,7 +10,7 @@
#include <beast/config.hpp>
#include <beast/core/error.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/http/field.hpp>
#include <beast/http/verb.hpp>
#include <beast/http/detail/basic_parser.hpp>

View File

@@ -8,7 +8,7 @@
#ifndef BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP
#define BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/detail/empty_base_optimization.hpp>
#include <cstddef>
#include <iterator>

View File

@@ -8,8 +8,7 @@
#ifndef BEAST_HTTP_DETAIL_BASIC_PARSER_HPP
#define BEAST_HTTP_DETAIL_BASIC_PARSER_HPP
#include <beast/core/string_view.hpp>
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/core/string.hpp>
#include <beast/http/error.hpp>
#include <beast/http/detail/rfc7230.hpp>
#include <boost/version.hpp>

View File

@@ -8,7 +8,7 @@
#ifndef BEAST_HTTP_DETAIL_RFC7230_HPP
#define BEAST_HTTP_DETAIL_RFC7230_HPP
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <iterator>
#include <utility>

View File

@@ -9,7 +9,7 @@
#define BEAST_HTTP_FIELD_HPP
#include <beast/config.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <iosfwd>
namespace beast {

View File

@@ -10,8 +10,7 @@
#include <beast/config.hpp>
#include <beast/core/string_param.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/core/string.hpp>
#include <beast/http/field.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/intrusive/list.hpp>
@@ -94,15 +93,18 @@ public:
value() const;
};
/// A function that compares keys as LessThanComparable
struct key_compare : private beast::detail::ci_less
/** A strictly less predicate for comparing keys, using a case-insensitive comparison.
The case-comparison operation is defined only for low-ASCII characters.
*/
struct key_compare : beast::iless
{
/// Returns `true` if lhs is less than rhs using a strict ordering
template<class String>
bool
operator()(String const& lhs, value_type const& rhs) const
{
return ci_less::operator()(lhs, rhs.name_string());
return iless::operator()(lhs, rhs.name_string());
}
/// Returns `true` if lhs is less than rhs using a strict ordering
@@ -110,15 +112,14 @@ public:
bool
operator()(value_type const& lhs, String const& rhs) const
{
return ci_less::operator()(lhs.name_string(), rhs);
return iless::operator()(lhs.name_string(), rhs);
}
/// Returns `true` if lhs is less than rhs using a strict ordering
bool
operator()(value_type const& lhs, value_type const& rhs) const
{
return ci_less::operator()(
lhs.name_string(), rhs.name_string());
return iless::operator()(lhs.name_string(), rhs.name_string());
}
};
@@ -546,6 +547,7 @@ public:
//
//--------------------------------------------------------------------------
/// Returns a copy of the key comparison function
key_compare
key_comp() const
{

View File

@@ -10,7 +10,6 @@
#include <beast/core/static_string.hpp>
#include <beast/core/type_traits.hpp>
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/core/detail/clamp.hpp>
#include <beast/http/error.hpp>
#include <beast/http/rfc7230.hpp>

View File

@@ -8,7 +8,6 @@
#ifndef BEAST_HTTP_IMPL_FIELD_IPP
#define BEAST_HTTP_IMPL_FIELD_IPP
#include <beast/core/detail/ci_char_traits.hpp>
#include <algorithm>
#include <array>
#include <boost/assert.hpp>
@@ -435,13 +434,13 @@ string_to_field(string_view s)
auto const& v = get_field_strings();
auto const it = std::lower_bound(
v.begin(), v.end(), s,
beast::detail::ci_less{});
beast::iless{});
if(it == v.end())
return field::unknown;
if(! beast::detail::ci_equal(s, *it))
if(! iequals(s, *it))
return field::unknown;
BOOST_ASSERT(beast::detail::ci_equal(s,
to_string(static_cast<field>(it - v.begin()))));
BOOST_ASSERT(iequals(s, to_string(
static_cast<field>(it - v.begin()))));
return static_cast<field>(it - v.begin());
}

View File

@@ -10,7 +10,6 @@
#include <beast/core/buffer_cat.hpp>
#include <beast/core/static_string.hpp>
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/http/verb.hpp>
#include <beast/http/rfc7230.hpp>
#include <beast/http/status.hpp>
@@ -298,7 +297,7 @@ value_type(field name,
, f_(name)
{
//BOOST_ASSERT(name == field::unknown ||
// detail::ci_equal(sname, to_string(name)));
// iequals(sname, to_string(name)));
char* p = reinterpret_cast<char*>(this + 1);
p[off_-2] = ':';
p[off_-1] = ' ';
@@ -585,7 +584,7 @@ insert(field name,
}
auto const last = std::prev(before);
// VFALCO is it worth comparing `field name` first?
if(! beast::detail::ci_equal(sname, last->name_string()))
if(! iequals(sname, last->name_string()))
{
BOOST_ASSERT(count(sname) == 0);
set_.insert_before(before, e);
@@ -779,8 +778,7 @@ has_chunked_impl() const
{
auto cur = it++;
if(it == v.end())
return beast::detail::ci_equal(
*cur, "chunked");
return iequals(*cur, "chunked");
}
}
@@ -925,7 +923,7 @@ set_element(value_type& e)
{
auto it = set_.lower_bound(
e.name_string(), key_compare{});
if(it == set_.end() || ! beast::detail::ci_equal(
if(it == set_.end() || ! iequals(
e.name_string(), it->name_string()))
{
set_.insert_before(it, e);
@@ -941,8 +939,7 @@ set_element(value_type& e)
delete_element(*it);
it = next;
if(it == set_.end() ||
! beast::detail::ci_equal(
e.name_string(), it->name_string()))
! iequals(e.name_string(), it->name_string()))
break;
}
set_.insert_before(it, e);

View File

@@ -9,7 +9,6 @@
#define BEAST_HTTP_IMPL_MESSAGE_IPP
#include <beast/core/error.hpp>
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/core/detail/type_traits.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>

View File

@@ -8,7 +8,6 @@
#ifndef BEAST_HTTP_IMPL_RFC7230_IPP
#define BEAST_HTTP_IMPL_RFC7230_IPP
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/http/detail/rfc7230.hpp>
#include <iterator>
@@ -291,7 +290,7 @@ find(T const& s) ->
return std::find_if(begin(), end(),
[&s](value_type const& v)
{
return beast::detail::ci_equal(s, v.first);
return iequals(s, v.first);
});
}
@@ -537,7 +536,7 @@ exists(T const& s)
return std::find_if(begin(), end(),
[&s](value_type const& v)
{
return beast::detail::ci_equal(s, v);
return iequals(s, v);
}
) != end();
}

View File

@@ -13,7 +13,7 @@
#include <beast/http/verb.hpp>
#include <beast/http/status.hpp>
#include <beast/http/type_traits.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/detail/integer_sequence.hpp>
#include <boost/optional.hpp>
#include <boost/throw_exception.hpp>

View File

@@ -11,7 +11,7 @@
#include <beast/config.hpp>
#include <beast/core/buffer_cat.hpp>
#include <beast/core/consuming_buffers.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/type_traits.hpp>
#include <beast/http/message.hpp>
#include <beast/http/detail/chunk_encode.hpp>

View File

@@ -9,7 +9,7 @@
#define BEAST_HTTP_STATUS_HPP
#include <beast/config.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <iosfwd>
namespace beast {

View File

@@ -9,7 +9,7 @@
#define BEAST_HTTP_STRING_VIEW_BODY
#include <beast/config.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/http/message.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/optional.hpp>

View File

@@ -10,7 +10,7 @@
#include <beast/config.hpp>
#include <beast/core/error.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/type_traits.hpp>
#include <beast/http/detail/type_traits.hpp>
#include <boost/asio/buffer.hpp>

View File

@@ -9,7 +9,7 @@
#define BEAST_HTTP_VERB_HPP
#include <beast/config.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <iosfwd>
namespace beast {

View File

@@ -17,7 +17,7 @@
#include <beast/http/detail/chunk_encode.hpp>
#include <beast/core/error.hpp>
#include <beast/core/async_result.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <boost/variant.hpp>
#include <iosfwd>
#include <limits>

View File

@@ -9,7 +9,7 @@
#define BEAST_WEBSOCKET_DETAIL_HYBI13_HPP
#include <beast/core/static_string.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/detail/base64.hpp>
#include <beast/core/detail/sha1.hpp>
#include <boost/assert.hpp>

View File

@@ -11,7 +11,6 @@
#include <beast/core/error.hpp>
#include <beast/core/consuming_buffers.hpp>
#include <beast/core/read_size.hpp>
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/zlib/deflate_stream.hpp>
#include <beast/zlib/inflate_stream.hpp>
#include <beast/websocket/option.hpp>
@@ -77,16 +76,15 @@ pmd_read(pmd_offer& offer, Fields const& fields)
offer.server_no_context_takeover = false;
offer.client_no_context_takeover = false;
using beast::detail::ci_equal;
http::ext_list list{
fields["Sec-WebSocket-Extensions"]};
for(auto const& ext : list)
{
if(ci_equal(ext.first, "permessage-deflate"))
if(iequals(ext.first, "permessage-deflate"))
{
for(auto const& param : ext.second)
{
if(ci_equal(param.first,
if(iequals(param.first,
"server_max_window_bits"))
{
if(offer.server_max_window_bits != 0)
@@ -114,7 +112,7 @@ pmd_read(pmd_offer& offer, Fields const& fields)
return; // MUST decline
}
}
else if(ci_equal(param.first,
else if(iequals(param.first,
"client_max_window_bits"))
{
if(offer.client_max_window_bits != 0)
@@ -142,7 +140,7 @@ pmd_read(pmd_offer& offer, Fields const& fields)
offer.client_max_window_bits = -1;
}
}
else if(ci_equal(param.first,
else if(iequals(param.first,
"server_no_context_takeover"))
{
if(offer.server_no_context_takeover)
@@ -161,7 +159,7 @@ pmd_read(pmd_offer& offer, Fields const& fields)
}
offer.server_no_context_takeover = true;
}
else if(ci_equal(param.first,
else if(iequals(param.first,
"client_no_context_takeover"))
{
if(offer.client_no_context_takeover)

View File

@@ -10,7 +10,7 @@
#include <beast/config.hpp>
#include <beast/core/static_string.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/http/message.hpp>
#include <array>
#include <cstdint>

View File

@@ -18,7 +18,7 @@
#include <beast/http/detail/type_traits.hpp>
#include <beast/core/async_result.hpp>
#include <beast/core/buffered_read_stream.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/detail/type_traits.hpp>
#include <boost/asio.hpp>
#include <algorithm>

View File

@@ -37,8 +37,8 @@ unit-test core-tests :
core/read_size.cpp
core/static_buffer.cpp
core/static_string.cpp
core/string.cpp
core/string_param.cpp
core/string_view.cpp
core/type_traits.cpp
core/base64.cpp
core/empty_base_optimization.cpp

View File

@@ -32,8 +32,8 @@ add_executable (core-tests
read_size.cpp
static_buffer.cpp
static_string.cpp
string.cpp
string_param.cpp
string_view.cpp
type_traits.cpp
base64.cpp
empty_base_optimization.cpp

View File

@@ -8,7 +8,7 @@
#include <beast/core/flat_buffer.hpp>
#include <beast/core/multi_buffer.hpp>
#include <beast/core/read_size.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/unit_test/suite.hpp>
#include <boost/asio/streambuf.hpp>
#include <algorithm>

View File

@@ -8,7 +8,7 @@
#ifndef BEAST_TEST_BUFFER_TEST_HPP
#define BEAST_TEST_BUFFER_TEST_HPP
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/read_size.hpp>
#include <beast/core/type_traits.hpp>
#include <beast/core/detail/type_traits.hpp>

View File

@@ -12,7 +12,7 @@
#include <beast/core/ostream.hpp>
#include <beast/core/read_size.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/test/test_allocator.hpp>
#include <beast/unit_test/suite.hpp>
#include <boost/lexical_cast.hpp>

View File

@@ -11,7 +11,7 @@
#include "buffer_test.hpp"
#include <beast/core/ostream.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/core/type_traits.hpp>
#include <beast/test/test_allocator.hpp>
#include <beast/unit_test/suite.hpp>

View File

@@ -11,7 +11,7 @@
#include "buffer_test.hpp"
#include <beast/core/ostream.hpp>
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>
#include <beast/unit_test/suite.hpp>
#include <string>

View File

@@ -6,4 +6,4 @@
//
// Test that header file is self-contained.
#include <beast/core/string_view.hpp>
#include <beast/core/string.hpp>

View File

@@ -9,7 +9,6 @@
#include <beast/http/field.hpp>
#include <beast/unit_test/suite.hpp>
#include <boost/lexical_cast.hpp>
namespace beast {
namespace http {
@@ -23,8 +22,7 @@ public:
auto const match =
[&](field f, string_view s)
{
BEAST_EXPECT(
beast::detail::ci_equal(to_string(f), s));
BEAST_EXPECT(iequals(to_string(f), s));
BEAST_EXPECT(string_to_field(s) == f);
};