mirror of https://github.com/catchorg/Catch2.git
Regen single include
This commit is contained in:
parent
b323fc7e6c
commit
88b70828f2
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Generated: 2012-10-31 18:04:01.157950
|
||||
* Generated: 2012-11-04 21:39:24.756874
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||
|
@ -111,7 +111,7 @@ namespace Catch {
|
|||
friend std::ostream& operator << ( std::ostream& os, const pluralise& pluraliser ) {
|
||||
os << pluraliser.m_count << " " << pluraliser.m_label;
|
||||
if( pluraliser.m_count != 1 )
|
||||
os << "s";
|
||||
os << "s";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
@ -126,24 +126,14 @@ namespace Catch {
|
|||
: file( _file ),
|
||||
line( _line )
|
||||
{}
|
||||
SourceLineInfo( const std::string& _function, const std::string& _file, std::size_t _line )
|
||||
: function( _function ),
|
||||
file( _file ),
|
||||
line( _line )
|
||||
{}
|
||||
SourceLineInfo( const SourceLineInfo& other )
|
||||
: file( other.file ),
|
||||
line( other.line )
|
||||
{}
|
||||
void swap( SourceLineInfo& other ){
|
||||
file.swap( other.file );
|
||||
std::swap( line, other.line );
|
||||
}
|
||||
bool empty() const {
|
||||
return file.empty();
|
||||
}
|
||||
|
||||
std::string function;
|
||||
std::string file;
|
||||
std::size_t line;
|
||||
};
|
||||
|
@ -399,13 +389,15 @@ struct AutoReg {
|
|||
|
||||
template<typename C>
|
||||
AutoReg( void (C::*method)(),
|
||||
const char* className,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const SourceLineInfo& lineInfo ) {
|
||||
registerTestCase( new MethodTestCase<C>( method ), name, description, lineInfo );
|
||||
registerTestCase( new MethodTestCase<C>( method ), className, name, description, lineInfo );
|
||||
}
|
||||
|
||||
void registerTestCase( ITestCase* testCase,
|
||||
const char* className,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const SourceLineInfo& lineInfo );
|
||||
|
@ -433,7 +425,7 @@ private:
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, Name, Desc, CATCH_INTERNAL_LINEINFO ); }
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Name, Desc, CATCH_INTERNAL_LINEINFO ); }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define TEST_CASE_METHOD( ClassName, TestName, Desc )\
|
||||
|
@ -441,7 +433,7 @@ private:
|
|||
struct INTERNAL_CATCH_UNIQUE_NAME( TestCaseMethod_catch_internal_ ) : ClassName{ \
|
||||
void test(); \
|
||||
}; \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &INTERNAL_CATCH_UNIQUE_NAME( TestCaseMethod_catch_internal_ )::test, TestName, Desc, CATCH_INTERNAL_LINEINFO ); \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &INTERNAL_CATCH_UNIQUE_NAME( TestCaseMethod_catch_internal_ )::test, #ClassName, TestName, Desc, CATCH_INTERNAL_LINEINFO ); \
|
||||
} \
|
||||
void INTERNAL_CATCH_UNIQUE_NAME( TestCaseMethod_catch_internal_ )::test()
|
||||
|
||||
|
@ -688,7 +680,7 @@ namespace Catch {
|
|||
struct AssertionInfo
|
||||
{
|
||||
AssertionInfo() {}
|
||||
AssertionInfo( const std::string& _macroName, const SourceLineInfo& _lineInfo, const std::string& _capturedExpression, bool _shouldNegate )
|
||||
AssertionInfo( const std::string& _macroName, const SourceLineInfo& _lineInfo, const std::string& _capturedExpression = "", bool _shouldNegate = false )
|
||||
: macroName( _macroName ),
|
||||
lineInfo( _lineInfo ),
|
||||
capturedExpression( _capturedExpression )
|
||||
|
@ -1128,7 +1120,6 @@ namespace Catch {
|
|||
virtual void popScopedInfo( ScopedInfo* scopedInfo ) = 0;
|
||||
virtual bool shouldDebugBreak() const = 0;
|
||||
|
||||
virtual void acceptAssertionInfo( const AssertionInfo& assertionInfo ) = 0;
|
||||
virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult, const AssertionInfo& assertionInfo ) = 0;
|
||||
|
||||
virtual std::string getCurrentTestName() const = 0;
|
||||
|
@ -1269,14 +1260,17 @@ namespace Catch {
|
|||
TestCaseInfo();
|
||||
|
||||
TestCaseInfo( ITestCase* testCase,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const std::string& className,
|
||||
const std::string& name,
|
||||
const std::string& description,
|
||||
const SourceLineInfo& lineInfo );
|
||||
|
||||
TestCaseInfo( const TestCaseInfo& other, const std::string& name );
|
||||
TestCaseInfo( const TestCaseInfo& other );
|
||||
|
||||
void invoke() const;
|
||||
|
||||
const std::string& getClassName() const;
|
||||
const std::string& getName() const;
|
||||
const std::string& getDescription() const;
|
||||
const SourceLineInfo& getLineInfo() const;
|
||||
|
@ -1292,6 +1286,7 @@ namespace Catch {
|
|||
|
||||
private:
|
||||
Ptr<ITestCase> m_test;
|
||||
std::string m_className;
|
||||
std::string m_name;
|
||||
std::string m_description;
|
||||
std::set<std::string> m_tags;
|
||||
|
@ -1369,6 +1364,8 @@ namespace Catch {
|
|||
m_remainder += c;
|
||||
}
|
||||
|
||||
TagExtracter& operator=(const TagExtracter&);
|
||||
|
||||
std::set<std::string>& m_tags;
|
||||
std::string m_remainder;
|
||||
};
|
||||
|
@ -1472,6 +1469,8 @@ namespace Catch {
|
|||
m_exp.m_tagSets.push_back( m_currentTagSet );
|
||||
}
|
||||
|
||||
TagExpressionParser& operator=(const TagExpressionParser&);
|
||||
|
||||
bool m_isNegated;
|
||||
TagSet m_currentTagSet;
|
||||
TagExpression& m_exp;
|
||||
|
@ -2091,7 +2090,6 @@ inline bool isTrue( bool value ){ return value; }
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_ACCEPT_INFO( expr, macroName, shouldNegate ) \
|
||||
Catch::AssertionInfo INTERNAL_CATCH_ASSERTIONINFO_NAME( macroName, CATCH_INTERNAL_LINEINFO, expr, shouldNegate );
|
||||
// !TBD Catch::getResultCapture().acceptAssertionInfo( INTERNAL_CATCH_ASSERTIONINFO_NAME )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TEST( expr, shouldNegate, stopOnFailure, macroName ) \
|
||||
|
@ -3970,7 +3968,6 @@ namespace Catch {
|
|||
|
||||
do {
|
||||
do {
|
||||
m_assertionInfo.lineInfo = m_runningTest->getTestCaseInfo().getLineInfo();
|
||||
runCurrentTest( redirectedCout, redirectedCerr );
|
||||
}
|
||||
while( m_runningTest->hasUntestedSections() && !aborting() );
|
||||
|
@ -3992,14 +3989,9 @@ namespace Catch {
|
|||
|
||||
private: // IResultCapture
|
||||
|
||||
virtual void acceptAssertionInfo( const AssertionInfo& assertionInfo ) {
|
||||
m_assertionInfo = assertionInfo;
|
||||
}
|
||||
|
||||
virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult, const AssertionInfo& assertionInfo ) {
|
||||
m_assertionInfo = assertionInfo;
|
||||
m_currentResult = assertionResult;
|
||||
return actOnCurrentResult();
|
||||
m_lastAssertionInfo = assertionInfo;
|
||||
return actOnCurrentResult( assertionResult.buildResult( assertionInfo ) );
|
||||
}
|
||||
|
||||
virtual void testEnded( const AssertionResult& result ) {
|
||||
|
@ -4013,7 +4005,7 @@ namespace Catch {
|
|||
std::vector<ScopedInfo*>::const_iterator it = m_scopedInfos.begin();
|
||||
std::vector<ScopedInfo*>::const_iterator itEnd = m_scopedInfos.end();
|
||||
for(; it != itEnd; ++it )
|
||||
m_reporter->Result( (*it)->buildResult( m_assertionInfo ) );
|
||||
m_reporter->Result( (*it)->buildResult( m_lastAssertionInfo ) );
|
||||
}
|
||||
{
|
||||
std::vector<AssertionResult>::const_iterator it = m_assertionResults.begin();
|
||||
|
@ -4043,7 +4035,8 @@ namespace Catch {
|
|||
if( !m_runningTest->addSection( oss.str() ) )
|
||||
return false;
|
||||
|
||||
m_assertionInfo.lineInfo = lineInfo;
|
||||
m_lastAssertionInfo.lineInfo = lineInfo;
|
||||
|
||||
m_reporter->StartSection( name, description );
|
||||
assertions = m_totals.assertions;
|
||||
|
||||
|
@ -4094,13 +4087,10 @@ namespace Catch {
|
|||
|
||||
private:
|
||||
|
||||
ResultAction::Value actOnCurrentResult() {
|
||||
m_lastResult = m_currentResult.buildResult( m_assertionInfo );
|
||||
ResultAction::Value actOnCurrentResult( const AssertionResult& result ) {
|
||||
m_lastResult = result;
|
||||
testEnded( m_lastResult );
|
||||
|
||||
m_currentResult = ExpressionResultBuilder();
|
||||
m_assertionInfo = AssertionInfo();
|
||||
|
||||
ResultAction::Value action = ResultAction::None;
|
||||
|
||||
if( !m_lastResult.ok() ) {
|
||||
|
@ -4115,6 +4105,7 @@ namespace Catch {
|
|||
|
||||
void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ) {
|
||||
try {
|
||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", m_runningTest->getTestCaseInfo().getLineInfo() );
|
||||
m_runningTest->reset();
|
||||
Counts prevAssertions = m_totals.assertions;
|
||||
if( m_reporter->shouldRedirectStdout() ) {
|
||||
|
@ -4138,10 +4129,9 @@ namespace Catch {
|
|||
// This just means the test was aborted due to failure
|
||||
}
|
||||
catch(...) {
|
||||
m_currentResult
|
||||
.setResultType( ResultWas::ThrewException )
|
||||
<< translateActiveException();
|
||||
actOnCurrentResult();
|
||||
ExpressionResultBuilder exResult( ResultWas::ThrewException );
|
||||
exResult << translateActiveException();
|
||||
actOnCurrentResult( exResult.buildResult( m_lastAssertionInfo ) );
|
||||
}
|
||||
m_assertionResults.clear();
|
||||
}
|
||||
|
@ -4149,7 +4139,6 @@ namespace Catch {
|
|||
private:
|
||||
IMutableContext& m_context;
|
||||
RunningTest* m_runningTest;
|
||||
ExpressionResultBuilder m_currentResult;
|
||||
AssertionResult m_lastResult;
|
||||
|
||||
const Config& m_config;
|
||||
|
@ -4160,7 +4149,7 @@ namespace Catch {
|
|||
IRunner* m_prevRunner;
|
||||
IResultCapture* m_prevResultCapture;
|
||||
const IConfig* m_prevConfig;
|
||||
AssertionInfo m_assertionInfo;
|
||||
AssertionInfo m_lastAssertionInfo;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
@ -4515,22 +4504,37 @@ namespace Catch {
|
|||
TestFunction m_fun;
|
||||
};
|
||||
|
||||
inline std::string extractClassName( const std::string& classOrQualifiedMethodName ) {
|
||||
std::string className = classOrQualifiedMethodName;
|
||||
if( className[0] == '&' )
|
||||
{
|
||||
std::size_t lastColons = className.rfind( "::" );
|
||||
std::size_t penultimateColons = className.rfind( "::", lastColons-1 );
|
||||
if( penultimateColons == std::string::npos )
|
||||
penultimateColons = 1;
|
||||
className = className.substr( penultimateColons, lastColons-penultimateColons );
|
||||
}
|
||||
return className;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AutoReg::AutoReg( TestFunction function,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const SourceLineInfo& lineInfo ) {
|
||||
registerTestCase( new FreeFunctionTestCase( function ), name, description, lineInfo );
|
||||
registerTestCase( new FreeFunctionTestCase( function ), "global", name, description, lineInfo );
|
||||
}
|
||||
|
||||
AutoReg::~AutoReg() {}
|
||||
|
||||
void AutoReg::registerTestCase( ITestCase* testCase,
|
||||
const char* classOrQualifiedMethodName,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const SourceLineInfo& lineInfo ) {
|
||||
getMutableRegistryHub().registerTest( TestCaseInfo( testCase, name, description, lineInfo ) );
|
||||
|
||||
getMutableRegistryHub().registerTest( TestCaseInfo( testCase, extractClassName( classOrQualifiedMethodName ), name, description, lineInfo ) );
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
|
@ -4710,8 +4714,6 @@ namespace Catch {
|
|||
: m_lineInfo( lineInfo ) {
|
||||
std::ostringstream oss;
|
||||
oss << lineInfo << "function ";
|
||||
if( !lineInfo.function.empty() )
|
||||
oss << lineInfo.function << " ";
|
||||
oss << "not implemented";
|
||||
m_what = oss.str();
|
||||
}
|
||||
|
@ -4883,7 +4885,7 @@ namespace Catch {
|
|||
if( isatty( fileno(stdout) ) ) {
|
||||
switch( colour ) {
|
||||
case TextColour::FileName:
|
||||
std::cout << colourEscape << "[0m"; // white
|
||||
std::cout << colourEscape << "[0m"; // white/ normal
|
||||
break;
|
||||
case TextColour::ResultError:
|
||||
std::cout << colourEscape << "[1;31m"; // bold red
|
||||
|
@ -4904,7 +4906,7 @@ namespace Catch {
|
|||
std::cout << colourEscape << "[0;33m"; // yellow
|
||||
break;
|
||||
case TextColour::None:
|
||||
std::cout << colourEscape << "[0m"; // reset to white
|
||||
std::cout << colourEscape << "[0m"; // reset
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5217,10 +5219,12 @@ namespace Catch {
|
|||
namespace Catch {
|
||||
|
||||
TestCaseInfo::TestCaseInfo( ITestCase* testCase,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const std::string& className,
|
||||
const std::string& name,
|
||||
const std::string& description,
|
||||
const SourceLineInfo& lineInfo )
|
||||
: m_test( testCase ),
|
||||
m_className( className ),
|
||||
m_name( name ),
|
||||
m_description( description ),
|
||||
m_lineInfo( lineInfo ),
|
||||
|
@ -5233,6 +5237,7 @@ namespace Catch {
|
|||
|
||||
TestCaseInfo::TestCaseInfo()
|
||||
: m_test( NULL ),
|
||||
m_className(),
|
||||
m_name(),
|
||||
m_description(),
|
||||
m_isHidden( false )
|
||||
|
@ -5240,6 +5245,7 @@ namespace Catch {
|
|||
|
||||
TestCaseInfo::TestCaseInfo( const TestCaseInfo& other, const std::string& name )
|
||||
: m_test( other.m_test ),
|
||||
m_className( other.m_className ),
|
||||
m_name( name ),
|
||||
m_description( other.m_description ),
|
||||
m_tags( other.m_tags ),
|
||||
|
@ -5249,6 +5255,7 @@ namespace Catch {
|
|||
|
||||
TestCaseInfo::TestCaseInfo( const TestCaseInfo& other )
|
||||
: m_test( other.m_test ),
|
||||
m_className( other.m_className ),
|
||||
m_name( other.m_name ),
|
||||
m_description( other.m_description ),
|
||||
m_tags( other.m_tags ),
|
||||
|
@ -5260,14 +5267,15 @@ namespace Catch {
|
|||
m_test->invoke();
|
||||
}
|
||||
|
||||
const std::string& TestCaseInfo::getClassName() const {
|
||||
return m_className;
|
||||
}
|
||||
const std::string& TestCaseInfo::getName() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const std::string& TestCaseInfo::getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
|
||||
const SourceLineInfo& TestCaseInfo::getLineInfo() const {
|
||||
return m_lineInfo;
|
||||
}
|
||||
|
@ -5290,13 +5298,16 @@ namespace Catch {
|
|||
|
||||
void TestCaseInfo::swap( TestCaseInfo& other ) {
|
||||
m_test.swap( other.m_test );
|
||||
m_className.swap( other.m_className );
|
||||
m_name.swap( other.m_name );
|
||||
m_description.swap( other.m_description );
|
||||
m_lineInfo.swap( other.m_lineInfo );
|
||||
std::swap( m_lineInfo, other.m_lineInfo );
|
||||
}
|
||||
|
||||
bool TestCaseInfo::operator == ( const TestCaseInfo& other ) const {
|
||||
return m_test.get() == other.m_test.get() && m_name == other.m_name;
|
||||
return m_test.get() == other.m_test.get() &&
|
||||
m_name == other.m_name &&
|
||||
m_className == other.m_className;
|
||||
}
|
||||
|
||||
bool TestCaseInfo::operator < ( const TestCaseInfo& other ) const {
|
||||
|
@ -6018,7 +6029,10 @@ namespace Catch {
|
|||
|
||||
struct TestCaseStats {
|
||||
|
||||
TestCaseStats( const std::string& name = std::string() ) :m_name( name ){}
|
||||
TestCaseStats( const std::string& className, const std::string& name )
|
||||
: m_className( className ),
|
||||
m_name( name )
|
||||
{}
|
||||
|
||||
double m_timeInSeconds;
|
||||
std::string m_status;
|
||||
|
@ -6086,7 +6100,7 @@ namespace Catch {
|
|||
virtual void EndSection( const std::string&, const Counts& ) {}
|
||||
|
||||
virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) {
|
||||
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) );
|
||||
m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getClassName(), testInfo.getName() ) );
|
||||
}
|
||||
|
||||
virtual void Result( const Catch::AssertionResult& assertionResult ) {
|
||||
|
|
Loading…
Reference in New Issue