forked from boostorg/beast
Increase detail::static_ostream coverage
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Version 62:
|
||||
|
||||
* Remove libssl-dev from a Travis matrix item
|
||||
* Increase detail::static_ostream coverage
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -26,9 +26,29 @@ public:
|
||||
BEAST_EXPECT(v.str() == s);
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
class repeater
|
||||
{
|
||||
std::size_t n_;
|
||||
|
||||
public:
|
||||
explicit
|
||||
repeater(std::size_t n)
|
||||
: n_(n)
|
||||
{
|
||||
}
|
||||
|
||||
friend
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, repeater const& v)
|
||||
{
|
||||
return os << std::string(v.n_, '*');
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
testConversion()
|
||||
{
|
||||
// Make sure things convert correctly
|
||||
check(std::string("hello"), "hello");
|
||||
check("xyz", "xyz");
|
||||
check(1, "1");
|
||||
@@ -37,6 +57,21 @@ public:
|
||||
check(1234, "1234");
|
||||
check(12345, "12345");
|
||||
}
|
||||
|
||||
void
|
||||
testStaticOstream()
|
||||
{
|
||||
// exercise static_ostream for coverage
|
||||
std::string s(500, '*');
|
||||
check(repeater{500}, s);
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testConversion();
|
||||
testStaticOstream();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(string_param,core,beast);
|
||||
|
Reference in New Issue
Block a user