mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-08 23:29:53 +01:00
Regenerated single include
This commit is contained in:
parent
ab4b36862d
commit
7004f4a234
@ -123,6 +123,11 @@ namespace Catch {
|
|||||||
diff.failed = failed - other.failed;
|
diff.failed = failed - other.failed;
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
Counts& operator += ( const Counts& other ) {
|
||||||
|
passed += other.passed;
|
||||||
|
failed += other.failed;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t total() const {
|
std::size_t total() const {
|
||||||
return passed + failed;
|
return passed + failed;
|
||||||
@ -141,6 +146,15 @@ namespace Catch {
|
|||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Totals delta( const Totals& prevTotals ) const {
|
||||||
|
Totals diff = *this - prevTotals;
|
||||||
|
if( diff.assertions.failed > 0 )
|
||||||
|
++diff.testCases.failed;
|
||||||
|
else
|
||||||
|
++diff.testCases.passed;
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
Counts assertions;
|
Counts assertions;
|
||||||
Counts testCases;
|
Counts testCases;
|
||||||
};
|
};
|
||||||
@ -324,10 +338,6 @@ namespace Catch {
|
|||||||
Context( const Context& );
|
Context( const Context& );
|
||||||
void operator=( const Context& );
|
void operator=( const Context& );
|
||||||
|
|
||||||
public: // friends
|
|
||||||
friend IContext& getCurrentContext() { return Context::getCurrent(); }
|
|
||||||
friend IMutableContext& getCurrentMutableContext() { return Context::getCurrent(); }
|
|
||||||
|
|
||||||
public: // IContext
|
public: // IContext
|
||||||
virtual IResultCapture& getResultCapture();
|
virtual IResultCapture& getResultCapture();
|
||||||
virtual IRunner& getRunner();
|
virtual IRunner& getRunner();
|
||||||
@ -345,9 +355,9 @@ namespace Catch {
|
|||||||
static std::streambuf* createStreamBuf( const std::string& streamName );
|
static std::streambuf* createStreamBuf( const std::string& streamName );
|
||||||
static void cleanUp();
|
static void cleanUp();
|
||||||
|
|
||||||
|
friend IMutableContext& getCurrentMutableContext();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Context& getCurrent();
|
|
||||||
static Context*& singleInstance();
|
|
||||||
GeneratorsForTest* findGeneratorsForCurrentTest();
|
GeneratorsForTest* findGeneratorsForCurrentTest();
|
||||||
GeneratorsForTest& getGeneratorsForCurrentTest();
|
GeneratorsForTest& getGeneratorsForCurrentTest();
|
||||||
|
|
||||||
@ -2102,7 +2112,7 @@ namespace Catch {
|
|||||||
{
|
{
|
||||||
u_int count;
|
u_int count;
|
||||||
Method* methods = class_copyMethodList( cls, &count );
|
Method* methods = class_copyMethodList( cls, &count );
|
||||||
for( int m = 0; m < count ; m++ ) {
|
for( u_int m = 0; m < count ; m++ ) {
|
||||||
SEL selector = method_getName(methods[m]);
|
SEL selector = method_getName(methods[m]);
|
||||||
std::string methodName = sel_getName(selector);
|
std::string methodName = sel_getName(selector);
|
||||||
if( Detail::startsWith( methodName, "Catch_TestCase_" ) ) {
|
if( Detail::startsWith( methodName, "Catch_TestCase_" ) ) {
|
||||||
@ -2800,7 +2810,7 @@ namespace Catch {
|
|||||||
m_reporter->StartGroup( "test case run" );
|
m_reporter->StartGroup( "test case run" );
|
||||||
m_currentResult.setLineInfo( m_runningTest->getTestCaseInfo().getLineInfo() );
|
m_currentResult.setLineInfo( m_runningTest->getTestCaseInfo().getLineInfo() );
|
||||||
runCurrentTest( redirectedCout, redirectedCerr );
|
runCurrentTest( redirectedCout, redirectedCerr );
|
||||||
m_reporter->EndGroup( "test case run", m_totals - prevTotals );
|
m_reporter->EndGroup( "test case run", m_totals.delta( prevTotals ) );
|
||||||
}
|
}
|
||||||
while( m_runningTest->hasUntestedSections() );
|
while( m_runningTest->hasUntestedSections() );
|
||||||
}
|
}
|
||||||
@ -2809,12 +2819,9 @@ namespace Catch {
|
|||||||
delete m_runningTest;
|
delete m_runningTest;
|
||||||
m_runningTest = NULL;
|
m_runningTest = NULL;
|
||||||
|
|
||||||
if( m_totals.assertions.failed > prevTotals.assertions.failed )
|
Totals deltaTotals = m_totals.delta( prevTotals );
|
||||||
++m_totals.testCases.failed;
|
m_totals.testCases += deltaTotals.testCases;
|
||||||
else
|
m_reporter->EndTestCase( testInfo, deltaTotals, redirectedCout, redirectedCerr );
|
||||||
++m_totals.testCases.passed;
|
|
||||||
|
|
||||||
m_reporter->EndTestCase( testInfo, m_totals - prevTotals, redirectedCout, redirectedCerr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Totals getTotals() const {
|
virtual Totals getTotals() const {
|
||||||
@ -3307,28 +3314,27 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
Context* currentHub = NULL;
|
||||||
|
}
|
||||||
|
IMutableContext& getCurrentMutableContext() {
|
||||||
|
if( !currentHub )
|
||||||
|
currentHub = new Context();
|
||||||
|
return *currentHub;
|
||||||
|
}
|
||||||
|
IContext& getCurrentContext() {
|
||||||
|
return getCurrentMutableContext();
|
||||||
|
}
|
||||||
|
|
||||||
Context::Context()
|
Context::Context()
|
||||||
: m_reporterRegistry( new ReporterRegistry ),
|
: m_reporterRegistry( new ReporterRegistry ),
|
||||||
m_testCaseRegistry( new TestRegistry ),
|
m_testCaseRegistry( new TestRegistry ),
|
||||||
m_exceptionTranslatorRegistry( new ExceptionTranslatorRegistry )
|
m_exceptionTranslatorRegistry( new ExceptionTranslatorRegistry )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Context*& Context::singleInstance() {
|
|
||||||
static Context* hub = NULL;
|
|
||||||
return hub;
|
|
||||||
}
|
|
||||||
|
|
||||||
Context& Context::getCurrent() {
|
|
||||||
Context*& hub = singleInstance();
|
|
||||||
if( !hub )
|
|
||||||
hub = new Context();
|
|
||||||
return *hub;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Context::cleanUp() {
|
void Context::cleanUp() {
|
||||||
Context*& hub = singleInstance();
|
delete currentHub;
|
||||||
delete hub;
|
currentHub = NULL;
|
||||||
hub = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::setRunner( IRunner* runner ) {
|
void Context::setRunner( IRunner* runner ) {
|
||||||
@ -3368,7 +3374,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GeneratorsForTest* Context::findGeneratorsForCurrentTest() {
|
GeneratorsForTest* Context::findGeneratorsForCurrentTest() {
|
||||||
std::string testName = getCurrentContext().getResultCapture().getCurrentTestName();
|
std::string testName = getResultCapture().getCurrentTestName();
|
||||||
|
|
||||||
std::map<std::string, GeneratorsForTest*>::const_iterator it =
|
std::map<std::string, GeneratorsForTest*>::const_iterator it =
|
||||||
m_generatorsByTestName.find( testName );
|
m_generatorsByTestName.find( testName );
|
||||||
@ -3380,7 +3386,7 @@ namespace Catch {
|
|||||||
GeneratorsForTest& Context::getGeneratorsForCurrentTest() {
|
GeneratorsForTest& Context::getGeneratorsForCurrentTest() {
|
||||||
GeneratorsForTest* generators = findGeneratorsForCurrentTest();
|
GeneratorsForTest* generators = findGeneratorsForCurrentTest();
|
||||||
if( !generators ) {
|
if( !generators ) {
|
||||||
std::string testName = getCurrentContext().getResultCapture().getCurrentTestName();
|
std::string testName = getResultCapture().getCurrentTestName();
|
||||||
generators = new GeneratorsForTest();
|
generators = new GeneratorsForTest();
|
||||||
m_generatorsByTestName.insert( std::make_pair( testName, generators ) );
|
m_generatorsByTestName.insert( std::make_pair( testName, generators ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user