reformatted benchmark output a bit

This commit is contained in:
Phil Nash 2017-08-09 23:27:29 +01:00
parent eed4ae86ad
commit 1aab791d67
2 changed files with 4 additions and 16 deletions

View File

@ -259,16 +259,6 @@ namespace Catch {
} }
return line; return line;
} }
inline char const* getBoxCharsAcross() {
static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
if( !*line ) {
std::memset( line, '-', CATCH_CONFIG_CONSOLE_WIDTH-1 );
line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;
line[0] = '+';
line[CATCH_CONFIG_CONSOLE_WIDTH-2] = '+';
}
return line;
}
struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> { struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {

View File

@ -65,6 +65,7 @@ namespace {
for( auto const& info : m_columnInfos ) for( auto const& info : m_columnInfos )
*this << info.name << ColumnBreak(); *this << info.name << ColumnBreak();
*this << RowBreak(); *this << RowBreak();
m_os << Catch::getLineOfChars<'-'>() << "\n";
} }
} }
void close() { void close() {
@ -91,8 +92,6 @@ namespace {
tp.m_currentColumn = -1; tp.m_currentColumn = -1;
tp.m_os << "\n"; tp.m_os << "\n";
} }
if( tp.m_currentColumn == -1 )
tp.m_os << "|";
tp.m_currentColumn++; tp.m_currentColumn++;
auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
@ -100,9 +99,9 @@ namespace {
? std::string( colInfo.width-(strSize+2), ' ' ) ? std::string( colInfo.width-(strSize+2), ' ' )
: std::string(); : std::string();
if( colInfo.justification == ColumnInfo::Left ) if( colInfo.justification == ColumnInfo::Left )
tp.m_os << " " << colStr << padding << " |"; tp.m_os << colStr << padding << " ";
else else
tp.m_os << " " << padding << colStr << " |"; tp.m_os << padding << colStr << " ";
return tp; return tp;
} }
@ -111,7 +110,6 @@ namespace {
tp.m_os << "\n"; tp.m_os << "\n";
tp.m_currentColumn = -1; tp.m_currentColumn = -1;
} }
tp.m_os << Catch::getBoxCharsAcross() << "\n";
return tp; return tp;
} }
}; };
@ -199,7 +197,7 @@ namespace Catch {
: StreamingReporterBase( config ), : StreamingReporterBase( config ),
m_tablePrinter( config.stream(), m_tablePrinter( config.stream(),
{ {
{ "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH-42, ColumnInfo::Left }, { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH-32, ColumnInfo::Left },
{ "iters", 8, ColumnInfo::Right }, { "iters", 8, ColumnInfo::Right },
{ "elapsed ns", 14, ColumnInfo::Right }, { "elapsed ns", 14, ColumnInfo::Right },
{ "average", 14, ColumnInfo::Right } { "average", 14, ColumnInfo::Right }