mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-27 14:55:40 +02:00
Compare commits
16 Commits
v1.3.0-dev
...
v1.3.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fdc42d0af4 | ||
![]() |
d274fc571c | ||
![]() |
7e15d9b20b | ||
![]() |
0e64973f55 | ||
![]() |
e4fa62a14e | ||
![]() |
a49f088032 | ||
![]() |
ed6e9128a4 | ||
![]() |
92356769f1 | ||
![]() |
d10b73f9f1 | ||
![]() |
71fd2c2fdf | ||
![]() |
d758428fe2 | ||
![]() |
bc00d59a4e | ||
![]() |
15317632f3 | ||
![]() |
a28d40e941 | ||
![]() |
7da777a4b7 | ||
![]() |
1dd0d4c61a |
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
*v1.3.0-develop.1*
|
*v1.3.0*
|
||||||
|
|
||||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
||||||
|
|
||||||
|
@@ -55,6 +55,16 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Exceptions
|
||||||
|
|
||||||
|
By default all exceptions deriving from `std::exception` will be translated to strings by calling the `what()` method. For exception types that do not derive from `std::exception` - or if `what()` does not return a suitable string - use `CATCH_TRANSLATE_EXCEPTION`. This defines a function that takes your exception type, by reference, and returns a string. It can appear anywhere in the code - it doesn't have to be in the same translation unit. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
CATCH_TRANSLATE_EXCEPTION( MyType& ex ) {
|
||||||
|
return ex.message();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[Home](Readme.md)
|
[Home](Readme.md)
|
||||||
|
@@ -99,6 +99,7 @@
|
|||||||
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||||
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
|
#define CATCH_REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||||
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
||||||
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
|
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
|
||||||
@@ -106,6 +107,7 @@
|
|||||||
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
|
#define CATCH_REGISTER_TEST_CASE( function, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( function, name, description )
|
||||||
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", msg )
|
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", msg )
|
||||||
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", msg )
|
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", msg )
|
||||||
@@ -166,6 +168,7 @@
|
|||||||
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||||
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||||
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
|
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||||
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
||||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
|
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
|
||||||
@@ -173,6 +176,7 @@
|
|||||||
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
|
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||||
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
|
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
|
||||||
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )
|
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )
|
||||||
|
@@ -131,7 +131,7 @@ namespace Catch {
|
|||||||
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
int applyCommandLine( int argc, char const* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
||||||
try {
|
try {
|
||||||
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
||||||
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
||||||
@@ -158,7 +158,7 @@ namespace Catch {
|
|||||||
m_config.reset();
|
m_config.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run( int argc, char* const argv[] ) {
|
int run( int argc, char const* const argv[] ) {
|
||||||
|
|
||||||
int returnCode = applyCommandLine( argc, argv );
|
int returnCode = applyCommandLine( argc, argv );
|
||||||
if( returnCode == 0 )
|
if( returnCode == 0 )
|
||||||
|
@@ -32,13 +32,13 @@ namespace Catch {
|
|||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
// In Objective-C try objective-c exceptions first
|
// In Objective-C try objective-c exceptions first
|
||||||
@try {
|
@try {
|
||||||
throw;
|
return tryTranslators();
|
||||||
}
|
}
|
||||||
@catch (NSException *exception) {
|
@catch (NSException *exception) {
|
||||||
return Catch::toString( [exception description] );
|
return Catch::toString( [exception description] );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
throw;
|
return tryTranslators();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch( TestFailureException& ) {
|
catch( TestFailureException& ) {
|
||||||
@@ -54,20 +54,15 @@ namespace Catch {
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
return tryTranslators( m_translators.begin() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string tryTranslators( std::vector<const IExceptionTranslator*>::const_iterator it ) const {
|
|
||||||
if( it == m_translators.end() )
|
|
||||||
return "Unknown exception";
|
return "Unknown exception";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
std::string tryTranslators() const {
|
||||||
return (*it)->translate();
|
if( m_translators.empty() )
|
||||||
}
|
throw;
|
||||||
catch(...) {
|
else
|
||||||
return tryTranslators( it+1 );
|
return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -9,15 +9,20 @@
|
|||||||
#define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "catch_interfaces_registry_hub.h"
|
#include "catch_interfaces_registry_hub.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
typedef std::string(*exceptionTranslateFunction)();
|
typedef std::string(*exceptionTranslateFunction)();
|
||||||
|
|
||||||
|
struct IExceptionTranslator;
|
||||||
|
typedef std::vector<const IExceptionTranslator*> ExceptionTranslators;
|
||||||
|
|
||||||
struct IExceptionTranslator {
|
struct IExceptionTranslator {
|
||||||
virtual ~IExceptionTranslator();
|
virtual ~IExceptionTranslator();
|
||||||
virtual std::string translate() const = 0;
|
virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IExceptionTranslatorRegistry {
|
struct IExceptionTranslatorRegistry {
|
||||||
@@ -35,9 +40,12 @@ namespace Catch {
|
|||||||
: m_translateFunction( translateFunction )
|
: m_translateFunction( translateFunction )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual std::string translate() const {
|
virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const CATCH_OVERRIDE {
|
||||||
try {
|
try {
|
||||||
|
if( it == itEnd )
|
||||||
throw;
|
throw;
|
||||||
|
else
|
||||||
|
return (*it)->translate( it+1, itEnd );
|
||||||
}
|
}
|
||||||
catch( T& ex ) {
|
catch( T& ex ) {
|
||||||
return m_translateFunction( ex );
|
return m_translateFunction( ex );
|
||||||
|
@@ -43,7 +43,8 @@ namespace Matchers {
|
|||||||
|
|
||||||
namespace Generic {
|
namespace Generic {
|
||||||
template<typename ExpressionT>
|
template<typename ExpressionT>
|
||||||
struct Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
|
class Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
|
||||||
|
public:
|
||||||
explicit Not( Matcher<ExpressionT> const& matcher ) : m_matcher(matcher.clone()) {}
|
explicit Not( Matcher<ExpressionT> const& matcher ) : m_matcher(matcher.clone()) {}
|
||||||
Not( Not const& other ) : m_matcher( other.m_matcher ) {}
|
Not( Not const& other ) : m_matcher( other.m_matcher ) {}
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ namespace Matchers {
|
|||||||
virtual std::string toString() const CATCH_OVERRIDE {
|
virtual std::string toString() const CATCH_OVERRIDE {
|
||||||
return "not " + m_matcher->toString();
|
return "not " + m_matcher->toString();
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
Ptr< Matcher<ExpressionT> > m_matcher;
|
Ptr< Matcher<ExpressionT> > m_matcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -96,8 +96,7 @@ namespace Catch {
|
|||||||
return m_os;
|
return m_os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions
|
||||||
#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement this functions
|
|
||||||
std::ostream& cout() {
|
std::ostream& cout() {
|
||||||
return std::cout;
|
return std::cout;
|
||||||
}
|
}
|
||||||
|
@@ -152,28 +152,37 @@ namespace Catch {
|
|||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void registerTestCase
|
||||||
|
( ITestCase* testCase,
|
||||||
AutoReg::AutoReg( TestFunction function,
|
|
||||||
SourceLineInfo const& lineInfo,
|
|
||||||
NameAndDesc const& nameAndDesc ) {
|
|
||||||
registerTestCase( new FreeFunctionTestCase( function ), "", nameAndDesc, lineInfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoReg::~AutoReg() {}
|
|
||||||
|
|
||||||
void AutoReg::registerTestCase( ITestCase* testCase,
|
|
||||||
char const* classOrQualifiedMethodName,
|
char const* classOrQualifiedMethodName,
|
||||||
NameAndDesc const& nameAndDesc,
|
NameAndDesc const& nameAndDesc,
|
||||||
SourceLineInfo const& lineInfo ) {
|
SourceLineInfo const& lineInfo ) {
|
||||||
|
|
||||||
getMutableRegistryHub().registerTest
|
getMutableRegistryHub().registerTest
|
||||||
( makeTestCase( testCase,
|
( makeTestCase
|
||||||
|
( testCase,
|
||||||
extractClassName( classOrQualifiedMethodName ),
|
extractClassName( classOrQualifiedMethodName ),
|
||||||
nameAndDesc.name,
|
nameAndDesc.name,
|
||||||
nameAndDesc.description,
|
nameAndDesc.description,
|
||||||
lineInfo ) );
|
lineInfo ) );
|
||||||
}
|
}
|
||||||
|
void registerTestCaseFunction
|
||||||
|
( TestFunction function,
|
||||||
|
SourceLineInfo const& lineInfo,
|
||||||
|
NameAndDesc const& nameAndDesc ) {
|
||||||
|
registerTestCase( new FreeFunctionTestCase( function ), "", nameAndDesc, lineInfo );
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
AutoReg::AutoReg
|
||||||
|
( TestFunction function,
|
||||||
|
SourceLineInfo const& lineInfo,
|
||||||
|
NameAndDesc const& nameAndDesc ) {
|
||||||
|
registerTestCaseFunction( function, lineInfo, nameAndDesc );
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoReg::~AutoReg() {}
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
|
@@ -42,28 +42,33 @@ struct NameAndDesc {
|
|||||||
const char* description;
|
const char* description;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void registerTestCase
|
||||||
|
( ITestCase* testCase,
|
||||||
|
char const* className,
|
||||||
|
NameAndDesc const& nameAndDesc,
|
||||||
|
SourceLineInfo const& lineInfo );
|
||||||
|
|
||||||
struct AutoReg {
|
struct AutoReg {
|
||||||
|
|
||||||
AutoReg( TestFunction function,
|
AutoReg
|
||||||
|
( TestFunction function,
|
||||||
SourceLineInfo const& lineInfo,
|
SourceLineInfo const& lineInfo,
|
||||||
NameAndDesc const& nameAndDesc );
|
NameAndDesc const& nameAndDesc );
|
||||||
|
|
||||||
template<typename C>
|
template<typename C>
|
||||||
AutoReg( void (C::*method)(),
|
AutoReg
|
||||||
|
( void (C::*method)(),
|
||||||
char const* className,
|
char const* className,
|
||||||
NameAndDesc const& nameAndDesc,
|
NameAndDesc const& nameAndDesc,
|
||||||
SourceLineInfo const& lineInfo ) {
|
SourceLineInfo const& lineInfo ) {
|
||||||
registerTestCase( new MethodTestCase<C>( method ),
|
|
||||||
|
registerTestCase
|
||||||
|
( new MethodTestCase<C>( method ),
|
||||||
className,
|
className,
|
||||||
nameAndDesc,
|
nameAndDesc,
|
||||||
lineInfo );
|
lineInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerTestCase( ITestCase* testCase,
|
|
||||||
char const* className,
|
|
||||||
NameAndDesc const& nameAndDesc,
|
|
||||||
SourceLineInfo const& lineInfo );
|
|
||||||
|
|
||||||
~AutoReg();
|
~AutoReg();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -71,6 +76,11 @@ private:
|
|||||||
void operator= ( AutoReg const& );
|
void operator= ( AutoReg const& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void registerTestCaseFunction
|
||||||
|
( TestFunction function,
|
||||||
|
SourceLineInfo const& lineInfo,
|
||||||
|
NameAndDesc const& nameAndDesc );
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
@@ -94,6 +104,10 @@ private:
|
|||||||
} \
|
} \
|
||||||
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
||||||
|
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
|
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
|
||||||
@@ -115,6 +129,9 @@ private:
|
|||||||
} \
|
} \
|
||||||
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
|
||||||
|
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
||||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 3, 0, "develop", 1 );
|
Version libraryVersion( 1, 3, 0, "", 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -356,7 +356,7 @@ due to unexpected exception with message:
|
|||||||
expected exception
|
expected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Unexpected custom exceptions can be translated
|
Non-std exceptions can be translated
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -365,6 +365,16 @@ ExceptionTests.cpp:<line number>: FAILED:
|
|||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
custom exception
|
custom exception
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Custom std-exceptions can be custom translated
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
due to unexpected exception with message:
|
||||||
|
custom std exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Custom exceptions can be translated when testing for nothrow
|
Custom exceptions can be translated when testing for nothrow
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -708,7 +718,7 @@ with expansion:
|
|||||||
"this string contains 'abc' as a substring" equals: "something else"
|
"this string contains 'abc' as a substring" equals: "something else"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Matchers can be composed with both + and | - failing
|
Matchers can be composed with both && and || - failing
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MiscTests.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -820,6 +830,6 @@ with expansion:
|
|||||||
"first" == "second"
|
"first" == "second"
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 165 | 123 passed | 41 failed | 1 failed as expected
|
test cases: 167 | 124 passed | 42 failed | 1 failed as expected
|
||||||
assertions: 912 | 817 passed | 82 failed | 13 failed as expected
|
assertions: 914 | 818 passed | 83 failed | 13 failed as expected
|
||||||
|
|
||||||
|
@@ -1217,7 +1217,7 @@ due to unexpected exception with message:
|
|||||||
expected exception
|
expected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Unexpected custom exceptions can be translated
|
Non-std exceptions can be translated
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -1226,6 +1226,16 @@ ExceptionTests.cpp:<line number>: FAILED:
|
|||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
custom exception
|
custom exception
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Custom std-exceptions can be custom translated
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
due to unexpected exception with message:
|
||||||
|
custom std exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Custom exceptions can be translated when testing for nothrow
|
Custom exceptions can be translated when testing for nothrow
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -3419,7 +3429,7 @@ with expansion:
|
|||||||
'abc' as a substring"
|
'abc' as a substring"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Matchers can be (AllOf) composed with the + operator
|
Matchers can be (AllOf) composed with the && operator
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MiscTests.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -3432,7 +3442,7 @@ with expansion:
|
|||||||
contains: "abc" and contains: "substring" and contains: "contains" )
|
contains: "abc" and contains: "substring" and contains: "contains" )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Matchers can be (AnyOf) composed with the | operator
|
Matchers can be (AnyOf) composed with the || operator
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MiscTests.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -3452,7 +3462,7 @@ with expansion:
|
|||||||
"string" or contains: "different" or contains: "random" )
|
"string" or contains: "different" or contains: "random" )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Matchers can be composed with both + and |
|
Matchers can be composed with both && and ||
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MiscTests.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -3465,7 +3475,7 @@ with expansion:
|
|||||||
contains: "different" ) and contains: "substring" )
|
contains: "different" ) and contains: "substring" )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Matchers can be composed with both + and | - failing
|
Matchers can be composed with both && and || - failing
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
MiscTests.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -5994,6 +6004,17 @@ with expansion:
|
|||||||
************************
|
************************
|
||||||
... message truncated due to excessive size
|
... message truncated due to excessive size
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ManuallyRegistered
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
TestMain.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
with message:
|
||||||
|
was called
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Parsing a std::pair
|
Parsing a std::pair
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -9024,6 +9045,6 @@ with expansion:
|
|||||||
1 > 0
|
1 > 0
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 165 | 122 passed | 42 failed | 1 failed as expected
|
test cases: 167 | 123 passed | 43 failed | 1 failed as expected
|
||||||
assertions: 914 | 817 passed | 84 failed | 13 failed as expected
|
assertions: 916 | 818 passed | 85 failed | 13 failed as expected
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="CatchSelfTest" errors="12" failures="72" tests="914" hostname="tbd" time="{duration}" timestamp="tbd">
|
<testsuite name="CatchSelfTest" errors="13" failures="72" tests="916" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||||
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
||||||
@@ -226,9 +226,15 @@ expected exception
|
|||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
</error>
|
</error>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="global" name="Unexpected custom exceptions can be translated" time="{duration}">
|
<testcase classname="global" name="Non-std exceptions can be translated" time="{duration}">
|
||||||
<error type="TEST_CASE">
|
<error type="TEST_CASE">
|
||||||
custom exception
|
custom exception
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
</error>
|
||||||
|
</testcase>
|
||||||
|
<testcase classname="global" name="Custom std-exceptions can be custom translated" time="{duration}">
|
||||||
|
<error type="TEST_CASE">
|
||||||
|
custom std exception
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
</error>
|
</error>
|
||||||
</testcase>
|
</testcase>
|
||||||
@@ -438,10 +444,10 @@ MiscTests.cpp:<line number>
|
|||||||
<testcase classname="global" name="AllOf matcher" time="{duration}"/>
|
<testcase classname="global" name="AllOf matcher" time="{duration}"/>
|
||||||
<testcase classname="global" name="AnyOf matcher" time="{duration}"/>
|
<testcase classname="global" name="AnyOf matcher" time="{duration}"/>
|
||||||
<testcase classname="global" name="Equals" time="{duration}"/>
|
<testcase classname="global" name="Equals" time="{duration}"/>
|
||||||
<testcase classname="global" name="Matchers can be (AllOf) composed with the + operator" time="{duration}"/>
|
<testcase classname="global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}"/>
|
||||||
<testcase classname="global" name="Matchers can be (AnyOf) composed with the | operator" time="{duration}"/>
|
<testcase classname="global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}"/>
|
||||||
<testcase classname="global" name="Matchers can be composed with both + and |" time="{duration}"/>
|
<testcase classname="global" name="Matchers can be composed with both && and ||" time="{duration}"/>
|
||||||
<testcase classname="global" name="Matchers can be composed with both + and | - failing" time="{duration}">
|
<testcase classname="global" name="Matchers can be composed with both && and || - failing" time="{duration}">
|
||||||
<failure message=""this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )" type="CHECK_THAT">
|
<failure message=""this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )" type="CHECK_THAT">
|
||||||
MiscTests.cpp:<line number>
|
MiscTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
@@ -541,6 +547,7 @@ hello
|
|||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="global" name="Text can be formatted using the Text class" time="{duration}"/>
|
<testcase classname="global" name="Text can be formatted using the Text class" time="{duration}"/>
|
||||||
<testcase classname="global" name="Long text is truncted" time="{duration}"/>
|
<testcase classname="global" name="Long text is truncted" time="{duration}"/>
|
||||||
|
<testcase classname="global" name="ManuallyRegistered" time="{duration}"/>
|
||||||
<testcase classname="global" name="Parsing a std::pair" time="{duration}"/>
|
<testcase classname="global" name="Parsing a std::pair" time="{duration}"/>
|
||||||
<testcase classname="global" name="Where there is more to the expression after the RHS" time="{duration}"/>
|
<testcase classname="global" name="Where there is more to the expression after the RHS" time="{duration}"/>
|
||||||
<testcase classname="global" name="Where the LHS is not a simple value" time="{duration}"/>
|
<testcase classname="global" name="Where the LHS is not a simple value" time="{duration}"/>
|
||||||
|
@@ -1545,12 +1545,18 @@
|
|||||||
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test">
|
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test">
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Unexpected custom exceptions can be translated">
|
<TestCase name="Non-std exceptions can be translated">
|
||||||
<Exception filename="projects/SelfTest/ExceptionTests.cpp" >
|
<Exception filename="projects/SelfTest/ExceptionTests.cpp" >
|
||||||
custom exception
|
custom exception
|
||||||
</Exception>
|
</Exception>
|
||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="Custom std-exceptions can be custom translated">
|
||||||
|
<Exception filename="projects/SelfTest/ExceptionTests.cpp" >
|
||||||
|
custom std exception
|
||||||
|
</Exception>
|
||||||
|
<OverallResult success="false"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Custom exceptions can be translated when testing for nothrow">
|
<TestCase name="Custom exceptions can be translated when testing for nothrow">
|
||||||
<Expression success="false" type="REQUIRE_NOTHROW" filename="projects/SelfTest/ExceptionTests.cpp" >
|
<Expression success="false" type="REQUIRE_NOTHROW" filename="projects/SelfTest/ExceptionTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@@ -3590,7 +3596,7 @@
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Matchers can be (AllOf) composed with the + operator">
|
<TestCase name="Matchers can be (AllOf) composed with the && operator">
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
testStringForMatching() Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" )
|
testStringForMatching() Contains( "string" ) && Contains( "abc" ) && Contains( "substring" ) && Contains( "contains" )
|
||||||
@@ -3601,7 +3607,7 @@
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Matchers can be (AnyOf) composed with the | operator">
|
<TestCase name="Matchers can be (AnyOf) composed with the || operator">
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
testStringForMatching() Contains( "string" ) || Contains( "different" ) || Contains( "random" )
|
testStringForMatching() Contains( "string" ) || Contains( "different" ) || Contains( "random" )
|
||||||
@@ -3620,7 +3626,7 @@
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Matchers can be composed with both + and |">
|
<TestCase name="Matchers can be composed with both && and ||">
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" )
|
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" )
|
||||||
@@ -3631,7 +3637,7 @@
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Matchers can be composed with both + and | - failing">
|
<TestCase name="Matchers can be composed with both && and || - failing">
|
||||||
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" )
|
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" )
|
||||||
@@ -6278,6 +6284,9 @@ there"
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="ManuallyRegistered">
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Parsing a std::pair">
|
<TestCase name="Parsing a std::pair">
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/TrickyTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/TrickyTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@@ -9496,7 +9505,7 @@ there"
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="817" failures="84" expectedFailures="13"/>
|
<OverallResults successes="818" failures="85" expectedFailures="13"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="817" failures="84" expectedFailures="13"/>
|
<OverallResults successes="818" failures="85" expectedFailures="13"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@@ -106,22 +106,51 @@ private:
|
|||||||
std::string m_msg;
|
std::string m_msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CustomStdException : public std::exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CustomStdException( const std::string& msg )
|
||||||
|
: m_msg( msg )
|
||||||
|
{}
|
||||||
|
~CustomStdException() CATCH_NOEXCEPT {}
|
||||||
|
|
||||||
|
std::string getMessage() const
|
||||||
|
{
|
||||||
|
return m_msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_msg;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
CATCH_TRANSLATE_EXCEPTION( CustomException& ex )
|
CATCH_TRANSLATE_EXCEPTION( CustomException& ex )
|
||||||
{
|
{
|
||||||
return ex.getMessage();
|
return ex.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CATCH_TRANSLATE_EXCEPTION( CustomStdException& ex )
|
||||||
|
{
|
||||||
|
return ex.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
CATCH_TRANSLATE_EXCEPTION( double& ex )
|
CATCH_TRANSLATE_EXCEPTION( double& ex )
|
||||||
{
|
{
|
||||||
return Catch::toString( ex );
|
return Catch::toString( ex );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Unexpected custom exceptions can be translated", "[.][failing]" )
|
TEST_CASE("Non-std exceptions can be translated", "[.][failing]" )
|
||||||
{
|
{
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw CustomException( "custom exception" );
|
throw CustomException( "custom exception" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing]" )
|
||||||
|
{
|
||||||
|
if( Catch::alwaysTrue() )
|
||||||
|
throw CustomException( "custom std exception" );
|
||||||
|
}
|
||||||
|
|
||||||
inline void throwCustom() {
|
inline void throwCustom() {
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw CustomException( "custom exception - not std" );
|
throw CustomException( "custom exception - not std" );
|
||||||
|
@@ -262,7 +262,7 @@ TEST_CASE("Equals", "[matchers]")
|
|||||||
CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) );
|
CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Matchers can be (AllOf) composed with the + operator", "[matchers][operators][operator+]")
|
TEST_CASE("Matchers can be (AllOf) composed with the && operator", "[matchers][operators][operator&&]")
|
||||||
{
|
{
|
||||||
CHECK_THAT( testStringForMatching(),
|
CHECK_THAT( testStringForMatching(),
|
||||||
Contains( "string" ) &&
|
Contains( "string" ) &&
|
||||||
@@ -271,18 +271,18 @@ TEST_CASE("Matchers can be (AllOf) composed with the + operator", "[matchers][op
|
|||||||
Contains( "contains" ) );
|
Contains( "contains" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Matchers can be (AnyOf) composed with the | operator", "[matchers][operators][operator|]")
|
TEST_CASE("Matchers can be (AnyOf) composed with the || operator", "[matchers][operators][operator||]")
|
||||||
{
|
{
|
||||||
CHECK_THAT( testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) );
|
CHECK_THAT( testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) );
|
||||||
CHECK_THAT( testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) );
|
CHECK_THAT( testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Matchers can be composed with both + and |", "[matchers][operators][operator|][operator+]")
|
TEST_CASE("Matchers can be composed with both && and ||", "[matchers][operators][operator||][operator&&]")
|
||||||
{
|
{
|
||||||
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) );
|
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Matchers can be composed with both + and | - failing", "[matchers][operators][operator|][operator+][.failing]")
|
TEST_CASE("Matchers can be composed with both && and || - failing", "[matchers][operators][operator||][operator&&][.failing]")
|
||||||
{
|
{
|
||||||
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) );
|
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) );
|
||||||
}
|
}
|
||||||
|
@@ -449,3 +449,13 @@ TEST_CASE( "Long text is truncted", "[Text][Truncated]" ) {
|
|||||||
CHECK_THAT( t.toString(), EndsWith( "... message truncated due to excessive size" ) );
|
CHECK_THAT( t.toString(), EndsWith( "... message truncated due to excessive size" ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void manuallyRegisteredTestFunction() {
|
||||||
|
SUCCEED( "was called" );
|
||||||
|
}
|
||||||
|
struct AutoTestReg {
|
||||||
|
AutoTestReg() {
|
||||||
|
REGISTER_TEST_CASE( manuallyRegisteredTestFunction, "ManuallyRegistered", "" );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AutoTestReg autoTestReg;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v1.3.0-develop.1
|
* Catch v1.3.0
|
||||||
* Generated: 2015-11-05 18:47:08.462966
|
* Generated: 2015-12-04 10:18:17.055188
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* This file has been merged from multiple headers. Please don't edit it directly
|
* This file has been merged from multiple headers. Please don't edit it directly
|
||||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@@ -629,28 +629,33 @@ struct NameAndDesc {
|
|||||||
const char* description;
|
const char* description;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void registerTestCase
|
||||||
|
( ITestCase* testCase,
|
||||||
|
char const* className,
|
||||||
|
NameAndDesc const& nameAndDesc,
|
||||||
|
SourceLineInfo const& lineInfo );
|
||||||
|
|
||||||
struct AutoReg {
|
struct AutoReg {
|
||||||
|
|
||||||
AutoReg( TestFunction function,
|
AutoReg
|
||||||
|
( TestFunction function,
|
||||||
SourceLineInfo const& lineInfo,
|
SourceLineInfo const& lineInfo,
|
||||||
NameAndDesc const& nameAndDesc );
|
NameAndDesc const& nameAndDesc );
|
||||||
|
|
||||||
template<typename C>
|
template<typename C>
|
||||||
AutoReg( void (C::*method)(),
|
AutoReg
|
||||||
|
( void (C::*method)(),
|
||||||
char const* className,
|
char const* className,
|
||||||
NameAndDesc const& nameAndDesc,
|
NameAndDesc const& nameAndDesc,
|
||||||
SourceLineInfo const& lineInfo ) {
|
SourceLineInfo const& lineInfo ) {
|
||||||
registerTestCase( new MethodTestCase<C>( method ),
|
|
||||||
|
registerTestCase
|
||||||
|
( new MethodTestCase<C>( method ),
|
||||||
className,
|
className,
|
||||||
nameAndDesc,
|
nameAndDesc,
|
||||||
lineInfo );
|
lineInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerTestCase( ITestCase* testCase,
|
|
||||||
char const* className,
|
|
||||||
NameAndDesc const& nameAndDesc,
|
|
||||||
SourceLineInfo const& lineInfo );
|
|
||||||
|
|
||||||
~AutoReg();
|
~AutoReg();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -658,6 +663,11 @@ private:
|
|||||||
void operator= ( AutoReg const& );
|
void operator= ( AutoReg const& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void registerTestCaseFunction
|
||||||
|
( TestFunction function,
|
||||||
|
SourceLineInfo const& lineInfo,
|
||||||
|
NameAndDesc const& nameAndDesc );
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
@@ -681,6 +691,10 @@ private:
|
|||||||
} \
|
} \
|
||||||
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
||||||
|
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
|
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
|
||||||
@@ -702,6 +716,9 @@ private:
|
|||||||
} \
|
} \
|
||||||
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test()
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
|
||||||
|
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #included from: internal/catch_capture.hpp
|
// #included from: internal/catch_capture.hpp
|
||||||
@@ -862,7 +879,8 @@ namespace Matchers {
|
|||||||
|
|
||||||
namespace Generic {
|
namespace Generic {
|
||||||
template<typename ExpressionT>
|
template<typename ExpressionT>
|
||||||
struct Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
|
class Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
|
||||||
|
public:
|
||||||
explicit Not( Matcher<ExpressionT> const& matcher ) : m_matcher(matcher.clone()) {}
|
explicit Not( Matcher<ExpressionT> const& matcher ) : m_matcher(matcher.clone()) {}
|
||||||
Not( Not const& other ) : m_matcher( other.m_matcher ) {}
|
Not( Not const& other ) : m_matcher( other.m_matcher ) {}
|
||||||
|
|
||||||
@@ -873,7 +891,7 @@ namespace Matchers {
|
|||||||
virtual std::string toString() const CATCH_OVERRIDE {
|
virtual std::string toString() const CATCH_OVERRIDE {
|
||||||
return "not " + m_matcher->toString();
|
return "not " + m_matcher->toString();
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
Ptr< Matcher<ExpressionT> > m_matcher;
|
Ptr< Matcher<ExpressionT> > m_matcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2453,6 +2471,8 @@ using namespace Generators;
|
|||||||
#define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// #included from: catch_interfaces_registry_hub.h
|
// #included from: catch_interfaces_registry_hub.h
|
||||||
#define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
|
||||||
|
|
||||||
@@ -2490,14 +2510,16 @@ namespace Catch {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
typedef std::string(*exceptionTranslateFunction)();
|
typedef std::string(*exceptionTranslateFunction)();
|
||||||
|
|
||||||
|
struct IExceptionTranslator;
|
||||||
|
typedef std::vector<const IExceptionTranslator*> ExceptionTranslators;
|
||||||
|
|
||||||
struct IExceptionTranslator {
|
struct IExceptionTranslator {
|
||||||
virtual ~IExceptionTranslator();
|
virtual ~IExceptionTranslator();
|
||||||
virtual std::string translate() const = 0;
|
virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IExceptionTranslatorRegistry {
|
struct IExceptionTranslatorRegistry {
|
||||||
@@ -2515,9 +2537,12 @@ namespace Catch {
|
|||||||
: m_translateFunction( translateFunction )
|
: m_translateFunction( translateFunction )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual std::string translate() const {
|
virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const CATCH_OVERRIDE {
|
||||||
try {
|
try {
|
||||||
|
if( it == itEnd )
|
||||||
throw;
|
throw;
|
||||||
|
else
|
||||||
|
return (*it)->translate( it+1, itEnd );
|
||||||
}
|
}
|
||||||
catch( T& ex ) {
|
catch( T& ex ) {
|
||||||
return m_translateFunction( ex );
|
return m_translateFunction( ex );
|
||||||
@@ -6058,7 +6083,7 @@ namespace Catch {
|
|||||||
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int applyCommandLine( int argc, char* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
int applyCommandLine( int argc, char const* const argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
|
||||||
try {
|
try {
|
||||||
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
|
||||||
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
|
||||||
@@ -6085,7 +6110,7 @@ namespace Catch {
|
|||||||
m_config.reset();
|
m_config.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run( int argc, char* const argv[] ) {
|
int run( int argc, char const* const argv[] ) {
|
||||||
|
|
||||||
int returnCode = applyCommandLine( argc, argv );
|
int returnCode = applyCommandLine( argc, argv );
|
||||||
if( returnCode == 0 )
|
if( returnCode == 0 )
|
||||||
@@ -6288,28 +6313,37 @@ namespace Catch {
|
|||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
void registerTestCase
|
||||||
|
( ITestCase* testCase,
|
||||||
AutoReg::AutoReg( TestFunction function,
|
|
||||||
SourceLineInfo const& lineInfo,
|
|
||||||
NameAndDesc const& nameAndDesc ) {
|
|
||||||
registerTestCase( new FreeFunctionTestCase( function ), "", nameAndDesc, lineInfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoReg::~AutoReg() {}
|
|
||||||
|
|
||||||
void AutoReg::registerTestCase( ITestCase* testCase,
|
|
||||||
char const* classOrQualifiedMethodName,
|
char const* classOrQualifiedMethodName,
|
||||||
NameAndDesc const& nameAndDesc,
|
NameAndDesc const& nameAndDesc,
|
||||||
SourceLineInfo const& lineInfo ) {
|
SourceLineInfo const& lineInfo ) {
|
||||||
|
|
||||||
getMutableRegistryHub().registerTest
|
getMutableRegistryHub().registerTest
|
||||||
( makeTestCase( testCase,
|
( makeTestCase
|
||||||
|
( testCase,
|
||||||
extractClassName( classOrQualifiedMethodName ),
|
extractClassName( classOrQualifiedMethodName ),
|
||||||
nameAndDesc.name,
|
nameAndDesc.name,
|
||||||
nameAndDesc.description,
|
nameAndDesc.description,
|
||||||
lineInfo ) );
|
lineInfo ) );
|
||||||
}
|
}
|
||||||
|
void registerTestCaseFunction
|
||||||
|
( TestFunction function,
|
||||||
|
SourceLineInfo const& lineInfo,
|
||||||
|
NameAndDesc const& nameAndDesc ) {
|
||||||
|
registerTestCase( new FreeFunctionTestCase( function ), "", nameAndDesc, lineInfo );
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
AutoReg::AutoReg
|
||||||
|
( TestFunction function,
|
||||||
|
SourceLineInfo const& lineInfo,
|
||||||
|
NameAndDesc const& nameAndDesc ) {
|
||||||
|
registerTestCaseFunction( function, lineInfo, nameAndDesc );
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoReg::~AutoReg() {}
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
@@ -6377,13 +6411,13 @@ namespace Catch {
|
|||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
// In Objective-C try objective-c exceptions first
|
// In Objective-C try objective-c exceptions first
|
||||||
@try {
|
@try {
|
||||||
throw;
|
return tryTranslators();
|
||||||
}
|
}
|
||||||
@catch (NSException *exception) {
|
@catch (NSException *exception) {
|
||||||
return Catch::toString( [exception description] );
|
return Catch::toString( [exception description] );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
throw;
|
return tryTranslators();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch( TestFailureException& ) {
|
catch( TestFailureException& ) {
|
||||||
@@ -6399,20 +6433,15 @@ namespace Catch {
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
return tryTranslators( m_translators.begin() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string tryTranslators( std::vector<const IExceptionTranslator*>::const_iterator it ) const {
|
|
||||||
if( it == m_translators.end() )
|
|
||||||
return "Unknown exception";
|
return "Unknown exception";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
std::string tryTranslators() const {
|
||||||
return (*it)->translate();
|
if( m_translators.empty() )
|
||||||
}
|
throw;
|
||||||
catch(...) {
|
else
|
||||||
return tryTranslators( it+1 );
|
return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -6598,7 +6627,7 @@ namespace Catch {
|
|||||||
return m_os;
|
return m_os;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement this functions
|
#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions
|
||||||
std::ostream& cout() {
|
std::ostream& cout() {
|
||||||
return std::cout;
|
return std::cout;
|
||||||
}
|
}
|
||||||
@@ -7238,7 +7267,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 3, 0, "develop", 1 );
|
Version libraryVersion( 1, 3, 0, "", 0 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10058,6 +10087,7 @@ int main (int argc, char * const argv[]) {
|
|||||||
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||||
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
|
#define CATCH_REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||||
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
||||||
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
|
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
|
||||||
@@ -10065,6 +10095,7 @@ int main (int argc, char * const argv[]) {
|
|||||||
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
|
#define CATCH_REGISTER_TEST_CASE( function, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( function, name, description )
|
||||||
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", msg )
|
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", msg )
|
||||||
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", msg )
|
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", msg )
|
||||||
@@ -10125,6 +10156,7 @@ int main (int argc, char * const argv[]) {
|
|||||||
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||||
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||||
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
|
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||||
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
||||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
|
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
|
||||||
@@ -10132,6 +10164,7 @@ int main (int argc, char * const argv[]) {
|
|||||||
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
|
#define REGISTER_TEST_CASE( ... ) INTERNAL_CATCH_REGISTER_TESTCASE( __VA_ARGS__ )
|
||||||
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
|
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
|
||||||
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )
|
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )
|
||||||
|
Reference in New Issue
Block a user