Used Counts class in IResultCapture interface

This commit is contained in:
Phil Nash 2012-02-23 08:57:51 +00:00
parent 5ddf794fbc
commit 8d93949b19
3 changed files with 12 additions and 18 deletions

View File

@ -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

View File

@ -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;
}
@ -502,12 +500,11 @@ namespace Catch
virtual void sectionEnded
(
const std::string& name,
std::size_t prevSuccesses,
std::size_t prevFailures
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 );
}
///////////////////////////////////////////////////////////////////////////

View File

@ -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;
};