From 1aab791d67a8a4072156db22d80c1a863dcdb593 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 9 Aug 2017 23:27:29 +0100 Subject: [PATCH] reformatted benchmark output a bit --- include/reporters/catch_reporter_bases.hpp | 10 ---------- include/reporters/catch_reporter_console.cpp | 10 ++++------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index 2f9a8013..cfba9415 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -259,16 +259,6 @@ namespace Catch { } 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 { diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp index 33259041..ca102df6 100644 --- a/include/reporters/catch_reporter_console.cpp +++ b/include/reporters/catch_reporter_console.cpp @@ -65,6 +65,7 @@ namespace { for( auto const& info : m_columnInfos ) *this << info.name << ColumnBreak(); *this << RowBreak(); + m_os << Catch::getLineOfChars<'-'>() << "\n"; } } void close() { @@ -91,8 +92,6 @@ namespace { tp.m_currentColumn = -1; tp.m_os << "\n"; } - if( tp.m_currentColumn == -1 ) - tp.m_os << "|"; tp.m_currentColumn++; auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; @@ -100,9 +99,9 @@ namespace { ? std::string( colInfo.width-(strSize+2), ' ' ) : std::string(); if( colInfo.justification == ColumnInfo::Left ) - tp.m_os << " " << colStr << padding << " |"; + tp.m_os << colStr << padding << " "; else - tp.m_os << " " << padding << colStr << " |"; + tp.m_os << padding << colStr << " "; return tp; } @@ -111,7 +110,6 @@ namespace { tp.m_os << "\n"; tp.m_currentColumn = -1; } - tp.m_os << Catch::getBoxCharsAcross() << "\n"; return tp; } }; @@ -199,7 +197,7 @@ namespace Catch { : StreamingReporterBase( config ), 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 }, { "elapsed ns", 14, ColumnInfo::Right }, { "average", 14, ColumnInfo::Right }