forked from boostorg/beast
Boost prep
This commit is contained in:
+30
-27
@@ -4,19 +4,22 @@
|
||||
// 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)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/http/chunk_encode.hpp>
|
||||
#include <boost/beast/http/chunk_encode.hpp>
|
||||
|
||||
#include "message_fuzz.hpp"
|
||||
|
||||
#include <beast/core/static_string.hpp>
|
||||
#include <beast/http/fields.hpp>
|
||||
#include <beast/test/fuzz.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/static_string.hpp>
|
||||
#include <boost/beast/http/fields.hpp>
|
||||
#include <boost/beast/test/fuzz.hpp>
|
||||
#include <boost/beast/unit_test/suite.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <random>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
@@ -51,11 +54,11 @@ public:
|
||||
check(string_view match, Args&&... args)
|
||||
{
|
||||
T t{std::forward<Args>(args)...};
|
||||
BEAST_EXPECT(to_string(t) == match);
|
||||
BOOST_BEAST_EXPECT(to_string(t) == match);
|
||||
T t2{t};
|
||||
BEAST_EXPECT(to_string(t2) == match);
|
||||
BOOST_BEAST_EXPECT(to_string(t2) == match);
|
||||
T t3{std::move(t2)};
|
||||
BEAST_EXPECT(to_string(t3) == match);
|
||||
BOOST_BEAST_EXPECT(to_string(t3) == match);
|
||||
}
|
||||
|
||||
template<class T, class... Args>
|
||||
@@ -63,11 +66,11 @@ public:
|
||||
check_fwd(string_view match, Args&&... args)
|
||||
{
|
||||
T t{std::forward<Args>(args)...};
|
||||
BEAST_EXPECT(to_string(t) == match);
|
||||
BOOST_BEAST_EXPECT(to_string(t) == match);
|
||||
T t2{t};
|
||||
BEAST_EXPECT(to_string(t2) == match);
|
||||
BOOST_BEAST_EXPECT(to_string(t2) == match);
|
||||
T t3{std::move(t2)};
|
||||
BEAST_EXPECT(to_string(t3) == match);
|
||||
BOOST_BEAST_EXPECT(to_string(t3) == match);
|
||||
}
|
||||
|
||||
using cb_t = boost::asio::const_buffers_1;
|
||||
@@ -217,20 +220,20 @@ public:
|
||||
};
|
||||
chunk_extensions ce;
|
||||
ce.insert("x");
|
||||
BEAST_EXPECT(ce.str() == ";x");
|
||||
BEAST_EXPECT(str(ce) == "x,");
|
||||
BOOST_BEAST_EXPECT(ce.str() == ";x");
|
||||
BOOST_BEAST_EXPECT(str(ce) == "x,");
|
||||
ce.insert("y", "z");
|
||||
BEAST_EXPECT(ce.str() == ";x;y=z");
|
||||
BEAST_EXPECT(str(ce) == "x,y,z,");
|
||||
BOOST_BEAST_EXPECT(ce.str() == ";x;y=z");
|
||||
BOOST_BEAST_EXPECT(str(ce) == "x,y,z,");
|
||||
ce.insert("z", R"(")");
|
||||
BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"")");
|
||||
BEAST_EXPECT(str(ce) == R"(x,y,z,z,",)");
|
||||
BOOST_BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"")");
|
||||
BOOST_BEAST_EXPECT(str(ce) == R"(x,y,z,z,",)");
|
||||
ce.insert("p", R"(\)");
|
||||
BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\")");
|
||||
BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,)");
|
||||
BOOST_BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\")");
|
||||
BOOST_BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,)");
|
||||
ce.insert("q", R"(1"2\)");
|
||||
BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\";q="1\"2\\")");
|
||||
BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,q,1"2\,)");
|
||||
BOOST_BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\";q="1\"2\\")");
|
||||
BOOST_BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,q,1"2\,)");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -256,7 +259,7 @@ public:
|
||||
}
|
||||
chunk_extensions c2;
|
||||
c2.parse(c1.str(), ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
if(! BOOST_BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
chunk_extensions c3;
|
||||
for(auto const& v : c2)
|
||||
@@ -264,7 +267,7 @@ public:
|
||||
c3.insert(v.first);
|
||||
else
|
||||
c3.insert(v.first, v.second);
|
||||
BEAST_EXPECTS(c2.str() == c3.str(), c3.str());
|
||||
BOOST_BEAST_EXPECTS(c2.str() == c3.str(), c3.str());
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -274,7 +277,7 @@ public:
|
||||
error_code ec;
|
||||
chunk_extensions ce;
|
||||
ce.parse(s, ec);
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
BOOST_BEAST_EXPECTS(! ec, ec.message());
|
||||
grind(s);
|
||||
};
|
||||
auto const bad =
|
||||
@@ -283,7 +286,7 @@ public:
|
||||
error_code ec;
|
||||
chunk_extensions ce;
|
||||
ce.parse(s, ec);
|
||||
BEAST_EXPECT(ec);
|
||||
BOOST_BEAST_EXPECT(ec);
|
||||
grind(s);
|
||||
};
|
||||
chunkExtensionsTest(good, bad);
|
||||
@@ -301,8 +304,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(chunk_encode,http,beast);
|
||||
BOOST_BEAST_DEFINE_TESTSUITE(chunk_encode,http,beast);
|
||||
|
||||
} // http
|
||||
} // beast
|
||||
|
||||
} // boost
|
||||
|
||||
Reference in New Issue
Block a user