Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Added benchmark support to MultiReporters

- otherwise benchmarks are not reported if multiple reporters (usually reporter + listener(s)) are used
Commit
3d49d83128f80b70edd5333729f5d8bc96a5b018
Author
Phil Nash ·
Parents
bd46f66754f1

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_multi.cpp | 8 ++++++++
 include/reporters/catch_reporter_multi.h   | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/include/reporters/catch_reporter_multi.cpp b/include/reporters/catch_reporter_multi.cpp
index 017b628d..23bb1603 100644
--- a/include/reporters/catch_reporter_multi.cpp
+++ b/include/reporters/catch_reporter_multi.cpp
@@ -28,6 +28,14 @@ namespace Catch {
             reporter->noMatchingTestCases( spec );
     }
 
+    void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
+        for( auto const& reporter : m_reporters )
+            reporter->benchmarkStarting( benchmarkInfo );
+    }
+    void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
+        for( auto const& reporter : m_reporters )
+            reporter->benchmarkEnded( benchmarkStats );
+    }
 
     void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
         for( auto const& reporter : m_reporters )
diff --git a/include/reporters/catch_reporter_multi.h b/include/reporters/catch_reporter_multi.h
index 02924c9c..985d442f 100644
--- a/include/reporters/catch_reporter_multi.h
+++ b/include/reporters/catch_reporter_multi.h
@@ -26,6 +26,9 @@ namespace Catch {
 
         static std::set<Verbosity> getSupportedVerbosities();
 
+        void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
+        void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override;
+
         void testRunStarting( TestRunInfo const& testRunInfo ) override;
         void testGroupStarting( GroupInfo const& groupInfo ) override;
         void testCaseStarting( TestCaseInfo const& testInfo ) override;