Increase detail::static_ostream coverage

This commit is contained in:
Vinnie Falco
2017-06-19 08:14:09 -07:00
parent ccf7412eaf
commit e4ed62df0b
2 changed files with 38 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
Version 62:
* Remove libssl-dev from a Travis matrix item
* Increase detail::static_ostream coverage
--------------------------------------------------------------------------------

View File

@@ -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);