From ed7eaf2df3dc4d38974234591d725c4cdba11a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 22 Aug 2020 23:16:23 +0200 Subject: [PATCH] Split catch_reporter_bases.hpp into two separate headers Each of the two reporter bases now has its own header file, and cpp file. Even though this adds another TU to the compilation, the total CPU time taken by compilation is reduced by about 1% for debug build and ~0.5% for optimized build of the main library. (The improvement would be roughly doubles without splitting the TUs, but the maintainability hit is not worth it.) The code size of the static library build has also somewhat decreased. Follow up: Introduce combined TU for reporters, and further split apart the catch_reporter_streaming_base.hpp header into its constituent parts, as it still contains a whole bunch of other stuff. --- examples/210-Evt-EventListeners.cpp | 2 +- src/CMakeLists.txt | 6 +- .../reporters/catch_reporter_automake.hpp | 2 +- src/catch2/reporters/catch_reporter_bases.hpp | 169 ------------------ .../reporters/catch_reporter_compact.hpp | 2 +- .../reporters/catch_reporter_console.hpp | 2 +- ...cpp => catch_reporter_cumulative_base.cpp} | 95 +--------- .../catch_reporter_cumulative_base.hpp | 82 +++++++++ src/catch2/reporters/catch_reporter_junit.cpp | 3 +- src/catch2/reporters/catch_reporter_junit.hpp | 2 +- .../reporters/catch_reporter_sonarqube.hpp | 2 +- .../catch_reporter_streaming_base.cpp | 99 ++++++++++ .../catch_reporter_streaming_base.hpp | 90 ++++++++++ src/catch2/reporters/catch_reporter_tap.hpp | 2 +- .../reporters/catch_reporter_teamcity.hpp | 2 +- src/catch2/reporters/catch_reporter_xml.hpp | 2 +- src/catch2/reporters/catch_reporters_all.hpp | 3 +- tests/SelfTest/TestRegistrations.cpp | 2 +- 18 files changed, 289 insertions(+), 278 deletions(-) delete mode 100644 src/catch2/reporters/catch_reporter_bases.hpp rename src/catch2/reporters/{catch_reporter_bases.cpp => catch_reporter_cumulative_base.cpp} (57%) create mode 100644 src/catch2/reporters/catch_reporter_cumulative_base.hpp create mode 100644 src/catch2/reporters/catch_reporter_streaming_base.cpp create mode 100644 src/catch2/reporters/catch_reporter_streaming_base.hpp diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp index c69d507c..89c828d5 100644 --- a/examples/210-Evt-EventListeners.cpp +++ b/examples/210-Evt-EventListeners.cpp @@ -6,7 +6,7 @@ // 3. Test cases #include -#include +#include #include #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 24b3b055..0bc0fc3d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -193,24 +193,26 @@ set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS}) set(REPORTER_HEADERS ${SOURCES_DIR}/reporters/catch_reporters_all.hpp ${SOURCES_DIR}/reporters/catch_reporter_automake.hpp - ${SOURCES_DIR}/reporters/catch_reporter_bases.hpp ${SOURCES_DIR}/reporters/catch_reporter_compact.hpp ${SOURCES_DIR}/reporters/catch_reporter_console.hpp + ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.hpp ${SOURCES_DIR}/reporters/catch_reporter_junit.hpp ${SOURCES_DIR}/reporters/catch_reporter_listening.hpp ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp + ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.hpp ${SOURCES_DIR}/reporters/catch_reporter_tap.hpp ${SOURCES_DIR}/reporters/catch_reporter_teamcity.hpp ${SOURCES_DIR}/reporters/catch_reporter_xml.hpp ) set(REPORTER_SOURCES ${SOURCES_DIR}/reporters/catch_reporter_automake.cpp - ${SOURCES_DIR}/reporters/catch_reporter_bases.cpp ${SOURCES_DIR}/reporters/catch_reporter_compact.cpp ${SOURCES_DIR}/reporters/catch_reporter_console.cpp + ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.cpp ${SOURCES_DIR}/reporters/catch_reporter_junit.cpp ${SOURCES_DIR}/reporters/catch_reporter_listening.cpp ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.cpp + ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.cpp ${SOURCES_DIR}/reporters/catch_reporter_tap.cpp ${SOURCES_DIR}/reporters/catch_reporter_teamcity.cpp ${SOURCES_DIR}/reporters/catch_reporter_xml.cpp diff --git a/src/catch2/reporters/catch_reporter_automake.hpp b/src/catch2/reporters/catch_reporter_automake.hpp index 2d1066ed..5eec5218 100644 --- a/src/catch2/reporters/catch_reporter_automake.hpp +++ b/src/catch2/reporters/catch_reporter_automake.hpp @@ -5,7 +5,7 @@ #ifndef TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED -#include +#include namespace Catch { diff --git a/src/catch2/reporters/catch_reporter_bases.hpp b/src/catch2/reporters/catch_reporter_bases.hpp deleted file mode 100644 index 282394eb..00000000 --- a/src/catch2/reporters/catch_reporter_bases.hpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Created by Phil on 27/11/2013. - * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ -#ifndef TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED -#define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED - -#include - -#include -#include -#include -#include - -namespace Catch { - // Returns double formatted as %.3f (format expected on output) - std::string getFormattedDuration( double duration ); - - //! Should the reporter show - bool shouldShowDuration( IConfig const& config, double duration ); - - std::string serializeFilters( std::vector const& container ); - - struct StreamingReporterBase : IStreamingReporter { - - StreamingReporterBase( ReporterConfig const& _config ): - m_config( _config.fullConfig() ), stream( _config.stream() ) { - } - - - ~StreamingReporterBase() override; - - void noMatchingTestCases(std::string const&) override {} - - void reportInvalidArguments(std::string const&) override {} - - void testRunStarting(TestRunInfo const& _testRunInfo) override { - currentTestRunInfo = _testRunInfo; - } - - void testGroupStarting(GroupInfo const& _groupInfo) override { - currentGroupInfo = _groupInfo; - } - - void testCaseStarting(TestCaseInfo const& _testInfo) override { - currentTestCaseInfo = &_testInfo; - } - void sectionStarting(SectionInfo const& _sectionInfo) override { - m_sectionStack.push_back(_sectionInfo); - } - - void sectionEnded(SectionStats const& /* _sectionStats */) override { - m_sectionStack.pop_back(); - } - void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { - currentTestCaseInfo = nullptr; - } - void testGroupEnded( TestGroupStats const& ) override; - void testRunEnded( TestRunStats const& /* _testRunStats */ ) override; - - void skipTest(TestCaseInfo const&) override { - // Don't do anything with this by default. - // It can optionally be overridden in the derived class. - } - - IConfig const* m_config; - std::ostream& stream; - - LazyStat currentTestRunInfo; - LazyStat currentGroupInfo; - TestCaseInfo const* currentTestCaseInfo = nullptr; - - std::vector m_sectionStack; - }; - - struct CumulativeReporterBase : IStreamingReporter { - template - struct Node { - explicit Node( T const& _value ) : value( _value ) {} - virtual ~Node() {} - - using ChildNodes = std::vector>; - T value; - ChildNodes children; - }; - struct SectionNode { - explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} - - bool operator == (SectionNode const& other) const { - return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; - } - - SectionStats stats; - using ChildSections = std::vector>; - using Assertions = std::vector; - ChildSections childSections; - Assertions assertions; - std::string stdOut; - std::string stdErr; - }; - - - using TestCaseNode = Node; - using TestGroupNode = Node; - using TestRunNode = Node; - - CumulativeReporterBase( ReporterConfig const& _config ): - m_config( _config.fullConfig() ), stream( _config.stream() ) {} - ~CumulativeReporterBase() override; - - void testRunStarting( TestRunInfo const& ) override {} - void testGroupStarting( GroupInfo const& ) override {} - - void testCaseStarting( TestCaseInfo const& ) override {} - - void sectionStarting( SectionInfo const& sectionInfo ) override; - - void assertionStarting( AssertionInfo const& ) override {} - - bool assertionEnded( AssertionStats const& assertionStats ) override; - void sectionEnded( SectionStats const& sectionStats ) override; - void testCaseEnded( TestCaseStats const& testCaseStats ) override; - void testGroupEnded( TestGroupStats const& testGroupStats ) override; - void testRunEnded( TestRunStats const& testRunStats ) override; - virtual void testRunEndedCumulative() = 0; - - void skipTest(TestCaseInfo const&) override {} - - IConfig const* m_config; - std::ostream& stream; - std::vector m_assertions; - std::vector>> m_sections; - std::vector> m_testCases; - std::vector> m_testGroups; - - std::vector> m_testRuns; - - std::shared_ptr m_rootSection; - std::shared_ptr m_deepestSection; - std::vector> m_sectionStack; - }; - - struct lineOfChars { - char c; - constexpr lineOfChars(char c): - c(c) - {} - - friend std::ostream& operator<< (std::ostream& out, lineOfChars value); - }; - - struct TestEventListenerBase : StreamingReporterBase { - TestEventListenerBase( ReporterConfig const& _config ); - - void assertionStarting(AssertionInfo const&) override; - bool assertionEnded(AssertionStats const&) override; - - // Event listeners should not use the default listing impl - void listReporters(std::vector const&, IConfig const&) override {} - void listTests(std::vector const&, IConfig const&) override {} - void listTags(std::vector const&, IConfig const&) override {} - }; - -} // end namespace Catch - -#endif // TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED \ No newline at end of file diff --git a/src/catch2/reporters/catch_reporter_compact.hpp b/src/catch2/reporters/catch_reporter_compact.hpp index 7c814c09..aaf974ce 100644 --- a/src/catch2/reporters/catch_reporter_compact.hpp +++ b/src/catch2/reporters/catch_reporter_compact.hpp @@ -9,7 +9,7 @@ #define TWOBLUECUBES_CATCH_REPORTER_COMPACT_H_INCLUDED -#include +#include namespace Catch { diff --git a/src/catch2/reporters/catch_reporter_console.hpp b/src/catch2/reporters/catch_reporter_console.hpp index 56c7231a..908fd126 100644 --- a/src/catch2/reporters/catch_reporter_console.hpp +++ b/src/catch2/reporters/catch_reporter_console.hpp @@ -8,7 +8,7 @@ #ifndef TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED -#include +#include #include #if defined(_MSC_VER) diff --git a/src/catch2/reporters/catch_reporter_bases.cpp b/src/catch2/reporters/catch_reporter_cumulative_base.cpp similarity index 57% rename from src/catch2/reporters/catch_reporter_bases.cpp rename to src/catch2/reporters/catch_reporter_cumulative_base.cpp index 08aff91a..ae974e89 100644 --- a/src/catch2/reporters/catch_reporter_bases.cpp +++ b/src/catch2/reporters/catch_reporter_cumulative_base.cpp @@ -1,23 +1,6 @@ -/* - * Created by Phil on 27/11/2013. - * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ - -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include #include namespace Catch { @@ -44,74 +27,6 @@ namespace Catch { } } // namespace - // Because formatting using c++ streams is stateful, drop down to C is required - // Alternatively we could use stringstream, but its performance is... not good. - std::string getFormattedDuration( double duration ) { - // Max exponent + 1 is required to represent the whole part - // + 1 for decimal point - // + 3 for the 3 decimal places - // + 1 for null terminator - const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; - char buffer[maxDoubleSize]; - - // Save previous errno, to prevent sprintf from overwriting it - ErrnoGuard guard; -#ifdef _MSC_VER - sprintf_s(buffer, "%.3f", duration); -#else - std::sprintf(buffer, "%.3f", duration); -#endif - return std::string(buffer); - } - - bool shouldShowDuration( IConfig const& config, double duration ) { - if ( config.showDurations() == ShowDurations::Always ) { - return true; - } - if ( config.showDurations() == ShowDurations::Never ) { - return false; - } - const double min = config.minDuration(); - return min >= 0 && duration >= min; - } - - std::string serializeFilters( std::vector const& container ) { - ReusableStringStream oss; - bool first = true; - for (auto&& filter : container) - { - if (!first) - oss << ' '; - else - first = false; - - oss << filter; - } - return oss.str(); - } - - TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) - :StreamingReporterBase(_config) {} - - void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} - - bool TestEventListenerBase::assertionEnded(AssertionStats const &) { - return false; - } - - - StreamingReporterBase::~StreamingReporterBase() = default; - - void StreamingReporterBase::testGroupEnded( TestGroupStats const& ) { - currentGroupInfo.reset(); - } - - void StreamingReporterBase::testRunEnded( TestRunStats const& ) { - currentTestCaseInfo = nullptr; - currentGroupInfo.reset(); - currentTestRunInfo.reset(); - } - CumulativeReporterBase::~CumulativeReporterBase() = default; @@ -189,12 +104,4 @@ namespace Catch { testRunEndedCumulative(); } - - std::ostream& operator<<(std::ostream& out, lineOfChars value) { - for (size_t idx = 0; idx < CATCH_CONFIG_CONSOLE_WIDTH - 1; ++idx) { - out.put(value.c); - } - return out; - } - } // end namespace Catch diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/src/catch2/reporters/catch_reporter_cumulative_base.hpp new file mode 100644 index 00000000..6aa055be --- /dev/null +++ b/src/catch2/reporters/catch_reporter_cumulative_base.hpp @@ -0,0 +1,82 @@ +#ifndef CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED +#define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED + +#include + +#include +#include +#include +#include + +namespace Catch { + + struct CumulativeReporterBase : IStreamingReporter { + template + struct Node { + explicit Node( T const& _value ) : value( _value ) {} + virtual ~Node() {} + + using ChildNodes = std::vector>; + T value; + ChildNodes children; + }; + struct SectionNode { + explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} + + bool operator == (SectionNode const& other) const { + return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; + } + + SectionStats stats; + using ChildSections = std::vector>; + using Assertions = std::vector; + ChildSections childSections; + Assertions assertions; + std::string stdOut; + std::string stdErr; + }; + + + using TestCaseNode = Node; + using TestGroupNode = Node; + using TestRunNode = Node; + + CumulativeReporterBase( ReporterConfig const& _config ): + m_config( _config.fullConfig() ), stream( _config.stream() ) {} + ~CumulativeReporterBase() override; + + void testRunStarting( TestRunInfo const& ) override {} + void testGroupStarting( GroupInfo const& ) override {} + + void testCaseStarting( TestCaseInfo const& ) override {} + + void sectionStarting( SectionInfo const& sectionInfo ) override; + + void assertionStarting( AssertionInfo const& ) override {} + + bool assertionEnded( AssertionStats const& assertionStats ) override; + void sectionEnded( SectionStats const& sectionStats ) override; + void testCaseEnded( TestCaseStats const& testCaseStats ) override; + void testGroupEnded( TestGroupStats const& testGroupStats ) override; + void testRunEnded( TestRunStats const& testRunStats ) override; + virtual void testRunEndedCumulative() = 0; + + void skipTest(TestCaseInfo const&) override {} + + IConfig const* m_config; + std::ostream& stream; + std::vector m_assertions; + std::vector>> m_sections; + std::vector> m_testCases; + std::vector> m_testGroups; + + std::vector> m_testRuns; + + std::shared_ptr m_rootSection; + std::shared_ptr m_deepestSection; + std::vector> m_sectionStack; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED diff --git a/src/catch2/reporters/catch_reporter_junit.cpp b/src/catch2/reporters/catch_reporter_junit.cpp index ff679e71..78ae1d92 100644 --- a/src/catch2/reporters/catch_reporter_junit.cpp +++ b/src/catch2/reporters/catch_reporter_junit.cpp @@ -6,10 +6,9 @@ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ -#include - #include +#include #include #include #include diff --git a/src/catch2/reporters/catch_reporter_junit.hpp b/src/catch2/reporters/catch_reporter_junit.hpp index 3a75570a..ab80f368 100644 --- a/src/catch2/reporters/catch_reporter_junit.hpp +++ b/src/catch2/reporters/catch_reporter_junit.hpp @@ -8,7 +8,7 @@ #define TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED -#include +#include #include #include diff --git a/src/catch2/reporters/catch_reporter_sonarqube.hpp b/src/catch2/reporters/catch_reporter_sonarqube.hpp index a5f174f1..ea84f6f9 100644 --- a/src/catch2/reporters/catch_reporter_sonarqube.hpp +++ b/src/catch2/reporters/catch_reporter_sonarqube.hpp @@ -5,7 +5,7 @@ #ifndef CATCH_REPORTER_SONARQUBE_HPP_INCLUDED #define CATCH_REPORTER_SONARQUBE_HPP_INCLUDED -#include +#include #include diff --git a/src/catch2/reporters/catch_reporter_streaming_base.cpp b/src/catch2/reporters/catch_reporter_streaming_base.cpp new file mode 100644 index 00000000..6d84c096 --- /dev/null +++ b/src/catch2/reporters/catch_reporter_streaming_base.cpp @@ -0,0 +1,99 @@ +#include + +#include +#include +#include +#include + +#include +#include +#include + +namespace Catch { + + // Because formatting using c++ streams is stateful, drop down to C is + // required Alternatively we could use stringstream, but its performance + // is... not good. + std::string getFormattedDuration( double duration ) { + // Max exponent + 1 is required to represent the whole part + // + 1 for decimal point + // + 3 for the 3 decimal places + // + 1 for null terminator + const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + char buffer[maxDoubleSize]; + + // Save previous errno, to prevent sprintf from overwriting it + ErrnoGuard guard; +#ifdef _MSC_VER + sprintf_s( buffer, "%.3f", duration ); +#else + std::sprintf( buffer, "%.3f", duration ); +#endif + return std::string( buffer ); + } + + bool shouldShowDuration( IConfig const& config, double duration ) { + if ( config.showDurations() == ShowDurations::Always ) { + return true; + } + if ( config.showDurations() == ShowDurations::Never ) { + return false; + } + const double min = config.minDuration(); + return min >= 0 && duration >= min; + } + + std::string serializeFilters( std::vector const& container ) { + ReusableStringStream oss; + bool first = true; + for ( auto&& filter : container ) { + if ( !first ) + oss << ' '; + else + first = false; + + oss << filter; + } + return oss.str(); + } + + TestEventListenerBase::TestEventListenerBase( + ReporterConfig const& _config ): + StreamingReporterBase( _config ) {} + + void TestEventListenerBase::assertionStarting( AssertionInfo const& ) {} + + bool TestEventListenerBase::assertionEnded( AssertionStats const& ) { + return false; + } + + StreamingReporterBase::~StreamingReporterBase() = default; + + void + StreamingReporterBase::testRunStarting( TestRunInfo const& _testRunInfo ) { + currentTestRunInfo = _testRunInfo; + } + + void + StreamingReporterBase::testGroupStarting( GroupInfo const& _groupInfo ) { + currentGroupInfo = _groupInfo; + } + + void StreamingReporterBase::testGroupEnded( TestGroupStats const& ) { + currentGroupInfo.reset(); + } + + void StreamingReporterBase::testRunEnded( TestRunStats const& ) { + currentTestCaseInfo = nullptr; + currentGroupInfo.reset(); + currentTestRunInfo.reset(); + } + + std::ostream& operator<<( std::ostream& out, lineOfChars value ) { + for ( size_t idx = 0; idx < CATCH_CONFIG_CONSOLE_WIDTH - 1; ++idx ) { + out.put( value.c ); + } + return out; + } + +} // end namespace Catch diff --git a/src/catch2/reporters/catch_reporter_streaming_base.hpp b/src/catch2/reporters/catch_reporter_streaming_base.hpp new file mode 100644 index 00000000..0d1cbd38 --- /dev/null +++ b/src/catch2/reporters/catch_reporter_streaming_base.hpp @@ -0,0 +1,90 @@ +#ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED +#define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED + +#include + +#include +#include +#include + +namespace Catch { + // Returns double formatted as %.3f (format expected on output) + std::string getFormattedDuration( double duration ); + + //! Should the reporter show + bool shouldShowDuration( IConfig const& config, double duration ); + + std::string serializeFilters( std::vector const& container ); + + struct StreamingReporterBase : IStreamingReporter { + + StreamingReporterBase( ReporterConfig const& _config ): + m_config( _config.fullConfig() ), stream( _config.stream() ) { + } + + + ~StreamingReporterBase() override; + + void noMatchingTestCases(std::string const&) override {} + + void reportInvalidArguments(std::string const&) override {} + + void testRunStarting( TestRunInfo const& _testRunInfo ) override; + + void testGroupStarting( GroupInfo const& _groupInfo ) override; + + void testCaseStarting(TestCaseInfo const& _testInfo) override { + currentTestCaseInfo = &_testInfo; + } + void sectionStarting(SectionInfo const& _sectionInfo) override { + m_sectionStack.push_back(_sectionInfo); + } + + void sectionEnded(SectionStats const& /* _sectionStats */) override { + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { + currentTestCaseInfo = nullptr; + } + void testGroupEnded( TestGroupStats const& ) override; + void testRunEnded( TestRunStats const& /* _testRunStats */ ) override; + + void skipTest(TestCaseInfo const&) override { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + + IConfig const* m_config; + std::ostream& stream; + + LazyStat currentTestRunInfo; + LazyStat currentGroupInfo; + TestCaseInfo const* currentTestCaseInfo = nullptr; + + std::vector m_sectionStack; + }; + + struct lineOfChars { + char c; + constexpr lineOfChars(char c): + c(c) + {} + + friend std::ostream& operator<< (std::ostream& out, lineOfChars value); + }; + + struct TestEventListenerBase : StreamingReporterBase { + TestEventListenerBase( ReporterConfig const& _config ); + + void assertionStarting(AssertionInfo const&) override; + bool assertionEnded(AssertionStats const&) override; + + // Event listeners should not use the default listing impl + void listReporters(std::vector const&, IConfig const&) override {} + void listTests(std::vector const&, IConfig const&) override {} + void listTags(std::vector const&, IConfig const&) override {} + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED diff --git a/src/catch2/reporters/catch_reporter_tap.hpp b/src/catch2/reporters/catch_reporter_tap.hpp index 63042481..7c3365dc 100644 --- a/src/catch2/reporters/catch_reporter_tap.hpp +++ b/src/catch2/reporters/catch_reporter_tap.hpp @@ -5,7 +5,7 @@ #ifndef TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED -#include +#include namespace Catch { diff --git a/src/catch2/reporters/catch_reporter_teamcity.hpp b/src/catch2/reporters/catch_reporter_teamcity.hpp index a1d6e2fe..69e2c31e 100644 --- a/src/catch2/reporters/catch_reporter_teamcity.hpp +++ b/src/catch2/reporters/catch_reporter_teamcity.hpp @@ -5,8 +5,8 @@ #ifndef TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED +#include #include -#include #include diff --git a/src/catch2/reporters/catch_reporter_xml.hpp b/src/catch2/reporters/catch_reporter_xml.hpp index 30cc57dd..9a225126 100644 --- a/src/catch2/reporters/catch_reporter_xml.hpp +++ b/src/catch2/reporters/catch_reporter_xml.hpp @@ -7,7 +7,7 @@ #ifndef TWOBLUECUBES_CATCH_REPORTER_XML_H_INCLUDED #define TWOBLUECUBES_CATCH_REPORTER_XML_H_INCLUDED -#include +#include #include #include diff --git a/src/catch2/reporters/catch_reporters_all.hpp b/src/catch2/reporters/catch_reporters_all.hpp index e18a1ace..aa46c699 100644 --- a/src/catch2/reporters/catch_reporters_all.hpp +++ b/src/catch2/reporters/catch_reporters_all.hpp @@ -15,12 +15,13 @@ #define CATCH_REPORTERS_ALL_HPP_INCLUDED #include -#include #include #include +#include #include #include #include +#include #include #include #include diff --git a/tests/SelfTest/TestRegistrations.cpp b/tests/SelfTest/TestRegistrations.cpp index dc3625fe..ee5d0a15 100644 --- a/tests/SelfTest/TestRegistrations.cpp +++ b/tests/SelfTest/TestRegistrations.cpp @@ -15,7 +15,7 @@ CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" ) # pragma clang diagnostic ignored "-Wc++98-compat" #endif -#include +#include struct TestListener : Catch::TestEventListenerBase { using TestEventListenerBase::TestEventListenerBase;