From 8d93949b1954b8c446372a3f182cff88f4f17652 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 23 Feb 2012 08:57:51 +0000 Subject: [PATCH] Used Counts class in IResultCapture interface --- 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 e74563e..8770bbd 100644 --- a/include/internal/catch_interfaces_capture.h +++ b/include/internal/catch_interfaces_capture.h @@ -14,6 +14,7 @@ #include #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 316947b..bc12a1c 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 c953aba..8c05bd1 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 @@ -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; };