Use buffers_to_string in tests

fix #782
This commit is contained in:
Vinnie Falco
2018-04-24 10:55:39 -07:00
parent 5abac8b380
commit 14392d7f52
21 changed files with 164 additions and 281 deletions
+3 -15
View File
@@ -13,6 +13,7 @@
#include <boost/beast/http.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
#include <boost/beast/core/buffers_to_string.hpp>
#include <boost/beast/core/ostream.hpp>
#include <boost/beast/core/flat_buffer.hpp>
#include <boost/beast/core/multi_buffer.hpp>
@@ -37,19 +38,6 @@ public:
corpus cres_;
std::size_t size_ = 0;
template<class ConstBufferSequence>
static
std::string
to_string(ConstBufferSequence const& bs)
{
std::string s;
s.reserve(buffer_size(bs));
for(auto b : beast::detail::buffers_range(bs))
s.append(reinterpret_cast<char const*>(b.data()),
b.size());
return s;
}
corpus
build_corpus(std::size_t n, std::true_type)
{
@@ -121,7 +109,7 @@ public:
error_code ec;
p.write(b.data(), ec);
if(! BEAST_EXPECTS(! ec, ec.message()))
log << to_string(b.data()) << std::endl;
log << buffers_to_string(b.data()) << std::endl;
}
}
@@ -137,7 +125,7 @@ public:
error_code ec;
feed(b.data(), p, ec);
if(! BEAST_EXPECTS(! ec, ec.message()))
log << to_string(b.data()) << std::endl;
log << buffers_to_string(b.data()) << std::endl;
}
}