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

Used Counts class in IResultCapture interface

Commit
8d93949b1954b8c446372a3f182cff88f4f17652
Author
Phil Nash ·
Parents
5ddf794fbc65

Files · Download .tar.gz

Changes

 include/internal/catch_interfaces_capture.h |  7 +++----
 include/internal/catch_runner_impl.hpp      | 13 +++++--------
 include/internal/catch_section.hpp          | 10 ++++------
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h
index e74563ef..8770bbd7 100644
--- a/include/internal/catch_interfaces_capture.h
+++ b/include/internal/catch_interfaces_capture.h
@@ -14,6 +14,7 @@
 
 #include <string>
 #include "catch_result_type.h"
+#include "catch_totals.hpp"
 
 namespace Catch
 {    
@@ -36,13 +37,11 @@ namespace Catch
                 const std::string& description, 
                 const std::string& filename,
                 std::size_t line,
-                std::size_t& successes, 
-                std::size_t& failures 
+                Counts& assertions
             ) = 0;
         virtual void sectionEnded
             (   const std::string& name, 
-                std::size_t successes, 
-                std::size_t failures 
+                const Counts& assertions
             ) = 0;
         virtual void pushScopedInfo
             (   ScopedInfo* scopedInfo 
diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp
index 316947b0..bc12a1c0 100644
--- a/include/internal/catch_runner_impl.hpp
+++ b/include/internal/catch_runner_impl.hpp
@@ -480,8 +480,7 @@ namespace Catch
             const std::string& description,
             const std::string& filename,
             std::size_t line,
-            std::size_t& successes,
-            std::size_t& failures 
+            Counts& assertions
         )
         {
             std::ostringstream oss;
@@ -492,8 +491,7 @@ namespace Catch
 
             m_currentResult.setFileAndLine( filename, line );
             m_reporter->StartSection( name, description );
-            successes = m_totals.assertions.passed;
-            failures = m_totals.assertions.failed;
+            assertions = m_totals.assertions;
             
             return true;
         }
@@ -501,13 +499,12 @@ namespace Catch
         ///////////////////////////////////////////////////////////////////////////
         virtual void sectionEnded
         (
-            const std::string& name, 
-            std::size_t prevSuccesses, 
-            std::size_t prevFailures 
+            const std::string& name,
+            const Counts& prevAssertions
         )
         {
             m_runningTest->endSection( name );
-            m_reporter->EndSection( name, m_totals.assertions.passed - prevSuccesses, m_totals.assertions.failed - prevFailures );
+            m_reporter->EndSection( name, m_totals.assertions.passed - prevAssertions.passed, m_totals.assertions.failed - prevAssertions.failed );
         }
 
         ///////////////////////////////////////////////////////////////////////////
diff --git a/include/internal/catch_section.hpp b/include/internal/catch_section.hpp
index c953aba8..8c05bd18 100644
--- a/include/internal/catch_section.hpp
+++ b/include/internal/catch_section.hpp
@@ -14,6 +14,7 @@
 #define TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
 
 #include "catch_capture.hpp"
+#include "catch_totals.hpp"
 
 #include <string>
 
@@ -31,9 +32,7 @@ namespace Catch
             std::size_t line
         )
         :   m_name( name ),
-            m_successes(0),
-            m_failures(0),
-            m_sectionIncluded( Hub::getResultCapture().sectionStarted( name, description, filename, line, m_successes, m_failures ) )
+            m_sectionIncluded( Hub::getResultCapture().sectionStarted( name, description, filename, line, m_assertions ) )
         {
         }
 
@@ -42,7 +41,7 @@ namespace Catch
         ()
         {
             if( m_sectionIncluded )
-                Hub::getResultCapture().sectionEnded( m_name, m_successes, m_failures );
+                Hub::getResultCapture().sectionEnded( m_name, m_assertions );
         }
         
         ///////////////////////////////////////////////////////////////////////        
@@ -56,8 +55,7 @@ namespace Catch
     private:
         
         std::string m_name;
-        std::size_t m_successes;
-        std::size_t m_failures;
+        Counts m_assertions;
         bool m_sectionIncluded;
     };