Gutted catch_compiler_capabilities

All C++11 toggles are now removed. What is left is either platform
specific (POSIX_SIGNALS, WINDOWS_SEH), or possibly still needed
(USE_COUNTER).

If current CLion is compatible with `__COUNTER__`, then we should also
force `__COUNTER__` usage.

Changed
* CATCH_AUTO_PTR    -> std::unique_ptr
* CATCH_OVERRIDE    -> override
* CATCH_NULL        -> nullptr
* CATCH_NOEXCEPT    -> noexcept
* CATCH_NOEXCEPT_IS -> noexcept

Removed
* CATCH_CONFIG_CPP11_UNIQUE_PTR
* CATCH_CONFIG_CPP11_SHUFFLE
* CATCH_CONFIG_CPP11_TYPE_TRAITS
* CATCH_CONFIG_CPP11_OVERRIDE
* CATCH_CONFIG_CPP11_LONG_LONG
* CATCH_CONFIG_CPP11_TUPLE
* CATCH_CONFIG_CPP11_IS_ENUM
* CATCH_CONFIG_CPP11_GENERATED_METHODS
* CATCH_CONFIG_CPP11_NOEXCEPT
* CATCH_CONFIG_CPP11_NULLPTR
* CATCH_CONFIG_VARIADIC_MACROS
This commit is contained in:
Martin Hořeňovský 2017-04-25 12:41:30 +02:00
parent 97707afae1
commit 71df66365e
53 changed files with 261 additions and 550 deletions

View File

@ -130,25 +130,15 @@ LeakDetector leakDetector;
#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) ) #define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) )
#define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) ) #define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) )
#ifdef CATCH_CONFIG_VARIADIC_MACROS #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( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __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_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
#else
#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_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_FAIL( msg ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, msg )
#define CATCH_FAIL_CHECK( msg ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, msg )
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, msg )
#endif
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" ) #define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) #define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
@ -157,13 +147,8 @@ LeakDetector leakDetector;
#define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr ) #define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
// "BDD-style" convenience wrappers // "BDD-style" convenience wrappers
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ ) #define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
#else
#define CATCH_SCENARIO( name, tags ) CATCH_TEST_CASE( "Scenario: " name, tags )
#define CATCH_SCENARIO_METHOD( className, name, tags ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " name, tags )
#endif
#define CATCH_GIVEN( desc ) CATCH_SECTION( std::string( "Given: ") + desc, "" ) #define CATCH_GIVEN( desc ) CATCH_SECTION( std::string( "Given: ") + desc, "" )
#define CATCH_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + desc, "" ) #define CATCH_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + desc, "" )
#define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( " And: ") + desc, "" ) #define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( " And: ") + desc, "" )
@ -213,7 +198,6 @@ LeakDetector leakDetector;
#define CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) ) #define CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) )
#define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) ) #define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) )
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#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__ )
@ -222,16 +206,6 @@ LeakDetector leakDetector;
#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
#else
#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 METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
#define REGISTER_TEST_CASE( method, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( method, name, description )
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
#define FAIL( msg ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, msg )
#define FAIL_CHECK( msg ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, msg )
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, msg )
#endif
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" ) #define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) #define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
@ -244,13 +218,9 @@ LeakDetector leakDetector;
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) #define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
// "BDD-style" convenience wrappers // "BDD-style" convenience wrappers
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ ) #define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ )
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
#else
#define SCENARIO( name, tags ) TEST_CASE( "Scenario: " name, tags )
#define SCENARIO_METHOD( className, name, tags ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " name, tags )
#endif
#define GIVEN( desc ) SECTION( std::string(" Given: ") + desc, "" ) #define GIVEN( desc ) SECTION( std::string(" Given: ") + desc, "" )
#define WHEN( desc ) SECTION( std::string(" When: ") + desc, "" ) #define WHEN( desc ) SECTION( std::string(" When: ") + desc, "" )
#define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc, "" ) #define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc, "" )

View File

@ -53,7 +53,7 @@ namespace Catch {
struct AssertionResultData struct AssertionResultData
{ {
AssertionResultData() : decomposedExpression( CATCH_NULL ) AssertionResultData() : decomposedExpression( nullptr )
, resultType( ResultWas::Unknown ) , resultType( ResultWas::Unknown )
, negated( false ) , negated( false )
, parenthesized( false ) {} , parenthesized( false ) {}
@ -68,7 +68,7 @@ namespace Catch {
} }
std::string const& reconstructExpression() const { std::string const& reconstructExpression() const {
if( decomposedExpression != CATCH_NULL ) { if( decomposedExpression != nullptr ) {
decomposedExpression->reconstructExpression( reconstructedExpression ); decomposedExpression->reconstructExpression( reconstructedExpression );
if( parenthesized ) { if( parenthesized ) {
reconstructedExpression.insert( 0, 1, '(' ); reconstructedExpression.insert( 0, 1, '(' );
@ -77,7 +77,7 @@ namespace Catch {
if( negated ) { if( negated ) {
reconstructedExpression.insert( 0, 1, '!' ); reconstructedExpression.insert( 0, 1, '!' );
} }
decomposedExpression = CATCH_NULL; decomposedExpression = nullptr;
} }
return reconstructedExpression; return reconstructedExpression;
} }
@ -95,12 +95,11 @@ namespace Catch {
AssertionResult(); AssertionResult();
AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
~AssertionResult(); ~AssertionResult();
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
AssertionResult( AssertionResult const& ) = default; AssertionResult( AssertionResult const& ) = default;
AssertionResult( AssertionResult && ) = default; AssertionResult( AssertionResult && ) = default;
AssertionResult& operator = ( AssertionResult const& ) = default; AssertionResult& operator = ( AssertionResult const& ) = default;
AssertionResult& operator = ( AssertionResult && ) = default; AssertionResult& operator = ( AssertionResult && ) = default;
# endif
bool isOk() const; bool isOk() const;
bool succeeded() const; bool succeeded() const;

View File

@ -87,7 +87,7 @@ namespace Catch {
} }
void AssertionResult::discardDecomposedExpression() const { void AssertionResult::discardDecomposedExpression() const {
m_resultData.decomposedExpression = CATCH_NULL; m_resultData.decomposedExpression = nullptr;
} }
void AssertionResult::expandDecomposedExpression() const { void AssertionResult::expandDecomposedExpression() const {

View File

@ -143,7 +143,6 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
do { \ do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
@ -151,15 +150,6 @@
__catchResult.captureResult( messageType ); \ __catchResult.captureResult( messageType ); \
INTERNAL_CATCH_REACT( __catchResult ) \ INTERNAL_CATCH_REACT( __catchResult ) \
} while( Catch::alwaysFalse() ) } while( Catch::alwaysFalse() )
#else
#define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, log ) \
do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
__catchResult << log + ::Catch::StreamEndStop(); \
__catchResult.captureResult( messageType ); \
INTERNAL_CATCH_REACT( __catchResult ) \
} while( Catch::alwaysFalse() )
#endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_INFO( macroName, log ) \ #define INTERNAL_CATCH_INFO( macroName, log ) \

View File

@ -34,15 +34,10 @@ namespace Catch {
}; }; }; };
class NonCopyable { class NonCopyable {
#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
NonCopyable( NonCopyable const& ) = delete; NonCopyable( NonCopyable const& ) = delete;
NonCopyable( NonCopyable && ) = delete; NonCopyable( NonCopyable && ) = delete;
NonCopyable& operator = ( NonCopyable const& ) = delete; NonCopyable& operator = ( NonCopyable const& ) = delete;
NonCopyable& operator = ( NonCopyable && ) = delete; NonCopyable& operator = ( NonCopyable && ) = delete;
#else
NonCopyable( NonCopyable const& info );
NonCopyable& operator = ( NonCopyable const& );
#endif
protected: protected:
NonCopyable() {} NonCopyable() {}
@ -94,12 +89,12 @@ namespace Catch {
SourceLineInfo(); SourceLineInfo();
SourceLineInfo( char const* _file, std::size_t _line ); SourceLineInfo( char const* _file, std::size_t _line );
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
SourceLineInfo(SourceLineInfo const& other) = default; SourceLineInfo(SourceLineInfo const& other) = default;
SourceLineInfo( SourceLineInfo && ) = default; SourceLineInfo( SourceLineInfo && ) = default;
SourceLineInfo& operator = ( SourceLineInfo const& ) = default; SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
SourceLineInfo& operator = ( SourceLineInfo && ) = default; SourceLineInfo& operator = ( SourceLineInfo && ) = default;
# endif
bool empty() const; bool empty() const;
bool operator == ( SourceLineInfo const& other ) const; bool operator == ( SourceLineInfo const& other ) const;
bool operator < ( SourceLineInfo const& other ) const; bool operator < ( SourceLineInfo const& other ) const;

View File

@ -8,23 +8,9 @@
#ifndef TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED #define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
// Detect a number of compiler features - mostly C++11/14 conformance - by compiler // Detect a number of compiler features - by compiler
// The following features are defined: // The following features are defined:
// //
// CATCH_CONFIG_CPP11_NULLPTR : is nullptr supported?
// CATCH_CONFIG_CPP11_NOEXCEPT : is noexcept supported?
// CATCH_CONFIG_CPP11_GENERATED_METHODS : The delete and default keywords for compiler generated methods
// CATCH_CONFIG_CPP11_IS_ENUM : std::is_enum is supported?
// CATCH_CONFIG_CPP11_TUPLE : std::tuple is supported
// CATCH_CONFIG_CPP11_LONG_LONG : is long long supported?
// CATCH_CONFIG_CPP11_OVERRIDE : is override supported?
// CATCH_CONFIG_CPP11_UNIQUE_PTR : is unique_ptr supported (otherwise use auto_ptr)
// CATCH_CONFIG_CPP11_SHUFFLE : is std::shuffle supported?
// CATCH_CONFIG_CPP11_TYPE_TRAITS : are type_traits and enable_if supported?
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? // CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? // CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? // CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
@ -34,18 +20,13 @@
// **************** // ****************
// In general each macro has a _NO_<feature name> form // In general each macro has a _NO_<feature name> form
// (e.g. CATCH_CONFIG_CPP11_NO_NULLPTR) which disables the feature. // (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.
// Many features, at point of detection, define an _INTERNAL_ macro, so they // Many features, at point of detection, define an _INTERNAL_ macro, so they
// can be combined, en-mass, with the _NO_ forms later. // can be combined, en-mass, with the _NO_ forms later.
// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
#ifdef __cplusplus #ifdef __cplusplus
# if __cplusplus >= 201103L
# define CATCH_CPP11_OR_GREATER
# endif
# if __cplusplus >= 201402L # if __cplusplus >= 201402L
# define CATCH_CPP14_OR_GREATER # define CATCH_CPP14_OR_GREATER
# endif # endif
@ -54,15 +35,7 @@
#ifdef __clang__ #ifdef __clang__
# if __has_feature(cxx_nullptr)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif
# if __has_feature(cxx_noexcept)
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# endif
# if defined(CATCH_CPP11_OR_GREATER)
# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ # define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
_Pragma( "clang diagnostic push" ) \ _Pragma( "clang diagnostic push" ) \
_Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" )
@ -74,7 +47,6 @@
_Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
_Pragma( "clang diagnostic pop" ) _Pragma( "clang diagnostic pop" )
# endif
#endif // __clang__ #endif // __clang__
@ -125,14 +97,6 @@
// GCC // GCC
#ifdef __GNUC__ #ifdef __GNUC__
# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif
// - otherwise more recent versions define __cplusplus >= 201103L
// and will get picked up below
#endif // __GNUC__ #endif // __GNUC__
@ -142,32 +106,10 @@
#define CATCH_INTERNAL_CONFIG_WINDOWS_SEH #define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
#if (_MSC_VER >= 1600)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
#endif
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
#define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
#define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
#define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
#define CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS
#endif
#endif // _MSC_VER #endif // _MSC_VER
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Use variadic macros if the compiler supports them
#if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \
( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \
( defined __GNUC__ && __GNUC__ >= 3 ) || \
( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
#define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
#endif
// Use __COUNTER__ if the compiler supports it // Use __COUNTER__ if the compiler supports it
#if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \ #if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \
( defined __GNUC__ && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 ) || \ ( defined __GNUC__ && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 ) || \
@ -177,95 +119,15 @@
#endif #endif
////////////////////////////////////////////////////////////////////////////////
// C++ language feature support
// catch all support for C++11
#if defined(CATCH_CPP11_OR_GREATER)
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif
# ifndef CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# endif
# ifndef CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
# define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
# endif
# ifndef CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
# define CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
# endif
# ifndef CATCH_INTERNAL_CONFIG_CPP11_TUPLE
# define CATCH_INTERNAL_CONFIG_CPP11_TUPLE
# endif
# ifndef CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
# define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
# endif
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG)
# define CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG
# endif
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE)
# define CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE
# endif
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR)
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
# endif
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE)
# define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
# endif
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS)
# define CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS
# endif
#endif // __cplusplus >= 201103L
// Now set the actual defines based on the above + anything the user has configured // Now set the actual defines based on the above + anything the user has configured
#if defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NO_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_NULLPTR
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NO_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_NOEXCEPT
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_NO_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_GENERATED_METHODS
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_NO_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_IS_ENUM
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_CPP11_NO_TUPLE) && !defined(CATCH_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_TUPLE
#endif
#if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS)
# define CATCH_CONFIG_VARIADIC_MACROS
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_LONG_LONG
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_OVERRIDE
#endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_UNIQUE_PTR
#endif
// Use of __COUNTER__ is suppressed if __JETBRAINS_IDE__ is #defined (meaning we're being parsed by a JetBrains IDE for // Use of __COUNTER__ is suppressed if __JETBRAINS_IDE__ is #defined (meaning we're being parsed by a JetBrains IDE for
// analytics) because, at time of writing, __COUNTER__ is not properly handled by it. // analytics) because, at time of writing, __COUNTER__ is not properly handled by it.
// This does not affect compilation // This does not affect compilation
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) && !defined(__JETBRAINS_IDE__) #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) && !defined(__JETBRAINS_IDE__)
# define CATCH_CONFIG_COUNTER # define CATCH_CONFIG_COUNTER
#endif #endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_NO_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_SHUFFLE
#endif
# if defined(CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_NO_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_NO_CPP11)
# define CATCH_CONFIG_CPP11_TYPE_TRAITS
# endif
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) #if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
# define CATCH_CONFIG_WINDOWS_SEH # define CATCH_CONFIG_WINDOWS_SEH
#endif #endif
@ -283,35 +145,6 @@
# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS # define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
#endif #endif
// noexcept support:
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
# define CATCH_NOEXCEPT noexcept
# define CATCH_NOEXCEPT_IS(x) noexcept(x)
#else
# define CATCH_NOEXCEPT throw()
# define CATCH_NOEXCEPT_IS(x)
#endif
// nullptr support
#ifdef CATCH_CONFIG_CPP11_NULLPTR
# define CATCH_NULL nullptr
#else
# define CATCH_NULL NULL
#endif
// override support
#ifdef CATCH_CONFIG_CPP11_OVERRIDE
# define CATCH_OVERRIDE override
#else
# define CATCH_OVERRIDE
#endif
// unique_ptr support
#ifdef CATCH_CONFIG_CPP11_UNIQUE_PTR
# define CATCH_AUTO_PTR( T ) std::unique_ptr<T>
#else
# define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
#endif
#endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED

View File

@ -113,25 +113,25 @@ namespace Catch {
std::string getProcessName() const { return m_data.processName; } std::string getProcessName() const { return m_data.processName; }
std::vector<std::string> const& getReporterNames() const { return m_data.reporterNames; } std::vector<std::string> const& getReporterNames() const { return m_data.reporterNames; }
std::vector<std::string> const& getSectionsToRun() const CATCH_OVERRIDE { return m_data.sectionsToRun; } std::vector<std::string> const& getSectionsToRun() const override { return m_data.sectionsToRun; }
virtual TestSpec const& testSpec() const CATCH_OVERRIDE { return m_testSpec; } virtual TestSpec const& testSpec() const override { return m_testSpec; }
bool showHelp() const { return m_data.showHelp; } bool showHelp() const { return m_data.showHelp; }
// IConfig interface // IConfig interface
virtual bool allowThrows() const CATCH_OVERRIDE { return !m_data.noThrow; } virtual bool allowThrows() const override { return !m_data.noThrow; }
virtual std::ostream& stream() const CATCH_OVERRIDE { return m_stream->stream(); } virtual std::ostream& stream() const override { return m_stream->stream(); }
virtual std::string name() const CATCH_OVERRIDE { return m_data.name.empty() ? m_data.processName : m_data.name; } virtual std::string name() const override { return m_data.name.empty() ? m_data.processName : m_data.name; }
virtual bool includeSuccessfulResults() const CATCH_OVERRIDE { return m_data.showSuccessfulTests; } virtual bool includeSuccessfulResults() const override { return m_data.showSuccessfulTests; }
virtual bool warnAboutMissingAssertions() const CATCH_OVERRIDE { return m_data.warnings & WarnAbout::NoAssertions; } virtual bool warnAboutMissingAssertions() const override { return m_data.warnings & WarnAbout::NoAssertions; }
virtual ShowDurations::OrNot showDurations() const CATCH_OVERRIDE { return m_data.showDurations; } virtual ShowDurations::OrNot showDurations() const override { return m_data.showDurations; }
virtual RunTests::InWhatOrder runOrder() const CATCH_OVERRIDE { return m_data.runOrder; } virtual RunTests::InWhatOrder runOrder() const override { return m_data.runOrder; }
virtual unsigned int rngSeed() const CATCH_OVERRIDE { return m_data.rngSeed; } virtual unsigned int rngSeed() const override { return m_data.rngSeed; }
virtual UseColour::YesOrNo useColour() const CATCH_OVERRIDE { return m_data.useColour; } virtual UseColour::YesOrNo useColour() const override { return m_data.useColour; }
virtual bool shouldDebugBreak() const CATCH_OVERRIDE { return m_data.shouldDebugBreak; } virtual bool shouldDebugBreak() const override { return m_data.shouldDebugBreak; }
virtual int abortAfter() const CATCH_OVERRIDE { return m_data.abortAfter; } virtual int abortAfter() const override { return m_data.abortAfter; }
virtual bool showInvisibles() const CATCH_OVERRIDE { return m_data.showInvisibles; } virtual bool showInvisibles() const override { return m_data.showInvisibles; }
private: private:
@ -149,7 +149,7 @@ namespace Catch {
} }
ConfigData m_data; ConfigData m_data;
CATCH_AUTO_PTR( IStream const ) m_stream; std::unique_ptr<IStream const> m_stream;
TestSpec m_testSpec; TestSpec m_testSpec;
}; };

View File

@ -18,7 +18,7 @@ namespace Catch {
class Context : public IMutableContext { class Context : public IMutableContext {
Context() : m_config( CATCH_NULL ), m_runner( CATCH_NULL ), m_resultCapture( CATCH_NULL ) {} Context() : m_config( nullptr ), m_runner( nullptr ), m_resultCapture( nullptr ) {}
Context( Context const& ); Context( Context const& );
void operator=( Context const& ); void operator=( Context const& );
@ -69,7 +69,7 @@ namespace Catch {
m_generatorsByTestName.find( testName ); m_generatorsByTestName.find( testName );
return it != m_generatorsByTestName.end() return it != m_generatorsByTestName.end()
? it->second ? it->second
: CATCH_NULL; : nullptr;
} }
IGeneratorsForTest& getGeneratorsForCurrentTest() { IGeneratorsForTest& getGeneratorsForCurrentTest() {
@ -90,7 +90,7 @@ namespace Catch {
}; };
namespace { namespace {
Context* currentContext = CATCH_NULL; Context* currentContext = nullptr;
} }
IMutableContext& getCurrentMutableContext() { IMutableContext& getCurrentMutableContext() {
if( !currentContext ) if( !currentContext )
@ -103,7 +103,7 @@ namespace Catch {
void cleanUpContext() { void cleanUpContext() {
delete currentContext; delete currentContext;
currentContext = CATCH_NULL; currentContext = nullptr;
} }
} }

View File

@ -49,7 +49,7 @@
// Call sysctl. // Call sysctl.
size = sizeof(info); size = sizeof(info);
if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, CATCH_NULL, 0) != 0 ) { if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {
Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl;
return false; return false;
} }

View File

@ -80,7 +80,7 @@ public:
.endExpression( *this ); .endExpression( *this );
} }
virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { virtual void reconstructExpression( std::string& dest ) const override {
dest = Catch::toString( m_truthy ); dest = Catch::toString( m_truthy );
} }
@ -115,11 +115,11 @@ public:
.endExpression( *this ); .endExpression( *this );
} }
virtual bool isBinaryExpression() const CATCH_OVERRIDE { virtual bool isBinaryExpression() const override {
return true; return true;
} }
virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { virtual void reconstructExpression( std::string& dest ) const override {
std::string lhs = Catch::toString( m_lhs ); std::string lhs = Catch::toString( m_lhs );
std::string rhs = Catch::toString( m_rhs ); std::string rhs = Catch::toString( m_rhs );
char delim = lhs.size() + rhs.size() < 40 && char delim = lhs.size() + rhs.size() < 40 &&
@ -149,11 +149,11 @@ public:
MatchExpression( ArgT arg, MatcherT matcher, char const* matcherString ) MatchExpression( ArgT arg, MatcherT matcher, char const* matcherString )
: m_arg( arg ), m_matcher( matcher ), m_matcherString( matcherString ) {} : m_arg( arg ), m_matcher( matcher ), m_matcherString( matcherString ) {}
virtual bool isBinaryExpression() const CATCH_OVERRIDE { virtual bool isBinaryExpression() const override {
return true; return true;
} }
virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { virtual void reconstructExpression( std::string& dest ) const override {
std::string matcherAsString = m_matcher.toString(); std::string matcherAsString = m_matcher.toString();
dest = Catch::toString( m_arg ); dest = Catch::toString( m_arg );
dest += ' '; dest += ' ';

View File

@ -66,7 +66,7 @@ namespace Catch {
// 32k seems enough for Catch to handle stack overflow, // 32k seems enough for Catch to handle stack overflow,
// but the value was found experimentally, so there is no strong guarantee // but the value was found experimentally, so there is no strong guarantee
guaranteeSize = 32 * 1024; guaranteeSize = 32 * 1024;
exceptionHandlerHandle = CATCH_NULL; exceptionHandlerHandle = nullptr;
// Register as first handler in current chain // Register as first handler in current chain
exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
// Pass in guarantee size to be filled // Pass in guarantee size to be filled
@ -78,7 +78,7 @@ namespace Catch {
// Unregister handler and restore the old guarantee // Unregister handler and restore the old guarantee
RemoveVectoredExceptionHandler(exceptionHandlerHandle); RemoveVectoredExceptionHandler(exceptionHandlerHandle);
SetThreadStackGuarantee(&guaranteeSize); SetThreadStackGuarantee(&guaranteeSize);
exceptionHandlerHandle = CATCH_NULL; exceptionHandlerHandle = nullptr;
isSet = false; isSet = false;
} }
} }
@ -94,7 +94,7 @@ namespace Catch {
bool FatalConditionHandler::isSet = false; bool FatalConditionHandler::isSet = false;
ULONG FatalConditionHandler::guaranteeSize = 0; ULONG FatalConditionHandler::guaranteeSize = 0;
PVOID FatalConditionHandler::exceptionHandlerHandle = CATCH_NULL; PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr;
} // namespace Catch } // namespace Catch
@ -176,10 +176,10 @@ namespace Catch {
if( isSet ) { if( isSet ) {
// Set signals back to previous values -- hopefully nobody overwrote them in the meantime // Set signals back to previous values -- hopefully nobody overwrote them in the meantime
for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {
sigaction(signalDefs[i].id, &oldSigActions[i], CATCH_NULL); sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
} }
// Return the old stack // Return the old stack
sigaltstack(&oldSigStack, CATCH_NULL); sigaltstack(&oldSigStack, nullptr);
isSet = false; isSet = false;
} }
} }

View File

@ -49,11 +49,11 @@ namespace Catch {
// virtual methods // virtual methods
NonCopyable::~NonCopyable() {} NonCopyable::~NonCopyable() {}
IShared::~IShared() {} IShared::~IShared() {}
IStream::~IStream() CATCH_NOEXCEPT {} IStream::~IStream() noexcept {}
FileStream::~FileStream() CATCH_NOEXCEPT {} FileStream::~FileStream() noexcept {}
CoutStream::~CoutStream() CATCH_NOEXCEPT {} CoutStream::~CoutStream() noexcept {}
DebugOutStream::~DebugOutStream() CATCH_NOEXCEPT {} DebugOutStream::~DebugOutStream() noexcept {}
StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {} StreamBufBase::~StreamBufBase() noexcept {}
IContext::~IContext() {} IContext::~IContext() {}
IResultCapture::~IResultCapture() {} IResultCapture::~IResultCapture() {}
ITestCase::~ITestCase() {} ITestCase::~ITestCase() {}

View File

@ -40,7 +40,7 @@ namespace Catch {
: m_translateFunction( translateFunction ) : m_translateFunction( translateFunction )
{} {}
virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const CATCH_OVERRIDE { virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
try { try {
if( it == itEnd ) if( it == itEnd )
throw; throw;

View File

@ -100,12 +100,10 @@ namespace Catch
} }
virtual ~AssertionStats(); virtual ~AssertionStats();
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
AssertionStats( AssertionStats const& ) = default; AssertionStats( AssertionStats const& ) = default;
AssertionStats( AssertionStats && ) = default; AssertionStats( AssertionStats && ) = default;
AssertionStats& operator = ( AssertionStats const& ) = default; AssertionStats& operator = ( AssertionStats const& ) = default;
AssertionStats& operator = ( AssertionStats && ) = default; AssertionStats& operator = ( AssertionStats && ) = default;
# endif
AssertionResult assertionResult; AssertionResult assertionResult;
std::vector<MessageInfo> infoMessages; std::vector<MessageInfo> infoMessages;
@ -123,12 +121,10 @@ namespace Catch
missingAssertions( _missingAssertions ) missingAssertions( _missingAssertions )
{} {}
virtual ~SectionStats(); virtual ~SectionStats();
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
SectionStats( SectionStats const& ) = default; SectionStats( SectionStats const& ) = default;
SectionStats( SectionStats && ) = default; SectionStats( SectionStats && ) = default;
SectionStats& operator = ( SectionStats const& ) = default; SectionStats& operator = ( SectionStats const& ) = default;
SectionStats& operator = ( SectionStats && ) = default; SectionStats& operator = ( SectionStats && ) = default;
# endif
SectionInfo sectionInfo; SectionInfo sectionInfo;
Counts assertions; Counts assertions;
@ -150,12 +146,10 @@ namespace Catch
{} {}
virtual ~TestCaseStats(); virtual ~TestCaseStats();
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
TestCaseStats( TestCaseStats const& ) = default; TestCaseStats( TestCaseStats const& ) = default;
TestCaseStats( TestCaseStats && ) = default; TestCaseStats( TestCaseStats && ) = default;
TestCaseStats& operator = ( TestCaseStats const& ) = default; TestCaseStats& operator = ( TestCaseStats const& ) = default;
TestCaseStats& operator = ( TestCaseStats && ) = default; TestCaseStats& operator = ( TestCaseStats && ) = default;
# endif
TestCaseInfo testInfo; TestCaseInfo testInfo;
Totals totals; Totals totals;
@ -178,12 +172,10 @@ namespace Catch
{} {}
virtual ~TestGroupStats(); virtual ~TestGroupStats();
# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
TestGroupStats( TestGroupStats const& ) = default; TestGroupStats( TestGroupStats const& ) = default;
TestGroupStats( TestGroupStats && ) = default; TestGroupStats( TestGroupStats && ) = default;
TestGroupStats& operator = ( TestGroupStats const& ) = default; TestGroupStats& operator = ( TestGroupStats const& ) = default;
TestGroupStats& operator = ( TestGroupStats && ) = default; TestGroupStats& operator = ( TestGroupStats && ) = default;
# endif
GroupInfo groupInfo; GroupInfo groupInfo;
Totals totals; Totals totals;
@ -200,18 +192,10 @@ namespace Catch
{} {}
virtual ~TestRunStats(); virtual ~TestRunStats();
# ifndef CATCH_CONFIG_CPP11_GENERATED_METHODS
TestRunStats( TestRunStats const& _other )
: runInfo( _other.runInfo ),
totals( _other.totals ),
aborting( _other.aborting )
{}
# else
TestRunStats( TestRunStats const& ) = default; TestRunStats( TestRunStats const& ) = default;
TestRunStats( TestRunStats && ) = default; TestRunStats( TestRunStats && ) = default;
TestRunStats& operator = ( TestRunStats const& ) = default; TestRunStats& operator = ( TestRunStats const& ) = default;
TestRunStats& operator = ( TestRunStats && ) = default; TestRunStats& operator = ( TestRunStats && ) = default;
# endif
TestRunInfo runInfo; TestRunInfo runInfo;
Totals totals; Totals totals;
@ -248,7 +232,7 @@ namespace Catch
virtual void skipTest( TestCaseInfo const& testInfo ) = 0; virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
virtual MultipleReporters* tryAsMulti() { return CATCH_NULL; } virtual MultipleReporters* tryAsMulti() { return nullptr; }
}; };

View File

@ -54,14 +54,14 @@ namespace Matchers {
template<typename ArgT> template<typename ArgT>
struct MatchAllOf : MatcherBase<ArgT> { struct MatchAllOf : MatcherBase<ArgT> {
virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { virtual bool match( ArgT const& arg ) const override {
for( auto matcher : m_matchers ) { for( auto matcher : m_matchers ) {
if (!matcher->match(arg)) if (!matcher->match(arg))
return false; return false;
} }
return true; return true;
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
std::string description; std::string description;
description.reserve( 4 + m_matchers.size()*32 ); description.reserve( 4 + m_matchers.size()*32 );
description += "( "; description += "( ";
@ -87,14 +87,14 @@ namespace Matchers {
template<typename ArgT> template<typename ArgT>
struct MatchAnyOf : MatcherBase<ArgT> { struct MatchAnyOf : MatcherBase<ArgT> {
virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { virtual bool match( ArgT const& arg ) const override {
for( auto matcher : m_matchers ) { for( auto matcher : m_matchers ) {
if (matcher->match(arg)) if (matcher->match(arg))
return true; return true;
} }
return false; return false;
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
std::string description; std::string description;
description.reserve( 4 + m_matchers.size()*32 ); description.reserve( 4 + m_matchers.size()*32 );
description += "( "; description += "( ";
@ -123,11 +123,11 @@ namespace Matchers {
MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { virtual bool match( ArgT const& arg ) const override {
return !m_underlyingMatcher.match( arg ); return !m_underlyingMatcher.match( arg );
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "not " + m_underlyingMatcher.toString(); return "not " + m_underlyingMatcher.toString();
} }
MatcherBase<ArgT> const& m_underlyingMatcher; MatcherBase<ArgT> const& m_underlyingMatcher;

View File

@ -27,7 +27,7 @@ namespace Matchers {
struct StringMatcherBase : MatcherBase<std::string> { struct StringMatcherBase : MatcherBase<std::string> {
StringMatcherBase( std::string const& operation, CasedString const& comparator ); StringMatcherBase( std::string const& operation, CasedString const& comparator );
virtual std::string describe() const CATCH_OVERRIDE; virtual std::string describe() const override;
CasedString m_comparator; CasedString m_comparator;
std::string m_operation; std::string m_operation;
@ -35,19 +35,19 @@ namespace Matchers {
struct EqualsMatcher : StringMatcherBase { struct EqualsMatcher : StringMatcherBase {
EqualsMatcher( CasedString const& comparator ); EqualsMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const CATCH_OVERRIDE; virtual bool match( std::string const& source ) const override;
}; };
struct ContainsMatcher : StringMatcherBase { struct ContainsMatcher : StringMatcherBase {
ContainsMatcher( CasedString const& comparator ); ContainsMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const CATCH_OVERRIDE; virtual bool match( std::string const& source ) const override;
}; };
struct StartsWithMatcher : StringMatcherBase { struct StartsWithMatcher : StringMatcherBase {
StartsWithMatcher( CasedString const& comparator ); StartsWithMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const CATCH_OVERRIDE; virtual bool match( std::string const& source ) const override;
}; };
struct EndsWithMatcher : StringMatcherBase { struct EndsWithMatcher : StringMatcherBase {
EndsWithMatcher( CasedString const& comparator ); EndsWithMatcher( CasedString const& comparator );
virtual bool match( std::string const& source ) const CATCH_OVERRIDE; virtual bool match( std::string const& source ) const override;
}; };
} // namespace StdString } // namespace StdString

View File

@ -20,11 +20,11 @@ namespace Matchers {
ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}
bool match(std::vector<T> const &v) const CATCH_OVERRIDE { bool match(std::vector<T> const &v) const override {
return std::find(v.begin(), v.end(), m_comparator) != v.end(); return std::find(v.begin(), v.end(), m_comparator) != v.end();
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "Contains: " + Catch::toString( m_comparator ); return "Contains: " + Catch::toString( m_comparator );
} }
@ -36,7 +36,7 @@ namespace Matchers {
ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
bool match(std::vector<T> const &v) const CATCH_OVERRIDE { bool match(std::vector<T> const &v) const override {
// !TBD: see note in EqualsMatcher // !TBD: see note in EqualsMatcher
if (m_comparator.size() > v.size()) if (m_comparator.size() > v.size())
return false; return false;
@ -45,7 +45,7 @@ namespace Matchers {
return false; return false;
return true; return true;
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "Contains: " + Catch::toString( m_comparator ); return "Contains: " + Catch::toString( m_comparator );
} }
@ -57,7 +57,7 @@ namespace Matchers {
EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
bool match(std::vector<T> const &v) const CATCH_OVERRIDE { bool match(std::vector<T> const &v) const override {
// !TBD: This currently works if all elements can be compared using != // !TBD: This currently works if all elements can be compared using !=
// - a more general approach would be via a compare template that defaults // - a more general approach would be via a compare template that defaults
// to using !=. but could be specialised for, e.g. std::vector<T> etc // to using !=. but could be specialised for, e.g. std::vector<T> etc
@ -69,7 +69,7 @@ namespace Matchers {
return false; return false;
return true; return true;
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "Equals: " + Catch::toString( m_comparator ); return "Equals: " + Catch::toString( m_comparator );
} }
std::vector<T> const& m_comparator; std::vector<T> const& m_comparator;

View File

@ -18,9 +18,9 @@ namespace Catch {
NotImplementedException( SourceLineInfo const& lineInfo ); NotImplementedException( SourceLineInfo const& lineInfo );
NotImplementedException( NotImplementedException const& ) {} NotImplementedException( NotImplementedException const& ) {}
virtual ~NotImplementedException() CATCH_NOEXCEPT {} virtual ~NotImplementedException() noexcept {}
virtual const char* what() const CATCH_NOEXCEPT; virtual const char* what() const noexcept;
private: private:
std::string m_what; std::string m_what;

View File

@ -21,7 +21,7 @@ namespace Catch {
m_what = oss.str(); m_what = oss.str();
} }
const char* NotImplementedException::what() const CATCH_NOEXCEPT { const char* NotImplementedException::what() const noexcept {
return m_what.c_str(); return m_what.c_str();
} }

View File

@ -72,7 +72,7 @@ namespace Catch {
inline size_t registerTestMethods() { inline size_t registerTestMethods() {
size_t noTestMethods = 0; size_t noTestMethods = 0;
int noClasses = objc_getClassList( CATCH_NULL, 0 ); int noClasses = objc_getClassList( nullptr, 0 );
Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
objc_getClassList( classes, noClasses ); objc_getClassList( classes, noClasses );
@ -112,7 +112,7 @@ namespace Catch {
arcSafeRelease( m_substr ); arcSafeRelease( m_substr );
} }
virtual bool match( NSString* arg ) const CATCH_OVERRIDE { virtual bool match( NSString* arg ) const override {
return false; return false;
} }
@ -122,12 +122,12 @@ namespace Catch {
struct Equals : StringHolder { struct Equals : StringHolder {
Equals( NSString* substr ) : StringHolder( substr ){} Equals( NSString* substr ) : StringHolder( substr ){}
virtual bool match( NSString* str ) const CATCH_OVERRIDE { virtual bool match( NSString* str ) const override {
return (str != nil || m_substr == nil ) && return (str != nil || m_substr == nil ) &&
[str isEqualToString:m_substr]; [str isEqualToString:m_substr];
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "equals string: " + Catch::toString( m_substr ); return "equals string: " + Catch::toString( m_substr );
} }
}; };
@ -140,7 +140,7 @@ namespace Catch {
[str rangeOfString:m_substr].location != NSNotFound; [str rangeOfString:m_substr].location != NSNotFound;
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "contains string: " + Catch::toString( m_substr ); return "contains string: " + Catch::toString( m_substr );
} }
}; };
@ -153,7 +153,7 @@ namespace Catch {
[str rangeOfString:m_substr].location == 0; [str rangeOfString:m_substr].location == 0;
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "starts with: " + Catch::toString( m_substr ); return "starts with: " + Catch::toString( m_substr );
} }
}; };
@ -165,7 +165,7 @@ namespace Catch {
[str rangeOfString:m_substr].location == [str length] - [m_substr length]; [str rangeOfString:m_substr].location == [str length] - [m_substr length];
} }
virtual std::string describe() const CATCH_OVERRIDE { virtual std::string describe() const override {
return "ends with: " + Catch::toString( m_substr ); return "ends with: " + Catch::toString( m_substr );
} }
}; };

View File

@ -16,12 +16,12 @@ namespace Catch {
template<typename T> template<typename T>
class Option { class Option {
public: public:
Option() : nullableValue( CATCH_NULL ) {} Option() : nullableValue( nullptr ) {}
Option( T const& _value ) Option( T const& _value )
: nullableValue( new( storage ) T( _value ) ) : nullableValue( new( storage ) T( _value ) )
{} {}
Option( Option const& _other ) Option( Option const& _other )
: nullableValue( _other ? new( storage ) T( *_other ) : CATCH_NULL ) : nullableValue( _other ? new( storage ) T( *_other ) : nullptr )
{} {}
~Option() { ~Option() {
@ -45,7 +45,7 @@ namespace Catch {
void reset() { void reset() {
if( nullableValue ) if( nullableValue )
nullableValue->~T(); nullableValue->~T();
nullableValue = CATCH_NULL; nullableValue = nullptr;
} }
T& operator*() { return *nullableValue; } T& operator*() { return *nullableValue; }
@ -57,10 +57,10 @@ namespace Catch {
return nullableValue ? *nullableValue : defaultValue; return nullableValue ? *nullableValue : defaultValue;
} }
bool some() const { return nullableValue != CATCH_NULL; } bool some() const { return nullableValue != nullptr; }
bool none() const { return nullableValue == CATCH_NULL; } bool none() const { return nullableValue == nullptr; }
bool operator !() const { return nullableValue == CATCH_NULL; } bool operator !() const { return nullableValue == nullptr; }
operator SafeBool::type() const { operator SafeBool::type() const {
return SafeBool::makeSafe( some() ); return SafeBool::makeSafe( some() );
} }
@ -74,9 +74,7 @@ namespace Catch {
long double dummy1; long double dummy1;
void (*dummy2)(); void (*dummy2)();
long double dummy3; long double dummy3;
#ifdef CATCH_CONFIG_CPP11_LONG_LONG
long long dummy4; long long dummy4;
#endif
}; };
}; };

View File

@ -23,7 +23,7 @@ namespace Catch {
template<typename T> template<typename T>
class Ptr { class Ptr {
public: public:
Ptr() : m_p( CATCH_NULL ){} Ptr() : m_p( nullptr ){}
Ptr( T* p ) : m_p( p ){ Ptr( T* p ) : m_p( p ){
if( m_p ) if( m_p )
m_p->addRef(); m_p->addRef();
@ -39,7 +39,7 @@ namespace Catch {
void reset() { void reset() {
if( m_p ) if( m_p )
m_p->release(); m_p->release();
m_p = CATCH_NULL; m_p = nullptr;
} }
Ptr& operator = ( T* p ){ Ptr& operator = ( T* p ){
Ptr temp( p ); Ptr temp( p );
@ -55,8 +55,8 @@ namespace Catch {
T* get() const{ return m_p; } T* get() const{ return m_p; }
T& operator*() const { return *m_p; } T& operator*() const { return *m_p; }
T* operator->() const { return m_p; } T* operator->() const { return m_p; }
bool operator !() const { return m_p == CATCH_NULL; } bool operator !() const { return m_p == nullptr; }
operator SafeBool::type() const { return SafeBool::makeSafe( m_p != CATCH_NULL ); } operator SafeBool::type() const { return SafeBool::makeSafe( m_p != nullptr ); }
private: private:
T* m_p; T* m_p;

View File

@ -27,34 +27,34 @@ namespace Catch {
public: // IRegistryHub public: // IRegistryHub
RegistryHub() { RegistryHub() {
} }
virtual IReporterRegistry const& getReporterRegistry() const CATCH_OVERRIDE { virtual IReporterRegistry const& getReporterRegistry() const override {
return m_reporterRegistry; return m_reporterRegistry;
} }
virtual ITestCaseRegistry const& getTestCaseRegistry() const CATCH_OVERRIDE { virtual ITestCaseRegistry const& getTestCaseRegistry() const override {
return m_testCaseRegistry; return m_testCaseRegistry;
} }
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() CATCH_OVERRIDE { virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override {
return m_exceptionTranslatorRegistry; return m_exceptionTranslatorRegistry;
} }
virtual ITagAliasRegistry const& getTagAliasRegistry() const CATCH_OVERRIDE { virtual ITagAliasRegistry const& getTagAliasRegistry() const override {
return m_tagAliasRegistry; return m_tagAliasRegistry;
} }
public: // IMutableRegistryHub public: // IMutableRegistryHub
virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE { virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) override {
m_reporterRegistry.registerReporter( name, factory ); m_reporterRegistry.registerReporter( name, factory );
} }
virtual void registerListener( Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE { virtual void registerListener( Ptr<IReporterFactory> const& factory ) override {
m_reporterRegistry.registerListener( factory ); m_reporterRegistry.registerListener( factory );
} }
virtual void registerTest( TestCase const& testInfo ) CATCH_OVERRIDE { virtual void registerTest( TestCase const& testInfo ) override {
m_testCaseRegistry.registerTest( testInfo ); m_testCaseRegistry.registerTest( testInfo );
} }
virtual void registerTranslator( const IExceptionTranslator* translator ) CATCH_OVERRIDE { virtual void registerTranslator( const IExceptionTranslator* translator ) override {
m_exceptionTranslatorRegistry.registerTranslator( translator ); m_exceptionTranslatorRegistry.registerTranslator( translator );
} }
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) CATCH_OVERRIDE { virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
m_tagAliasRegistry.add( alias, tag, lineInfo ); m_tagAliasRegistry.add( alias, tag, lineInfo );
} }
@ -67,7 +67,7 @@ namespace Catch {
// Single, global, instance // Single, global, instance
inline RegistryHub*& getTheRegistryHub() { inline RegistryHub*& getTheRegistryHub() {
static RegistryHub* theRegistryHub = CATCH_NULL; static RegistryHub* theRegistryHub = nullptr;
if( !theRegistryHub ) if( !theRegistryHub )
theRegistryHub = new RegistryHub(); theRegistryHub = new RegistryHub();
return theRegistryHub; return theRegistryHub;
@ -82,7 +82,7 @@ namespace Catch {
} }
void cleanUp() { void cleanUp() {
delete getTheRegistryHub(); delete getTheRegistryHub();
getTheRegistryHub() = CATCH_NULL; getTheRegistryHub() = nullptr;
cleanUpContext(); cleanUpContext();
} }
std::string translateActiveException() { std::string translateActiveException() {

View File

@ -18,12 +18,12 @@ namespace Catch {
public: public:
virtual ~ReporterRegistry() CATCH_OVERRIDE {} virtual ~ReporterRegistry() override {}
virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig const> const& config ) const CATCH_OVERRIDE { virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig const> const& config ) const override {
FactoryMap::const_iterator it = m_factories.find( name ); FactoryMap::const_iterator it = m_factories.find( name );
if( it == m_factories.end() ) if( it == m_factories.end() )
return CATCH_NULL; return nullptr;
return it->second->create( ReporterConfig( config ) ); return it->second->create( ReporterConfig( config ) );
} }
@ -34,10 +34,10 @@ namespace Catch {
m_listeners.push_back( factory ); m_listeners.push_back( factory );
} }
virtual FactoryMap const& getFactories() const CATCH_OVERRIDE { virtual FactoryMap const& getFactories() const override {
return m_factories; return m_factories;
} }
virtual Listeners const& getListeners() const CATCH_OVERRIDE { virtual Listeners const& getListeners() const override {
return m_listeners; return m_listeners;
} }

View File

@ -56,7 +56,7 @@ namespace Catch {
void endExpression( DecomposedExpression const& expr ); void endExpression( DecomposedExpression const& expr );
virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE; virtual void reconstructExpression( std::string& dest ) const override;
AssertionResult build() const; AssertionResult build() const;
AssertionResult build( DecomposedExpression const& expr ) const; AssertionResult build( DecomposedExpression const& expr ) const;

View File

@ -62,7 +62,7 @@ namespace Catch {
explicit RunContext( Ptr<IConfig const> const& _config, Ptr<IStreamingReporter> const& reporter ) explicit RunContext( Ptr<IConfig const> const& _config, Ptr<IStreamingReporter> const& reporter )
: m_runInfo( _config->name() ), : m_runInfo( _config->name() ),
m_context( getCurrentMutableContext() ), m_context( getCurrentMutableContext() ),
m_activeTestCase( CATCH_NULL ), m_activeTestCase( nullptr ),
m_config( _config ), m_config( _config ),
m_reporter( reporter ), m_reporter( reporter ),
m_shouldReportUnexpected ( true ) m_shouldReportUnexpected ( true )
@ -124,8 +124,8 @@ namespace Catch {
redirectedCerr, redirectedCerr,
aborting() ) ); aborting() ) );
m_activeTestCase = CATCH_NULL; m_activeTestCase = nullptr;
m_testCaseTracker = CATCH_NULL; m_testCaseTracker = nullptr;
return deltaTotals; return deltaTotals;
} }

View File

@ -35,12 +35,7 @@ namespace Catch {
} // end namespace Catch } // end namespace Catch
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#define INTERNAL_CATCH_SECTION( ... ) \ #define INTERNAL_CATCH_SECTION( ... ) \
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
#else
#define INTERNAL_CATCH_SECTION( name, desc ) \
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, name, desc ) )
#endif
#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED #endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED

View File

@ -33,7 +33,7 @@ namespace Catch {
RunningSection( std::string const& name ) RunningSection( std::string const& name )
: m_state( Root ), : m_state( Root ),
m_parent( CATCH_NULL ), m_parent( nullptr ),
m_name( name ) m_name( name )
{} {}

View File

@ -24,7 +24,7 @@ namespace Catch {
struct IStream { struct IStream {
virtual ~IStream() CATCH_NOEXCEPT; virtual ~IStream() noexcept;
virtual std::ostream& stream() const = 0; virtual std::ostream& stream() const = 0;
}; };
@ -32,9 +32,9 @@ namespace Catch {
mutable std::ofstream m_ofs; mutable std::ofstream m_ofs;
public: public:
FileStream( std::string const& filename ); FileStream( std::string const& filename );
virtual ~FileStream() CATCH_NOEXCEPT; virtual ~FileStream() noexcept;
public: // IStream public: // IStream
virtual std::ostream& stream() const CATCH_OVERRIDE; virtual std::ostream& stream() const override;
}; };
@ -42,22 +42,22 @@ namespace Catch {
mutable std::ostream m_os; mutable std::ostream m_os;
public: public:
CoutStream(); CoutStream();
virtual ~CoutStream() CATCH_NOEXCEPT; virtual ~CoutStream() noexcept;
public: // IStream public: // IStream
virtual std::ostream& stream() const CATCH_OVERRIDE; virtual std::ostream& stream() const override;
}; };
class DebugOutStream : public IStream { class DebugOutStream : public IStream {
CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf; std::unique_ptr<StreamBufBase> m_streamBuf;
mutable std::ostream m_os; mutable std::ostream m_os;
public: public:
DebugOutStream(); DebugOutStream();
virtual ~DebugOutStream() CATCH_NOEXCEPT; virtual ~DebugOutStream() noexcept;
public: // IStream public: // IStream
virtual std::ostream& stream() const CATCH_OVERRIDE; virtual std::ostream& stream() const override;
}; };
} }

View File

@ -28,7 +28,7 @@ namespace Catch {
setp( data, data + sizeof(data) ); setp( data, data + sizeof(data) );
} }
~StreamBufImpl() CATCH_NOEXCEPT { ~StreamBufImpl() noexcept {
sync(); sync();
} }

View File

@ -16,7 +16,7 @@ namespace Catch {
class StreamBufBase : public std::streambuf { class StreamBufBase : public std::streambuf {
public: public:
virtual ~StreamBufBase() CATCH_NOEXCEPT; virtual ~StreamBufBase() noexcept;
}; };
} }

View File

@ -26,19 +26,13 @@ namespace Catch {
result_type operator()( result_type n ) const { return std::rand() % n; } result_type operator()( result_type n ) const { return std::rand() % n; }
#ifdef CATCH_CONFIG_CPP11_SHUFFLE
static constexpr result_type min() { return 0; } static constexpr result_type min() { return 0; }
static constexpr result_type max() { return 1000000; } static constexpr result_type max() { return 1000000; }
result_type operator()() const { return std::rand() % max(); } result_type operator()() const { return std::rand() % max(); }
#endif
template<typename V> template<typename V>
static void shuffle( V& vector ) { static void shuffle( V& vector ) {
RandomNumberGenerator rng; RandomNumberGenerator rng;
#ifdef CATCH_CONFIG_CPP11_SHUFFLE
std::shuffle( vector.begin(), vector.end(), rng ); std::shuffle( vector.begin(), vector.end(), rng );
#else
std::random_shuffle( vector.begin(), vector.end(), rng );
#endif
} }
}; };

View File

@ -80,7 +80,7 @@ namespace TestCaseTracking {
} }
TrackerContext() TrackerContext()
: m_currentTracker( CATCH_NULL ), : m_currentTracker( nullptr ),
m_runState( NotStarted ) m_runState( NotStarted )
{} {}
@ -89,7 +89,7 @@ namespace TestCaseTracking {
void endRun() { void endRun() {
m_rootTracker.reset(); m_rootTracker.reset();
m_currentTracker = CATCH_NULL; m_currentTracker = nullptr;
m_runState = NotStarted; m_runState = NotStarted;
} }
@ -147,39 +147,39 @@ namespace TestCaseTracking {
{} {}
virtual ~TrackerBase(); virtual ~TrackerBase();
virtual NameAndLocation const& nameAndLocation() const CATCH_OVERRIDE { virtual NameAndLocation const& nameAndLocation() const override {
return m_nameAndLocation; return m_nameAndLocation;
} }
virtual bool isComplete() const CATCH_OVERRIDE { virtual bool isComplete() const override {
return m_runState == CompletedSuccessfully || m_runState == Failed; return m_runState == CompletedSuccessfully || m_runState == Failed;
} }
virtual bool isSuccessfullyCompleted() const CATCH_OVERRIDE { virtual bool isSuccessfullyCompleted() const override {
return m_runState == CompletedSuccessfully; return m_runState == CompletedSuccessfully;
} }
virtual bool isOpen() const CATCH_OVERRIDE { virtual bool isOpen() const override {
return m_runState != NotStarted && !isComplete(); return m_runState != NotStarted && !isComplete();
} }
virtual bool hasChildren() const CATCH_OVERRIDE { virtual bool hasChildren() const override {
return !m_children.empty(); return !m_children.empty();
} }
virtual void addChild( Ptr<ITracker> const& child ) CATCH_OVERRIDE { virtual void addChild( Ptr<ITracker> const& child ) override {
m_children.push_back( child ); m_children.push_back( child );
} }
virtual ITracker* findChild( NameAndLocation const& nameAndLocation ) CATCH_OVERRIDE { virtual ITracker* findChild( NameAndLocation const& nameAndLocation ) override {
Children::const_iterator it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) ); Children::const_iterator it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) );
return( it != m_children.end() ) return( it != m_children.end() )
? it->get() ? it->get()
: CATCH_NULL; : nullptr;
} }
virtual ITracker& parent() CATCH_OVERRIDE { virtual ITracker& parent() override {
assert( m_parent ); // Should always be non-null except for root assert( m_parent ); // Should always be non-null except for root
return *m_parent; return *m_parent;
} }
virtual void openChild() CATCH_OVERRIDE { virtual void openChild() override {
if( m_runState != ExecutingChildren ) { if( m_runState != ExecutingChildren ) {
m_runState = ExecutingChildren; m_runState = ExecutingChildren;
if( m_parent ) if( m_parent )
@ -187,8 +187,8 @@ namespace TestCaseTracking {
} }
} }
virtual bool isSectionTracker() const CATCH_OVERRIDE { return false; } virtual bool isSectionTracker() const override { return false; }
virtual bool isIndexTracker() const CATCH_OVERRIDE { return false; } virtual bool isIndexTracker() const override { return false; }
void open() { void open() {
m_runState = Executing; m_runState = Executing;
@ -197,7 +197,7 @@ namespace TestCaseTracking {
m_parent->openChild(); m_parent->openChild();
} }
virtual void close() CATCH_OVERRIDE { virtual void close() override {
// Close any still open children (e.g. generators) // Close any still open children (e.g. generators)
while( &m_ctx.currentTracker() != this ) while( &m_ctx.currentTracker() != this )
@ -226,14 +226,14 @@ namespace TestCaseTracking {
moveToParent(); moveToParent();
m_ctx.completeCycle(); m_ctx.completeCycle();
} }
virtual void fail() CATCH_OVERRIDE { virtual void fail() override {
m_runState = Failed; m_runState = Failed;
if( m_parent ) if( m_parent )
m_parent->markAsNeedingAnotherRun(); m_parent->markAsNeedingAnotherRun();
moveToParent(); moveToParent();
m_ctx.completeCycle(); m_ctx.completeCycle();
} }
virtual void markAsNeedingAnotherRun() CATCH_OVERRIDE { virtual void markAsNeedingAnotherRun() override {
m_runState = NeedsAnotherRun; m_runState = NeedsAnotherRun;
} }
private: private:
@ -262,10 +262,10 @@ namespace TestCaseTracking {
} }
virtual ~SectionTracker(); virtual ~SectionTracker();
virtual bool isSectionTracker() const CATCH_OVERRIDE { return true; } virtual bool isSectionTracker() const override { return true; }
static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {
SectionTracker* section = CATCH_NULL; SectionTracker* section = nullptr;
ITracker& currentTracker = ctx.currentTracker(); ITracker& currentTracker = ctx.currentTracker();
if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) {
@ -311,10 +311,10 @@ namespace TestCaseTracking {
{} {}
virtual ~IndexTracker(); virtual ~IndexTracker();
virtual bool isIndexTracker() const CATCH_OVERRIDE { return true; } virtual bool isIndexTracker() const override { return true; }
static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) { static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) {
IndexTracker* tracker = CATCH_NULL; IndexTracker* tracker = nullptr;
ITracker& currentTracker = ctx.currentTracker(); ITracker& currentTracker = ctx.currentTracker();
if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) {
@ -343,7 +343,7 @@ namespace TestCaseTracking {
m_children.clear(); m_children.clear();
} }
virtual void close() CATCH_OVERRIDE { virtual void close() override {
TrackerBase::close(); TrackerBase::close();
if( m_runState == CompletedSuccessfully && m_index < m_size-1 ) if( m_runState == CompletedSuccessfully && m_index < m_size-1 )
m_runState = Executing; m_runState = Executing;
@ -351,8 +351,8 @@ namespace TestCaseTracking {
}; };
inline ITracker& TrackerContext::startRun() { inline ITracker& TrackerContext::startRun() {
m_rootTracker = new SectionTracker( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, CATCH_NULL ); m_rootTracker = new SectionTracker( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr );
m_currentTracker = CATCH_NULL; m_currentTracker = nullptr;
m_runState = Executing; m_runState = Executing;
return *m_rootTracker; return *m_rootTracker;
} }

View File

@ -83,7 +83,6 @@ void registerTestCaseFunction
} // end namespace Catch } // end namespace Catch
#ifdef CATCH_CONFIG_VARIADIC_MACROS
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
static void TestName(); \ static void TestName(); \
@ -120,43 +119,5 @@ void registerTestCaseFunction
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); \ Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); \
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
#else
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TESTCASE2( TestName, Name, Desc ) \
static void TestName(); \
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
static void TestName()
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); } \
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
namespace{ \
struct TestCaseName : ClassName{ \
void test(); \
}; \
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \
} \
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
void TestCaseName::test()
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, TestName, Desc )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); \
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
#endif
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED

View File

@ -41,7 +41,7 @@ namespace Catch {
#else #else
uint64_t getCurrentTicks() { uint64_t getCurrentTicks() {
timeval t; timeval t;
gettimeofday(&t,CATCH_NULL); gettimeofday(&t,nullptr);
return static_cast<uint64_t>( t.tv_sec ) * 1000000ull + static_cast<uint64_t>( t.tv_usec ); return static_cast<uint64_t>( t.tv_sec ) * 1000000ull + static_cast<uint64_t>( t.tv_usec );
} }
#endif #endif

View File

@ -89,7 +89,7 @@ namespace Catch {
ScopedElement( ScopedElement const& other ) ScopedElement( ScopedElement const& other )
: m_writer( other.m_writer ){ : m_writer( other.m_writer ){
other.m_writer = CATCH_NULL; other.m_writer = nullptr;
} }
~ScopedElement() { ~ScopedElement() {

View File

@ -27,11 +27,11 @@ namespace Catch {
return "Reports test results in the format of Automake .trs files"; return "Reports test results in the format of Automake .trs files";
} }
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {} virtual void assertionStarting( AssertionInfo const& ) override {}
virtual bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) CATCH_OVERRIDE { return true; } virtual bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; }
virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) override {
// Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR.
stream << ":test-result: "; stream << ":test-result: ";
if (_testCaseStats.totals.assertions.allPassed()) { if (_testCaseStats.totals.assertions.allPassed()) {
@ -45,7 +45,7 @@ namespace Catch {
StreamingReporterBase::testCaseEnded( _testCaseStats ); StreamingReporterBase::testCaseEnded( _testCaseStats );
} }
virtual void skipTest( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { virtual void skipTest( TestCaseInfo const& testInfo ) override {
stream << ":test-result: SKIP " << testInfo.name << '\n'; stream << ":test-result: SKIP " << testInfo.name << '\n';
} }

View File

@ -50,44 +50,44 @@ namespace Catch {
m_reporterPrefs.shouldRedirectStdOut = false; m_reporterPrefs.shouldRedirectStdOut = false;
} }
virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { virtual ReporterPreferences getPreferences() const override {
return m_reporterPrefs; return m_reporterPrefs;
} }
virtual ~StreamingReporterBase() CATCH_OVERRIDE; virtual ~StreamingReporterBase() override;
virtual void noMatchingTestCases( std::string const& ) CATCH_OVERRIDE {} virtual void noMatchingTestCases( std::string const& ) override {}
virtual void testRunStarting( TestRunInfo const& _testRunInfo ) CATCH_OVERRIDE { virtual void testRunStarting( TestRunInfo const& _testRunInfo ) override {
currentTestRunInfo = _testRunInfo; currentTestRunInfo = _testRunInfo;
} }
virtual void testGroupStarting( GroupInfo const& _groupInfo ) CATCH_OVERRIDE { virtual void testGroupStarting( GroupInfo const& _groupInfo ) override {
currentGroupInfo = _groupInfo; currentGroupInfo = _groupInfo;
} }
virtual void testCaseStarting( TestCaseInfo const& _testInfo ) CATCH_OVERRIDE { virtual void testCaseStarting( TestCaseInfo const& _testInfo ) override {
currentTestCaseInfo = _testInfo; currentTestCaseInfo = _testInfo;
} }
virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE { virtual void sectionStarting( SectionInfo const& _sectionInfo ) override {
m_sectionStack.push_back( _sectionInfo ); m_sectionStack.push_back( _sectionInfo );
} }
virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) CATCH_OVERRIDE { virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) override {
m_sectionStack.pop_back(); m_sectionStack.pop_back();
} }
virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) override {
currentTestCaseInfo.reset(); currentTestCaseInfo.reset();
} }
virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) CATCH_OVERRIDE { virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) override {
currentGroupInfo.reset(); currentGroupInfo.reset();
} }
virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) CATCH_OVERRIDE { virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) override {
currentTestCaseInfo.reset(); currentTestCaseInfo.reset();
currentGroupInfo.reset(); currentGroupInfo.reset();
currentTestRunInfo.reset(); currentTestRunInfo.reset();
} }
virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE { virtual void skipTest( TestCaseInfo const& ) override {
// Don't do anything with this by default. // Don't do anything with this by default.
// It can optionally be overridden in the derived class. // It can optionally be overridden in the derived class.
} }
@ -157,16 +157,16 @@ namespace Catch {
} }
~CumulativeReporterBase(); ~CumulativeReporterBase();
virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { virtual ReporterPreferences getPreferences() const override {
return m_reporterPrefs; return m_reporterPrefs;
} }
virtual void testRunStarting( TestRunInfo const& ) CATCH_OVERRIDE {} virtual void testRunStarting( TestRunInfo const& ) override {}
virtual void testGroupStarting( GroupInfo const& ) CATCH_OVERRIDE {} virtual void testGroupStarting( GroupInfo const& ) override {}
virtual void testCaseStarting( TestCaseInfo const& ) CATCH_OVERRIDE {} virtual void testCaseStarting( TestCaseInfo const& ) override {}
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { virtual void sectionStarting( SectionInfo const& sectionInfo ) override {
SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
Ptr<SectionNode> node; Ptr<SectionNode> node;
if( m_sectionStack.empty() ) { if( m_sectionStack.empty() ) {
@ -191,9 +191,9 @@ namespace Catch {
m_deepestSection = node; m_deepestSection = node;
} }
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {} virtual void assertionStarting( AssertionInfo const& ) override {}
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& assertionStats ) override {
assert( !m_sectionStack.empty() ); assert( !m_sectionStack.empty() );
SectionNode& sectionNode = *m_sectionStack.back(); SectionNode& sectionNode = *m_sectionStack.back();
sectionNode.assertions.push_back( assertionStats ); sectionNode.assertions.push_back( assertionStats );
@ -205,13 +205,13 @@ namespace Catch {
prepareExpandedExpression( sectionNode.assertions.back().assertionResult ); prepareExpandedExpression( sectionNode.assertions.back().assertionResult );
return true; return true;
} }
virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { virtual void sectionEnded( SectionStats const& sectionStats ) override {
assert( !m_sectionStack.empty() ); assert( !m_sectionStack.empty() );
SectionNode& node = *m_sectionStack.back(); SectionNode& node = *m_sectionStack.back();
node.stats = sectionStats; node.stats = sectionStats;
m_sectionStack.pop_back(); m_sectionStack.pop_back();
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override {
Ptr<TestCaseNode> node = new TestCaseNode( testCaseStats ); Ptr<TestCaseNode> node = new TestCaseNode( testCaseStats );
assert( m_sectionStack.size() == 0 ); assert( m_sectionStack.size() == 0 );
node->children.push_back( m_rootSection ); node->children.push_back( m_rootSection );
@ -222,12 +222,12 @@ namespace Catch {
m_deepestSection->stdOut = testCaseStats.stdOut; m_deepestSection->stdOut = testCaseStats.stdOut;
m_deepestSection->stdErr = testCaseStats.stdErr; m_deepestSection->stdErr = testCaseStats.stdErr;
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override {
Ptr<TestGroupNode> node = new TestGroupNode( testGroupStats ); Ptr<TestGroupNode> node = new TestGroupNode( testGroupStats );
node->children.swap( m_testCases ); node->children.swap( m_testCases );
m_testGroups.push_back( node ); m_testGroups.push_back( node );
} }
virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { virtual void testRunEnded( TestRunStats const& testRunStats ) override {
Ptr<TestRunNode> node = new TestRunNode( testRunStats ); Ptr<TestRunNode> node = new TestRunNode( testRunStats );
node->children.swap( m_testGroups ); node->children.swap( m_testGroups );
m_testRuns.push_back( node ); m_testRuns.push_back( node );
@ -235,7 +235,7 @@ namespace Catch {
} }
virtual void testRunEndedCumulative() = 0; virtual void testRunEndedCumulative() = 0;
virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE {} virtual void skipTest( TestCaseInfo const& ) override {}
virtual void prepareExpandedExpression( AssertionResult& result ) const { virtual void prepareExpandedExpression( AssertionResult& result ) const {
if( result.isOk() ) if( result.isOk() )
@ -276,8 +276,8 @@ namespace Catch {
: StreamingReporterBase( _config ) : StreamingReporterBase( _config )
{} {}
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {} virtual void assertionStarting( AssertionInfo const& ) override {}
virtual bool assertionEnded( AssertionStats const& ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& ) override {
return false; return false;
} }
}; };

View File

@ -58,7 +58,7 @@ namespace Catch {
return true; return true;
} }
virtual void sectionEnded(SectionStats const& _sectionStats) CATCH_OVERRIDE { virtual void sectionEnded(SectionStats const& _sectionStats) override {
if (m_config->showDurations() == ShowDurations::Always) { if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
} }

View File

@ -25,19 +25,19 @@ namespace Catch {
m_headerPrinted( false ) m_headerPrinted( false )
{} {}
virtual ~ConsoleReporter() CATCH_OVERRIDE; virtual ~ConsoleReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as plain lines of text"; return "Reports test results as plain lines of text";
} }
virtual void noMatchingTestCases( std::string const& spec ) CATCH_OVERRIDE { virtual void noMatchingTestCases( std::string const& spec ) override {
stream << "No test cases matched '" << spec << '\'' << std::endl; stream << "No test cases matched '" << spec << '\'' << std::endl;
} }
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { virtual void assertionStarting( AssertionInfo const& ) override {
} }
virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& _assertionStats ) override {
AssertionResult const& result = _assertionStats.assertionResult; AssertionResult const& result = _assertionStats.assertionResult;
bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
@ -54,11 +54,11 @@ namespace Catch {
return true; return true;
} }
virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE { virtual void sectionStarting( SectionInfo const& _sectionInfo ) override {
m_headerPrinted = false; m_headerPrinted = false;
StreamingReporterBase::sectionStarting( _sectionInfo ); StreamingReporterBase::sectionStarting( _sectionInfo );
} }
virtual void sectionEnded( SectionStats const& _sectionStats ) CATCH_OVERRIDE { virtual void sectionEnded( SectionStats const& _sectionStats ) override {
if( _sectionStats.missingAssertions ) { if( _sectionStats.missingAssertions ) {
lazyPrint(); lazyPrint();
Colour colour( Colour::ResultError ); Colour colour( Colour::ResultError );
@ -77,11 +77,11 @@ namespace Catch {
StreamingReporterBase::sectionEnded( _sectionStats ); StreamingReporterBase::sectionEnded( _sectionStats );
} }
virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) override {
StreamingReporterBase::testCaseEnded( _testCaseStats ); StreamingReporterBase::testCaseEnded( _testCaseStats );
m_headerPrinted = false; m_headerPrinted = false;
} }
virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) CATCH_OVERRIDE { virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) override {
if( currentGroupInfo.used ) { if( currentGroupInfo.used ) {
printSummaryDivider(); printSummaryDivider();
stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n";
@ -90,7 +90,7 @@ namespace Catch {
} }
StreamingReporterBase::testGroupEnded( _testGroupStats ); StreamingReporterBase::testGroupEnded( _testGroupStats );
} }
virtual void testRunEnded( TestRunStats const& _testRunStats ) CATCH_OVERRIDE { virtual void testRunEnded( TestRunStats const& _testRunStats ) override {
printTotalsDivider( _testRunStats.totals ); printTotalsDivider( _testRunStats.totals );
printTotals( _testRunStats.totals ); printTotals( _testRunStats.totals );
stream << std::endl; stream << std::endl;
@ -218,10 +218,10 @@ namespace Catch {
void printMessage() const { void printMessage() const {
if( !messageLabel.empty() ) if( !messageLabel.empty() )
stream << messageLabel << ':' << '\n'; stream << messageLabel << ':' << '\n';
for( auto const& message : messages ) { for( auto const& msg : messages ) {
// If this assertion is a warning ignore any INFO messages // If this assertion is a warning ignore any INFO messages
if( printInfoMessages || message.type != ResultWas::Info ) if( printInfoMessages || msg.type != ResultWas::Info )
stream << Text( message.message, TextAttributes().setIndent(2) ) << '\n'; stream << Text( msg.message, TextAttributes().setIndent(2) ) << '\n';
} }
} }
void printSourceInfo() const { void printSourceInfo() const {

View File

@ -57,20 +57,20 @@ namespace Catch {
m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
} }
virtual ~JunitReporter() CATCH_OVERRIDE; virtual ~JunitReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in an XML format that looks like Ant's junitreport target"; return "Reports test results in an XML format that looks like Ant's junitreport target";
} }
virtual void noMatchingTestCases( std::string const& /*spec*/ ) CATCH_OVERRIDE {} virtual void noMatchingTestCases( std::string const& /*spec*/ ) override {}
virtual void testRunStarting( TestRunInfo const& runInfo ) CATCH_OVERRIDE { virtual void testRunStarting( TestRunInfo const& runInfo ) override {
CumulativeReporterBase::testRunStarting( runInfo ); CumulativeReporterBase::testRunStarting( runInfo );
xml.startElement( "testsuites" ); xml.startElement( "testsuites" );
} }
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { virtual void testGroupStarting( GroupInfo const& groupInfo ) override {
suiteTimer.start(); suiteTimer.start();
stdOutForSuite.str(""); stdOutForSuite.str("");
stdErrForSuite.str(""); stdErrForSuite.str("");
@ -78,28 +78,28 @@ namespace Catch {
CumulativeReporterBase::testGroupStarting( groupInfo ); CumulativeReporterBase::testGroupStarting( groupInfo );
} }
virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) CATCH_OVERRIDE { virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) override {
m_okToFail = testCaseInfo.okToFail(); m_okToFail = testCaseInfo.okToFail();
} }
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& assertionStats ) override {
if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
unexpectedExceptions++; unexpectedExceptions++;
return CumulativeReporterBase::assertionEnded( assertionStats ); return CumulativeReporterBase::assertionEnded( assertionStats );
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override {
stdOutForSuite << testCaseStats.stdOut; stdOutForSuite << testCaseStats.stdOut;
stdErrForSuite << testCaseStats.stdErr; stdErrForSuite << testCaseStats.stdErr;
CumulativeReporterBase::testCaseEnded( testCaseStats ); CumulativeReporterBase::testCaseEnded( testCaseStats );
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override {
double suiteTime = suiteTimer.getElapsedSeconds(); double suiteTime = suiteTimer.getElapsedSeconds();
CumulativeReporterBase::testGroupEnded( testGroupStats ); CumulativeReporterBase::testGroupEnded( testGroupStats );
writeGroup( *m_testGroups.back(), suiteTime ); writeGroup( *m_testGroups.back(), suiteTime );
} }
virtual void testRunEndedCumulative() CATCH_OVERRIDE { virtual void testRunEndedCumulative() override {
xml.endElement(); xml.endElement();
} }

View File

@ -23,79 +23,79 @@ public:
public: // IStreamingReporter public: // IStreamingReporter
virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { virtual ReporterPreferences getPreferences() const override {
return m_reporters[0]->getPreferences(); return m_reporters[0]->getPreferences();
} }
virtual void noMatchingTestCases( std::string const& spec ) CATCH_OVERRIDE { virtual void noMatchingTestCases( std::string const& spec ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->noMatchingTestCases( spec ); reporter->noMatchingTestCases( spec );
} }
virtual void testRunStarting( TestRunInfo const& testRunInfo ) CATCH_OVERRIDE { virtual void testRunStarting( TestRunInfo const& testRunInfo ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->testRunStarting( testRunInfo ); reporter->testRunStarting( testRunInfo );
} }
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { virtual void testGroupStarting( GroupInfo const& groupInfo ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->testGroupStarting( groupInfo ); reporter->testGroupStarting( groupInfo );
} }
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { virtual void testCaseStarting( TestCaseInfo const& testInfo ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->testCaseStarting( testInfo ); reporter->testCaseStarting( testInfo );
} }
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { virtual void sectionStarting( SectionInfo const& sectionInfo ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->sectionStarting( sectionInfo ); reporter->sectionStarting( sectionInfo );
} }
virtual void assertionStarting( AssertionInfo const& assertionInfo ) CATCH_OVERRIDE { virtual void assertionStarting( AssertionInfo const& assertionInfo ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->assertionStarting( assertionInfo ); reporter->assertionStarting( assertionInfo );
} }
// The return value indicates if the messages buffer should be cleared: // The return value indicates if the messages buffer should be cleared:
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& assertionStats ) override {
bool clearBuffer = false; bool clearBuffer = false;
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
clearBuffer |= reporter->assertionEnded( assertionStats ); clearBuffer |= reporter->assertionEnded( assertionStats );
return clearBuffer; return clearBuffer;
} }
virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { virtual void sectionEnded( SectionStats const& sectionStats ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->sectionEnded( sectionStats ); reporter->sectionEnded( sectionStats );
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->testCaseEnded( testCaseStats ); reporter->testCaseEnded( testCaseStats );
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->testGroupEnded( testGroupStats ); reporter->testGroupEnded( testGroupStats );
} }
virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { virtual void testRunEnded( TestRunStats const& testRunStats ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->testRunEnded( testRunStats ); reporter->testRunEnded( testRunStats );
} }
virtual void skipTest( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { virtual void skipTest( TestCaseInfo const& testInfo ) override {
for( auto const& reporter : m_reporters ) for( auto const& reporter : m_reporters )
reporter->skipTest( testInfo ); reporter->skipTest( testInfo );
} }
virtual MultipleReporters* tryAsMulti() CATCH_OVERRIDE { virtual MultipleReporters* tryAsMulti() override {
return this; return this;
} }

View File

@ -43,33 +43,33 @@ namespace Catch {
replaceInPlace( escaped, "]", "|]" ); replaceInPlace( escaped, "]", "|]" );
return escaped; return escaped;
} }
virtual ~TeamCityReporter() CATCH_OVERRIDE; virtual ~TeamCityReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as TeamCity service messages"; return "Reports test results as TeamCity service messages";
} }
virtual void skipTest( TestCaseInfo const& /* testInfo */ ) CATCH_OVERRIDE { virtual void skipTest( TestCaseInfo const& /* testInfo */ ) override {
} }
virtual void noMatchingTestCases( std::string const& /* spec */ ) CATCH_OVERRIDE {} virtual void noMatchingTestCases( std::string const& /* spec */ ) override {}
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { virtual void testGroupStarting( GroupInfo const& groupInfo ) override {
StreamingReporterBase::testGroupStarting( groupInfo ); StreamingReporterBase::testGroupStarting( groupInfo );
stream << "##teamcity[testSuiteStarted name='" stream << "##teamcity[testSuiteStarted name='"
<< escape( groupInfo.name ) << "']\n"; << escape( groupInfo.name ) << "']\n";
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override {
StreamingReporterBase::testGroupEnded( testGroupStats ); StreamingReporterBase::testGroupEnded( testGroupStats );
stream << "##teamcity[testSuiteFinished name='" stream << "##teamcity[testSuiteFinished name='"
<< escape( testGroupStats.groupInfo.name ) << "']\n"; << escape( testGroupStats.groupInfo.name ) << "']\n";
} }
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { virtual void assertionStarting( AssertionInfo const& ) override {
} }
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& assertionStats ) override {
AssertionResult const& result = assertionStats.assertionResult; AssertionResult const& result = assertionStats.assertionResult;
if( !result.isOk() ) { if( !result.isOk() ) {
@ -140,18 +140,18 @@ namespace Catch {
return true; return true;
} }
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { virtual void sectionStarting( SectionInfo const& sectionInfo ) override {
m_headerPrintedForThisSection = false; m_headerPrintedForThisSection = false;
StreamingReporterBase::sectionStarting( sectionInfo ); StreamingReporterBase::sectionStarting( sectionInfo );
} }
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { virtual void testCaseStarting( TestCaseInfo const& testInfo ) override {
StreamingReporterBase::testCaseStarting( testInfo ); StreamingReporterBase::testCaseStarting( testInfo );
stream << "##teamcity[testStarted name='" stream << "##teamcity[testStarted name='"
<< escape( testInfo.name ) << "']\n"; << escape( testInfo.name ) << "']\n";
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override {
StreamingReporterBase::testCaseEnded( testCaseStats ); StreamingReporterBase::testCaseEnded( testCaseStats );
if( !testCaseStats.stdOut.empty() ) if( !testCaseStats.stdOut.empty() )
stream << "##teamcity[testStdOut name='" stream << "##teamcity[testStdOut name='"

View File

@ -26,7 +26,7 @@ namespace Catch {
m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
} }
virtual ~XmlReporter() CATCH_OVERRIDE; virtual ~XmlReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results as an XML document"; return "Reports test results as an XML document";
@ -44,11 +44,11 @@ namespace Catch {
public: // StreamingReporterBase public: // StreamingReporterBase
virtual void noMatchingTestCases( std::string const& s ) CATCH_OVERRIDE { virtual void noMatchingTestCases( std::string const& s ) override {
StreamingReporterBase::noMatchingTestCases( s ); StreamingReporterBase::noMatchingTestCases( s );
} }
virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE { virtual void testRunStarting( TestRunInfo const& testInfo ) override {
StreamingReporterBase::testRunStarting( testInfo ); StreamingReporterBase::testRunStarting( testInfo );
std::string stylesheetRef = getStylesheetRef(); std::string stylesheetRef = getStylesheetRef();
if( !stylesheetRef.empty() ) if( !stylesheetRef.empty() )
@ -58,13 +58,13 @@ namespace Catch {
m_xml.writeAttribute( "name", m_config->name() ); m_xml.writeAttribute( "name", m_config->name() );
} }
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { virtual void testGroupStarting( GroupInfo const& groupInfo ) override {
StreamingReporterBase::testGroupStarting( groupInfo ); StreamingReporterBase::testGroupStarting( groupInfo );
m_xml.startElement( "Group" ) m_xml.startElement( "Group" )
.writeAttribute( "name", groupInfo.name ); .writeAttribute( "name", groupInfo.name );
} }
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { virtual void testCaseStarting( TestCaseInfo const& testInfo ) override {
StreamingReporterBase::testCaseStarting(testInfo); StreamingReporterBase::testCaseStarting(testInfo);
m_xml.startElement( "TestCase" ) m_xml.startElement( "TestCase" )
.writeAttribute( "name", trim( testInfo.name ) ) .writeAttribute( "name", trim( testInfo.name ) )
@ -78,7 +78,7 @@ namespace Catch {
m_xml.ensureTagClosed(); m_xml.ensureTagClosed();
} }
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { virtual void sectionStarting( SectionInfo const& sectionInfo ) override {
StreamingReporterBase::sectionStarting( sectionInfo ); StreamingReporterBase::sectionStarting( sectionInfo );
if( m_sectionDepth++ > 0 ) { if( m_sectionDepth++ > 0 ) {
m_xml.startElement( "Section" ) m_xml.startElement( "Section" )
@ -89,9 +89,9 @@ namespace Catch {
} }
} }
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { } virtual void assertionStarting( AssertionInfo const& ) override { }
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& assertionStats ) override {
AssertionResult const& result = assertionStats.assertionResult; AssertionResult const& result = assertionStats.assertionResult;
@ -166,7 +166,7 @@ namespace Catch {
return true; return true;
} }
virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { virtual void sectionEnded( SectionStats const& sectionStats ) override {
StreamingReporterBase::sectionEnded( sectionStats ); StreamingReporterBase::sectionEnded( sectionStats );
if( --m_sectionDepth > 0 ) { if( --m_sectionDepth > 0 ) {
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
@ -181,7 +181,7 @@ namespace Catch {
} }
} }
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override {
StreamingReporterBase::testCaseEnded( testCaseStats ); StreamingReporterBase::testCaseEnded( testCaseStats );
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
@ -197,7 +197,7 @@ namespace Catch {
m_xml.endElement(); m_xml.endElement();
} }
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override {
StreamingReporterBase::testGroupEnded( testGroupStats ); StreamingReporterBase::testGroupEnded( testGroupStats );
// TODO: Check testGroupStats.aborting and act accordingly. // TODO: Check testGroupStats.aborting and act accordingly.
m_xml.scopedElement( "OverallResults" ) m_xml.scopedElement( "OverallResults" )
@ -207,7 +207,7 @@ namespace Catch {
m_xml.endElement(); m_xml.endElement();
} }
virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { virtual void testRunEnded( TestRunStats const& testRunStats ) override {
StreamingReporterBase::testRunEnded( testRunStats ); StreamingReporterBase::testRunEnded( testRunStats );
m_xml.scopedElement( "OverallResults" ) m_xml.scopedElement( "OverallResults" )
.writeAttribute( "successes", testRunStats.totals.assertions.passed ) .writeAttribute( "successes", testRunStats.totals.assertions.passed )

View File

@ -153,7 +153,6 @@ TEST_CASE( "Absolute margin", "[Approx]" ) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
class StrongDoubleTypedef class StrongDoubleTypedef
{ {
double d_ = 0.0; double d_ = 0.0;
@ -192,6 +191,5 @@ TEST_CASE
REQUIRE(Approx(11.0) >= td); REQUIRE(Approx(11.0) >= td);
} }
#endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -13,7 +13,7 @@
# pragma clang diagnostic ignored "-Wc++98-compat" # pragma clang diagnostic ignored "-Wc++98-compat"
#endif #endif
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( CATCH_NULL, "", name, desc, CATCH_INTERNAL_LINEINFO ); } inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( nullptr, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
TEST_CASE( "Parse test names and tags", "" ) { TEST_CASE( "Parse test names and tags", "" ) {

View File

@ -257,32 +257,32 @@ TEST_CASE( "Comparisons between ints where one side is computed", "" )
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
inline const char* returnsConstNull(){ return CATCH_NULL; } inline const char* returnsConstNull(){ return nullptr; }
inline char* returnsNull(){ return CATCH_NULL; } inline char* returnsNull(){ return nullptr; }
TEST_CASE( "Pointers can be compared to null", "" ) TEST_CASE( "Pointers can be compared to null", "" )
{ {
TestData* p = CATCH_NULL; TestData* p = nullptr;
TestData* pNULL = CATCH_NULL; TestData* pNULL = nullptr;
REQUIRE( p == CATCH_NULL ); REQUIRE( p == nullptr );
REQUIRE( p == pNULL ); REQUIRE( p == pNULL );
TestData data; TestData data;
p = &data; p = &data;
REQUIRE( p != CATCH_NULL ); REQUIRE( p != nullptr );
const TestData* cp = p; const TestData* cp = p;
REQUIRE( cp != CATCH_NULL ); REQUIRE( cp != nullptr );
const TestData* const cpc = p; const TestData* const cpc = p;
REQUIRE( cpc != CATCH_NULL ); REQUIRE( cpc != nullptr );
REQUIRE( returnsNull() == CATCH_NULL ); REQUIRE( returnsNull() == nullptr );
REQUIRE( returnsConstNull() == CATCH_NULL ); REQUIRE( returnsConstNull() == nullptr );
REQUIRE( CATCH_NULL != p ); REQUIRE( nullptr != p );
} }
// Not (!) tests // Not (!) tests

View File

@ -120,7 +120,7 @@ public:
CustomStdException( const std::string& msg ) CustomStdException( const std::string& msg )
: m_msg( msg ) : m_msg( msg )
{} {}
~CustomStdException() CATCH_NOEXCEPT {} ~CustomStdException() noexcept {}
std::string getMessage() const std::string getMessage() const
{ {

View File

@ -62,7 +62,6 @@ TEST_CASE( "FAIL_CHECK does not abort the test", "[failing][messages][.]" )
WARN( "This message appears in the output"); WARN( "This message appears in the output");
} }
#ifdef CATCH_CONFIG_VARIADIC_MACROS
TEST_CASE( "FAIL does not require an argument", "[failing][messages][.]" ) TEST_CASE( "FAIL does not require an argument", "[failing][messages][.]" )
{ {
FAIL(); FAIL();
@ -71,7 +70,6 @@ TEST_CASE( "SUCCESS does not require an argument", "[messages][.]" )
{ {
SUCCEED(); SUCCEED();
} }
#endif
TEST_CASE( "Output from all sections is reported", "[failing][messages][.]" ) TEST_CASE( "Output from all sections is reported", "[failing][messages][.]" )
{ {

View File

@ -131,13 +131,13 @@ TEST_CASE( "Sends stuff to stdout and stderr", "[.]" )
inline const char* makeString( bool makeNull ) inline const char* makeString( bool makeNull )
{ {
return makeNull ? CATCH_NULL : "valid string"; return makeNull ? nullptr : "valid string";
} }
TEST_CASE( "null strings", "" ) TEST_CASE( "null strings", "" )
{ {
REQUIRE( makeString( false ) != static_cast<char*>(CATCH_NULL)); REQUIRE( makeString( false ) != static_cast<char*>(nullptr));
REQUIRE( makeString( true ) == static_cast<char*>(CATCH_NULL)); REQUIRE( makeString( true ) == static_cast<char*>(nullptr));
} }
@ -372,13 +372,11 @@ TEST_CASE( "XmlEncode" ) {
} }
} }
#ifdef CATCH_CONFIG_CPP11_LONG_LONG
TEST_CASE( "long long", "[c++11][.]" ) { TEST_CASE( "long long", "[c++11][.]" ) {
long long l = std::numeric_limits<long long>::max(); long long l = std::numeric_limits<long long>::max();
REQUIRE( l == std::numeric_limits<long long>::max() ); REQUIRE( l == std::numeric_limits<long long>::max() );
} }
#endif
//TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) { //TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) {
// int i = 0; // int i = 0;

View File

@ -43,7 +43,7 @@ std::string parseIntoConfigAndReturnError( const char * (&argv)[size], Catch::Co
return ""; return "";
} }
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( CATCH_NULL, "", name, desc, CATCH_INTERNAL_LINEINFO ); } inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( nullptr, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {

View File

@ -236,7 +236,7 @@ struct Obj
TEST_CASE("boolean member", "[Tricky]") TEST_CASE("boolean member", "[Tricky]")
{ {
Obj obj; Obj obj;
REQUIRE( obj.prop != CATCH_NULL ); REQUIRE( obj.prop != nullptr );
} }
// Tests for a problem submitted by Ralph McArdell // Tests for a problem submitted by Ralph McArdell

View File

@ -8,7 +8,6 @@
#include "catch.hpp" #include "catch.hpp"
#ifdef CATCH_CONFIG_VARIADIC_MACROS
TEST_CASE() TEST_CASE()
{ {
@ -28,4 +27,3 @@ TEST_CASE( "Variadic macros", "[variadic][sections]" )
} }
} }
#endif