Refactor unit_test logging:

The log member is changed to derive from std::ostream. A new
class dstream is derived from std::ostream to support redirection
to the Visual Studio Output Window if a debugger is attached.

Obsolete classes abstract_ostream and its derived variants are
removed.
This commit is contained in:
Vinnie Falco
2016-05-10 07:09:57 -04:00
parent b5dc8eb9ce
commit 651fb45598
15 changed files with 316 additions and 844 deletions

View File

@@ -85,7 +85,7 @@ public:
{
using namespace std::chrono;
using clock_type = std::chrono::high_resolution_clock;
log << name;
log << name << std::endl;
for(std::size_t trial = 1; trial <= repeat; ++trial)
{
auto const t0 = clock_type::now();
@@ -93,7 +93,7 @@ public:
auto const elapsed = clock_type::now() - t0;
log <<
"Trial " << trial << ": " <<
duration_cast<milliseconds>(elapsed).count() << " ms";
duration_cast<milliseconds>(elapsed).count() << " ms" << std::endl;
}
}
@@ -109,10 +109,10 @@ public:
static std::size_t constexpr Repeat = 50;
log << "sizeof(request parser) == " <<
sizeof(basic_parser_v1<true, null_parser<true>>);
sizeof(basic_parser_v1<true, null_parser<true>>) << '\n';
log << "sizeof(response parser) == " <<
sizeof(basic_parser_v1<false, null_parser<true>>);
sizeof(basic_parser_v1<false, null_parser<true>>)<< '\n';
testcase << "Parser speed test, " <<
((Repeat * size_ + 512) / 1024) << "KB in " <<