diff --git a/include/catch.hpp b/include/catch.hpp index bf0d72d6..2182ba8c 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -130,25 +130,15 @@ LeakDetector leakDetector; #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) ) -#ifdef CATCH_CONFIG_VARIADIC_MACROS - #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_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_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_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__ ) -#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_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __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_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __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_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_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" ) #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 ) // "BDD-style" convenience wrappers -#ifdef CATCH_CONFIG_VARIADIC_MACROS #define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "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_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + 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 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_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__ ) @@ -222,16 +206,6 @@ LeakDetector leakDetector; #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 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 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 ) // "BDD-style" convenience wrappers -#ifdef CATCH_CONFIG_VARIADIC_MACROS #define SCENARIO( ... ) TEST_CASE( "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 WHEN( desc ) SECTION( std::string(" When: ") + desc, "" ) #define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc, "" ) diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h index a193c556..c729e8d0 100644 --- a/include/internal/catch_assertionresult.h +++ b/include/internal/catch_assertionresult.h @@ -53,7 +53,7 @@ namespace Catch { struct AssertionResultData { - AssertionResultData() : decomposedExpression( CATCH_NULL ) + AssertionResultData() : decomposedExpression( nullptr ) , resultType( ResultWas::Unknown ) , negated( false ) , parenthesized( false ) {} @@ -68,7 +68,7 @@ namespace Catch { } std::string const& reconstructExpression() const { - if( decomposedExpression != CATCH_NULL ) { + if( decomposedExpression != nullptr ) { decomposedExpression->reconstructExpression( reconstructedExpression ); if( parenthesized ) { reconstructedExpression.insert( 0, 1, '(' ); @@ -77,7 +77,7 @@ namespace Catch { if( negated ) { reconstructedExpression.insert( 0, 1, '!' ); } - decomposedExpression = CATCH_NULL; + decomposedExpression = nullptr; } return reconstructedExpression; } @@ -95,12 +95,11 @@ namespace Catch { AssertionResult(); AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); ~AssertionResult(); -# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS - AssertionResult( AssertionResult const& ) = default; - AssertionResult( AssertionResult && ) = default; - AssertionResult& operator = ( AssertionResult const& ) = default; - AssertionResult& operator = ( AssertionResult && ) = default; -# endif + + AssertionResult( AssertionResult const& ) = default; + AssertionResult( AssertionResult && ) = default; + AssertionResult& operator = ( AssertionResult const& ) = default; + AssertionResult& operator = ( AssertionResult && ) = default; bool isOk() const; bool succeeded() const; diff --git a/include/internal/catch_assertionresult.hpp b/include/internal/catch_assertionresult.hpp index 9b637028..bbabaf1f 100644 --- a/include/internal/catch_assertionresult.hpp +++ b/include/internal/catch_assertionresult.hpp @@ -87,7 +87,7 @@ namespace Catch { } void AssertionResult::discardDecomposedExpression() const { - m_resultData.decomposedExpression = CATCH_NULL; + m_resultData.decomposedExpression = nullptr; } void AssertionResult::expandDecomposedExpression() const { diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 58993718..ee3dd598 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -143,7 +143,6 @@ /////////////////////////////////////////////////////////////////////////////// -#ifdef CATCH_CONFIG_VARIADIC_MACROS #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ @@ -151,15 +150,6 @@ __catchResult.captureResult( messageType ); \ INTERNAL_CATCH_REACT( __catchResult ) \ } 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 ) \ diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index bdf0f318..c207d8e8 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -34,15 +34,10 @@ namespace Catch { }; }; class NonCopyable { -#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS NonCopyable( NonCopyable const& ) = delete; NonCopyable( NonCopyable && ) = delete; NonCopyable& operator = ( NonCopyable const& ) = delete; NonCopyable& operator = ( NonCopyable && ) = delete; -#else - NonCopyable( NonCopyable const& info ); - NonCopyable& operator = ( NonCopyable const& ); -#endif protected: NonCopyable() {} @@ -94,12 +89,12 @@ namespace Catch { SourceLineInfo(); SourceLineInfo( char const* _file, std::size_t _line ); -# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS + SourceLineInfo(SourceLineInfo const& other) = default; SourceLineInfo( SourceLineInfo && ) = default; SourceLineInfo& operator = ( SourceLineInfo const& ) = default; SourceLineInfo& operator = ( SourceLineInfo && ) = default; -# endif + bool empty() const; bool operator == ( SourceLineInfo const& other ) const; bool operator < ( SourceLineInfo const& other ) const; diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index ac6f259d..9684cf8f 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -8,23 +8,9 @@ #ifndef 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: // -// 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_WINDOWS_SEH : is Windows SEH supported? // CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? @@ -34,18 +20,13 @@ // **************** // In general each macro has a _NO_ 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 // 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 -# if __cplusplus >= 201103L -# define CATCH_CPP11_OR_GREATER -# endif - # if __cplusplus >= 201402L # define CATCH_CPP14_OR_GREATER # endif @@ -54,15 +35,7 @@ #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 \ _Pragma( "clang diagnostic push" ) \ _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) @@ -74,7 +47,6 @@ _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ _Pragma( "clang diagnostic pop" ) -# endif #endif // __clang__ @@ -125,14 +97,6 @@ // GCC #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__ @@ -142,32 +106,10 @@ #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 //////////////////////////////////////////////////////////////////////////////// -// 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 #if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \ ( defined __GNUC__ && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 ) || \ @@ -177,95 +119,15 @@ #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 -#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 // analytics) because, at time of writing, __COUNTER__ is not properly handled by it. // This does not affect compilation #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) && !defined(__JETBRAINS_IDE__) # define CATCH_CONFIG_COUNTER #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) # define CATCH_CONFIG_WINDOWS_SEH #endif @@ -283,35 +145,6 @@ # define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS #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 -#else -# define CATCH_AUTO_PTR( T ) std::auto_ptr -#endif #endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 5431cb9a..64141e7f 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -113,25 +113,25 @@ namespace Catch { std::string getProcessName() const { return m_data.processName; } std::vector const& getReporterNames() const { return m_data.reporterNames; } - std::vector const& getSectionsToRun() const CATCH_OVERRIDE { return m_data.sectionsToRun; } + std::vector 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; } // IConfig interface - virtual bool allowThrows() const CATCH_OVERRIDE { return !m_data.noThrow; } - virtual std::ostream& stream() const CATCH_OVERRIDE { return m_stream->stream(); } - virtual std::string name() const CATCH_OVERRIDE { return m_data.name.empty() ? m_data.processName : m_data.name; } - virtual bool includeSuccessfulResults() const CATCH_OVERRIDE { return m_data.showSuccessfulTests; } - virtual bool warnAboutMissingAssertions() const CATCH_OVERRIDE { return m_data.warnings & WarnAbout::NoAssertions; } - virtual ShowDurations::OrNot showDurations() const CATCH_OVERRIDE { return m_data.showDurations; } - virtual RunTests::InWhatOrder runOrder() const CATCH_OVERRIDE { return m_data.runOrder; } - virtual unsigned int rngSeed() const CATCH_OVERRIDE { return m_data.rngSeed; } - virtual UseColour::YesOrNo useColour() const CATCH_OVERRIDE { return m_data.useColour; } - virtual bool shouldDebugBreak() const CATCH_OVERRIDE { return m_data.shouldDebugBreak; } - virtual int abortAfter() const CATCH_OVERRIDE { return m_data.abortAfter; } - virtual bool showInvisibles() const CATCH_OVERRIDE { return m_data.showInvisibles; } + virtual bool allowThrows() const override { return !m_data.noThrow; } + virtual std::ostream& stream() const override { return m_stream->stream(); } + virtual std::string name() const override { return m_data.name.empty() ? m_data.processName : m_data.name; } + virtual bool includeSuccessfulResults() const override { return m_data.showSuccessfulTests; } + virtual bool warnAboutMissingAssertions() const override { return m_data.warnings & WarnAbout::NoAssertions; } + virtual ShowDurations::OrNot showDurations() const override { return m_data.showDurations; } + virtual RunTests::InWhatOrder runOrder() const override { return m_data.runOrder; } + virtual unsigned int rngSeed() const override { return m_data.rngSeed; } + virtual UseColour::YesOrNo useColour() const override { return m_data.useColour; } + virtual bool shouldDebugBreak() const override { return m_data.shouldDebugBreak; } + virtual int abortAfter() const override { return m_data.abortAfter; } + virtual bool showInvisibles() const override { return m_data.showInvisibles; } private: @@ -149,7 +149,7 @@ namespace Catch { } ConfigData m_data; - CATCH_AUTO_PTR( IStream const ) m_stream; + std::unique_ptr m_stream; TestSpec m_testSpec; }; diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp index 8516ad93..84f1ca1c 100644 --- a/include/internal/catch_context_impl.hpp +++ b/include/internal/catch_context_impl.hpp @@ -18,7 +18,7 @@ namespace Catch { 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& ); void operator=( Context const& ); @@ -69,7 +69,7 @@ namespace Catch { m_generatorsByTestName.find( testName ); return it != m_generatorsByTestName.end() ? it->second - : CATCH_NULL; + : nullptr; } IGeneratorsForTest& getGeneratorsForCurrentTest() { @@ -90,7 +90,7 @@ namespace Catch { }; namespace { - Context* currentContext = CATCH_NULL; + Context* currentContext = nullptr; } IMutableContext& getCurrentMutableContext() { if( !currentContext ) @@ -103,7 +103,7 @@ namespace Catch { void cleanUpContext() { delete currentContext; - currentContext = CATCH_NULL; + currentContext = nullptr; } } diff --git a/include/internal/catch_debugger.hpp b/include/internal/catch_debugger.hpp index 00017d16..2048904a 100644 --- a/include/internal/catch_debugger.hpp +++ b/include/internal/catch_debugger.hpp @@ -49,7 +49,7 @@ // Call sysctl. 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; return false; } diff --git a/include/internal/catch_expression_lhs.hpp b/include/internal/catch_expression_lhs.hpp index 106a6b0a..8cf41409 100644 --- a/include/internal/catch_expression_lhs.hpp +++ b/include/internal/catch_expression_lhs.hpp @@ -80,7 +80,7 @@ public: .endExpression( *this ); } - virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE { + virtual void reconstructExpression( std::string& dest ) const override { dest = Catch::toString( m_truthy ); } @@ -115,11 +115,11 @@ public: .endExpression( *this ); } - virtual bool isBinaryExpression() const CATCH_OVERRIDE { + virtual bool isBinaryExpression() const override { 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 rhs = Catch::toString( m_rhs ); char delim = lhs.size() + rhs.size() < 40 && @@ -149,11 +149,11 @@ public: MatchExpression( ArgT arg, MatcherT matcher, char const* matcherString ) : m_arg( arg ), m_matcher( matcher ), m_matcherString( matcherString ) {} - virtual bool isBinaryExpression() const CATCH_OVERRIDE { + virtual bool isBinaryExpression() const override { 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(); dest = Catch::toString( m_arg ); dest += ' '; diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp index 1d6674fc..810d9e0f 100644 --- a/include/internal/catch_fatal_condition.hpp +++ b/include/internal/catch_fatal_condition.hpp @@ -66,7 +66,7 @@ namespace Catch { // 32k seems enough for Catch to handle stack overflow, // but the value was found experimentally, so there is no strong guarantee guaranteeSize = 32 * 1024; - exceptionHandlerHandle = CATCH_NULL; + exceptionHandlerHandle = nullptr; // Register as first handler in current chain exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); // Pass in guarantee size to be filled @@ -78,7 +78,7 @@ namespace Catch { // Unregister handler and restore the old guarantee RemoveVectoredExceptionHandler(exceptionHandlerHandle); SetThreadStackGuarantee(&guaranteeSize); - exceptionHandlerHandle = CATCH_NULL; + exceptionHandlerHandle = nullptr; isSet = false; } } @@ -94,7 +94,7 @@ namespace Catch { bool FatalConditionHandler::isSet = false; ULONG FatalConditionHandler::guaranteeSize = 0; - PVOID FatalConditionHandler::exceptionHandlerHandle = CATCH_NULL; + PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; } // namespace Catch @@ -176,10 +176,10 @@ namespace Catch { if( isSet ) { // 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 ) { - sigaction(signalDefs[i].id, &oldSigActions[i], CATCH_NULL); + sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); } // Return the old stack - sigaltstack(&oldSigStack, CATCH_NULL); + sigaltstack(&oldSigStack, nullptr); isSet = false; } } diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index 85cf266f..e28a8902 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -49,11 +49,11 @@ namespace Catch { // virtual methods NonCopyable::~NonCopyable() {} IShared::~IShared() {} - IStream::~IStream() CATCH_NOEXCEPT {} - FileStream::~FileStream() CATCH_NOEXCEPT {} - CoutStream::~CoutStream() CATCH_NOEXCEPT {} - DebugOutStream::~DebugOutStream() CATCH_NOEXCEPT {} - StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {} + IStream::~IStream() noexcept {} + FileStream::~FileStream() noexcept {} + CoutStream::~CoutStream() noexcept {} + DebugOutStream::~DebugOutStream() noexcept {} + StreamBufBase::~StreamBufBase() noexcept {} IContext::~IContext() {} IResultCapture::~IResultCapture() {} ITestCase::~ITestCase() {} diff --git a/include/internal/catch_interfaces_exception.h b/include/internal/catch_interfaces_exception.h index bf29b715..6387ba9d 100644 --- a/include/internal/catch_interfaces_exception.h +++ b/include/internal/catch_interfaces_exception.h @@ -40,7 +40,7 @@ namespace Catch { : 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 { if( it == itEnd ) throw; diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 6c47d8e4..a1c5aa57 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -100,12 +100,10 @@ namespace Catch } virtual ~AssertionStats(); -# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS AssertionStats( AssertionStats const& ) = default; AssertionStats( AssertionStats && ) = default; AssertionStats& operator = ( AssertionStats const& ) = default; AssertionStats& operator = ( AssertionStats && ) = default; -# endif AssertionResult assertionResult; std::vector infoMessages; @@ -123,12 +121,10 @@ namespace Catch missingAssertions( _missingAssertions ) {} virtual ~SectionStats(); -# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS SectionStats( SectionStats const& ) = default; SectionStats( SectionStats && ) = default; SectionStats& operator = ( SectionStats const& ) = default; SectionStats& operator = ( SectionStats && ) = default; -# endif SectionInfo sectionInfo; Counts assertions; @@ -150,12 +146,10 @@ namespace Catch {} virtual ~TestCaseStats(); -# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS TestCaseStats( TestCaseStats const& ) = default; TestCaseStats( TestCaseStats && ) = default; TestCaseStats& operator = ( TestCaseStats const& ) = default; TestCaseStats& operator = ( TestCaseStats && ) = default; -# endif TestCaseInfo testInfo; Totals totals; @@ -178,12 +172,10 @@ namespace Catch {} virtual ~TestGroupStats(); -# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS TestGroupStats( TestGroupStats const& ) = default; TestGroupStats( TestGroupStats && ) = default; TestGroupStats& operator = ( TestGroupStats const& ) = default; TestGroupStats& operator = ( TestGroupStats && ) = default; -# endif GroupInfo groupInfo; Totals totals; @@ -200,18 +192,10 @@ namespace Catch {} 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 && ) = default; TestRunStats& operator = ( TestRunStats const& ) = default; TestRunStats& operator = ( TestRunStats && ) = default; -# endif TestRunInfo runInfo; Totals totals; @@ -248,7 +232,7 @@ namespace Catch virtual void skipTest( TestCaseInfo const& testInfo ) = 0; - virtual MultipleReporters* tryAsMulti() { return CATCH_NULL; } + virtual MultipleReporters* tryAsMulti() { return nullptr; } }; diff --git a/include/internal/catch_matchers.hpp b/include/internal/catch_matchers.hpp index 12f2333e..21445347 100644 --- a/include/internal/catch_matchers.hpp +++ b/include/internal/catch_matchers.hpp @@ -54,14 +54,14 @@ namespace Matchers { template struct MatchAllOf : MatcherBase { - virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { + virtual bool match( ArgT const& arg ) const override { for( auto matcher : m_matchers ) { if (!matcher->match(arg)) return false; } return true; } - virtual std::string describe() const CATCH_OVERRIDE { + virtual std::string describe() const override { std::string description; description.reserve( 4 + m_matchers.size()*32 ); description += "( "; @@ -87,14 +87,14 @@ namespace Matchers { template struct MatchAnyOf : MatcherBase { - virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE { + virtual bool match( ArgT const& arg ) const override { for( auto matcher : m_matchers ) { if (matcher->match(arg)) return true; } return false; } - virtual std::string describe() const CATCH_OVERRIDE { + virtual std::string describe() const override { std::string description; description.reserve( 4 + m_matchers.size()*32 ); description += "( "; @@ -123,11 +123,11 @@ namespace Matchers { MatchNotOf( MatcherBase 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 ); } - virtual std::string describe() const CATCH_OVERRIDE { + virtual std::string describe() const override { return "not " + m_underlyingMatcher.toString(); } MatcherBase const& m_underlyingMatcher; diff --git a/include/internal/catch_matchers_string.h b/include/internal/catch_matchers_string.h index 69dabcb5..e3772cbf 100644 --- a/include/internal/catch_matchers_string.h +++ b/include/internal/catch_matchers_string.h @@ -27,7 +27,7 @@ namespace Matchers { struct StringMatcherBase : MatcherBase { StringMatcherBase( std::string const& operation, CasedString const& comparator ); - virtual std::string describe() const CATCH_OVERRIDE; + virtual std::string describe() const override; CasedString m_comparator; std::string m_operation; @@ -35,19 +35,19 @@ namespace Matchers { struct EqualsMatcher : StringMatcherBase { 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 { 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 { 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 { 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 diff --git a/include/internal/catch_matchers_vector.h b/include/internal/catch_matchers_vector.h index 2889013d..11aee020 100644 --- a/include/internal/catch_matchers_vector.h +++ b/include/internal/catch_matchers_vector.h @@ -20,11 +20,11 @@ namespace Matchers { ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} - bool match(std::vector const &v) const CATCH_OVERRIDE { + bool match(std::vector const &v) const override { 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 ); } @@ -36,7 +36,7 @@ namespace Matchers { ContainsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} - bool match(std::vector const &v) const CATCH_OVERRIDE { + bool match(std::vector const &v) const override { // !TBD: see note in EqualsMatcher if (m_comparator.size() > v.size()) return false; @@ -45,7 +45,7 @@ namespace Matchers { return false; return true; } - virtual std::string describe() const CATCH_OVERRIDE { + virtual std::string describe() const override { return "Contains: " + Catch::toString( m_comparator ); } @@ -57,7 +57,7 @@ namespace Matchers { EqualsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} - bool match(std::vector const &v) const CATCH_OVERRIDE { + bool match(std::vector const &v) const override { // !TBD: This currently works if all elements can be compared using != // - a more general approach would be via a compare template that defaults // to using !=. but could be specialised for, e.g. std::vector etc @@ -69,7 +69,7 @@ namespace Matchers { return false; return true; } - virtual std::string describe() const CATCH_OVERRIDE { + virtual std::string describe() const override { return "Equals: " + Catch::toString( m_comparator ); } std::vector const& m_comparator; diff --git a/include/internal/catch_notimplemented_exception.h b/include/internal/catch_notimplemented_exception.h index 128fff28..30a60cad 100644 --- a/include/internal/catch_notimplemented_exception.h +++ b/include/internal/catch_notimplemented_exception.h @@ -18,9 +18,9 @@ namespace Catch { NotImplementedException( SourceLineInfo const& lineInfo ); NotImplementedException( NotImplementedException const& ) {} - virtual ~NotImplementedException() CATCH_NOEXCEPT {} + virtual ~NotImplementedException() noexcept {} - virtual const char* what() const CATCH_NOEXCEPT; + virtual const char* what() const noexcept; private: std::string m_what; diff --git a/include/internal/catch_notimplemented_exception.hpp b/include/internal/catch_notimplemented_exception.hpp index e4afdc67..f5b1ea66 100644 --- a/include/internal/catch_notimplemented_exception.hpp +++ b/include/internal/catch_notimplemented_exception.hpp @@ -21,7 +21,7 @@ namespace Catch { m_what = oss.str(); } - const char* NotImplementedException::what() const CATCH_NOEXCEPT { + const char* NotImplementedException::what() const noexcept { return m_what.c_str(); } diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp index 616383b1..baded73e 100644 --- a/include/internal/catch_objc.hpp +++ b/include/internal/catch_objc.hpp @@ -72,7 +72,7 @@ namespace Catch { inline size_t registerTestMethods() { 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); objc_getClassList( classes, noClasses ); @@ -112,7 +112,7 @@ namespace Catch { arcSafeRelease( m_substr ); } - virtual bool match( NSString* arg ) const CATCH_OVERRIDE { + virtual bool match( NSString* arg ) const override { return false; } @@ -122,12 +122,12 @@ namespace Catch { struct Equals : StringHolder { 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 ) && [str isEqualToString:m_substr]; } - virtual std::string describe() const CATCH_OVERRIDE { + virtual std::string describe() const override { return "equals string: " + Catch::toString( m_substr ); } }; @@ -140,7 +140,7 @@ namespace Catch { [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 ); } }; @@ -153,7 +153,7 @@ namespace Catch { [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 ); } }; @@ -165,7 +165,7 @@ namespace Catch { [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 ); } }; diff --git a/include/internal/catch_option.hpp b/include/internal/catch_option.hpp index 909e5cec..c9c3c165 100644 --- a/include/internal/catch_option.hpp +++ b/include/internal/catch_option.hpp @@ -16,12 +16,12 @@ namespace Catch { template class Option { public: - Option() : nullableValue( CATCH_NULL ) {} + Option() : nullableValue( nullptr ) {} Option( T const& _value ) : nullableValue( new( storage ) T( _value ) ) {} Option( Option const& _other ) - : nullableValue( _other ? new( storage ) T( *_other ) : CATCH_NULL ) + : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) {} ~Option() { @@ -45,7 +45,7 @@ namespace Catch { void reset() { if( nullableValue ) nullableValue->~T(); - nullableValue = CATCH_NULL; + nullableValue = nullptr; } T& operator*() { return *nullableValue; } @@ -57,10 +57,10 @@ namespace Catch { return nullableValue ? *nullableValue : defaultValue; } - bool some() const { return nullableValue != CATCH_NULL; } - bool none() const { return nullableValue == CATCH_NULL; } + bool some() const { return nullableValue != nullptr; } + bool none() const { return nullableValue == nullptr; } - bool operator !() const { return nullableValue == CATCH_NULL; } + bool operator !() const { return nullableValue == nullptr; } operator SafeBool::type() const { return SafeBool::makeSafe( some() ); } @@ -74,9 +74,7 @@ namespace Catch { long double dummy1; void (*dummy2)(); long double dummy3; -#ifdef CATCH_CONFIG_CPP11_LONG_LONG long long dummy4; -#endif }; }; diff --git a/include/internal/catch_ptr.hpp b/include/internal/catch_ptr.hpp index 940e5d19..5da73aa1 100644 --- a/include/internal/catch_ptr.hpp +++ b/include/internal/catch_ptr.hpp @@ -23,7 +23,7 @@ namespace Catch { template class Ptr { public: - Ptr() : m_p( CATCH_NULL ){} + Ptr() : m_p( nullptr ){} Ptr( T* p ) : m_p( p ){ if( m_p ) m_p->addRef(); @@ -39,7 +39,7 @@ namespace Catch { void reset() { if( m_p ) m_p->release(); - m_p = CATCH_NULL; + m_p = nullptr; } Ptr& operator = ( T* p ){ Ptr temp( p ); @@ -55,8 +55,8 @@ namespace Catch { T* get() const{ return m_p; } T& operator*() const { return *m_p; } T* operator->() const { return m_p; } - bool operator !() const { return m_p == CATCH_NULL; } - operator SafeBool::type() const { return SafeBool::makeSafe( m_p != CATCH_NULL ); } + bool operator !() const { return m_p == nullptr; } + operator SafeBool::type() const { return SafeBool::makeSafe( m_p != nullptr ); } private: T* m_p; diff --git a/include/internal/catch_registry_hub.hpp b/include/internal/catch_registry_hub.hpp index 2523cd9d..b9e42b72 100644 --- a/include/internal/catch_registry_hub.hpp +++ b/include/internal/catch_registry_hub.hpp @@ -27,34 +27,34 @@ namespace Catch { public: // IRegistryHub RegistryHub() { } - virtual IReporterRegistry const& getReporterRegistry() const CATCH_OVERRIDE { + virtual IReporterRegistry const& getReporterRegistry() const override { return m_reporterRegistry; } - virtual ITestCaseRegistry const& getTestCaseRegistry() const CATCH_OVERRIDE { + virtual ITestCaseRegistry const& getTestCaseRegistry() const override { return m_testCaseRegistry; } - virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() CATCH_OVERRIDE { + virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override { return m_exceptionTranslatorRegistry; } - virtual ITagAliasRegistry const& getTagAliasRegistry() const CATCH_OVERRIDE { + virtual ITagAliasRegistry const& getTagAliasRegistry() const override { return m_tagAliasRegistry; } public: // IMutableRegistryHub - virtual void registerReporter( std::string const& name, Ptr const& factory ) CATCH_OVERRIDE { + virtual void registerReporter( std::string const& name, Ptr const& factory ) override { m_reporterRegistry.registerReporter( name, factory ); } - virtual void registerListener( Ptr const& factory ) CATCH_OVERRIDE { + virtual void registerListener( Ptr const& factory ) override { m_reporterRegistry.registerListener( factory ); } - virtual void registerTest( TestCase const& testInfo ) CATCH_OVERRIDE { + virtual void registerTest( TestCase const& testInfo ) override { m_testCaseRegistry.registerTest( testInfo ); } - virtual void registerTranslator( const IExceptionTranslator* translator ) CATCH_OVERRIDE { + virtual void registerTranslator( const IExceptionTranslator* translator ) override { 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 ); } @@ -67,7 +67,7 @@ namespace Catch { // Single, global, instance inline RegistryHub*& getTheRegistryHub() { - static RegistryHub* theRegistryHub = CATCH_NULL; + static RegistryHub* theRegistryHub = nullptr; if( !theRegistryHub ) theRegistryHub = new RegistryHub(); return theRegistryHub; @@ -82,7 +82,7 @@ namespace Catch { } void cleanUp() { delete getTheRegistryHub(); - getTheRegistryHub() = CATCH_NULL; + getTheRegistryHub() = nullptr; cleanUpContext(); } std::string translateActiveException() { diff --git a/include/internal/catch_reporter_registry.hpp b/include/internal/catch_reporter_registry.hpp index 71f23ff7..7a0c783a 100644 --- a/include/internal/catch_reporter_registry.hpp +++ b/include/internal/catch_reporter_registry.hpp @@ -18,12 +18,12 @@ namespace Catch { public: - virtual ~ReporterRegistry() CATCH_OVERRIDE {} + virtual ~ReporterRegistry() override {} - virtual IStreamingReporter* create( std::string const& name, Ptr const& config ) const CATCH_OVERRIDE { + virtual IStreamingReporter* create( std::string const& name, Ptr const& config ) const override { FactoryMap::const_iterator it = m_factories.find( name ); if( it == m_factories.end() ) - return CATCH_NULL; + return nullptr; return it->second->create( ReporterConfig( config ) ); } @@ -34,10 +34,10 @@ namespace Catch { m_listeners.push_back( factory ); } - virtual FactoryMap const& getFactories() const CATCH_OVERRIDE { + virtual FactoryMap const& getFactories() const override { return m_factories; } - virtual Listeners const& getListeners() const CATCH_OVERRIDE { + virtual Listeners const& getListeners() const override { return m_listeners; } diff --git a/include/internal/catch_result_builder.h b/include/internal/catch_result_builder.h index 82494566..a2cf596d 100644 --- a/include/internal/catch_result_builder.h +++ b/include/internal/catch_result_builder.h @@ -56,7 +56,7 @@ namespace Catch { 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( DecomposedExpression const& expr ) const; diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp index e6dbd38c..12435cdc 100644 --- a/include/internal/catch_run_context.hpp +++ b/include/internal/catch_run_context.hpp @@ -62,7 +62,7 @@ namespace Catch { explicit RunContext( Ptr const& _config, Ptr const& reporter ) : m_runInfo( _config->name() ), m_context( getCurrentMutableContext() ), - m_activeTestCase( CATCH_NULL ), + m_activeTestCase( nullptr ), m_config( _config ), m_reporter( reporter ), m_shouldReportUnexpected ( true ) @@ -124,8 +124,8 @@ namespace Catch { redirectedCerr, aborting() ) ); - m_activeTestCase = CATCH_NULL; - m_testCaseTracker = CATCH_NULL; + m_activeTestCase = nullptr; + m_testCaseTracker = nullptr; return deltaTotals; } diff --git a/include/internal/catch_section.h b/include/internal/catch_section.h index d8b3ae42..2667b74e 100644 --- a/include/internal/catch_section.h +++ b/include/internal/catch_section.h @@ -35,12 +35,7 @@ namespace Catch { } // end namespace Catch -#ifdef CATCH_CONFIG_VARIADIC_MACROS #define INTERNAL_CATCH_SECTION( ... ) \ 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 diff --git a/include/internal/catch_section_info.hpp b/include/internal/catch_section_info.hpp index 74fe4c6b..b1ce0ba8 100644 --- a/include/internal/catch_section_info.hpp +++ b/include/internal/catch_section_info.hpp @@ -33,7 +33,7 @@ namespace Catch { RunningSection( std::string const& name ) : m_state( Root ), - m_parent( CATCH_NULL ), + m_parent( nullptr ), m_name( name ) {} diff --git a/include/internal/catch_stream.h b/include/internal/catch_stream.h index d8deebab..73aa9ace 100644 --- a/include/internal/catch_stream.h +++ b/include/internal/catch_stream.h @@ -24,7 +24,7 @@ namespace Catch { struct IStream { - virtual ~IStream() CATCH_NOEXCEPT; + virtual ~IStream() noexcept; virtual std::ostream& stream() const = 0; }; @@ -32,9 +32,9 @@ namespace Catch { mutable std::ofstream m_ofs; public: FileStream( std::string const& filename ); - virtual ~FileStream() CATCH_NOEXCEPT; + virtual ~FileStream() noexcept; 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; public: CoutStream(); - virtual ~CoutStream() CATCH_NOEXCEPT; + virtual ~CoutStream() noexcept; public: // IStream - virtual std::ostream& stream() const CATCH_OVERRIDE; + virtual std::ostream& stream() const override; }; class DebugOutStream : public IStream { - CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf; + std::unique_ptr m_streamBuf; mutable std::ostream m_os; public: DebugOutStream(); - virtual ~DebugOutStream() CATCH_NOEXCEPT; + virtual ~DebugOutStream() noexcept; public: // IStream - virtual std::ostream& stream() const CATCH_OVERRIDE; + virtual std::ostream& stream() const override; }; } diff --git a/include/internal/catch_stream.hpp b/include/internal/catch_stream.hpp index 42f51e82..cc6c38a1 100644 --- a/include/internal/catch_stream.hpp +++ b/include/internal/catch_stream.hpp @@ -28,7 +28,7 @@ namespace Catch { setp( data, data + sizeof(data) ); } - ~StreamBufImpl() CATCH_NOEXCEPT { + ~StreamBufImpl() noexcept { sync(); } diff --git a/include/internal/catch_streambuf.h b/include/internal/catch_streambuf.h index 4f5e238c..dba84357 100644 --- a/include/internal/catch_streambuf.h +++ b/include/internal/catch_streambuf.h @@ -16,7 +16,7 @@ namespace Catch { class StreamBufBase : public std::streambuf { public: - virtual ~StreamBufBase() CATCH_NOEXCEPT; + virtual ~StreamBufBase() noexcept; }; } diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index ca5c9504..5900d6f0 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -26,19 +26,13 @@ namespace Catch { 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 max() { return 1000000; } result_type operator()() const { return std::rand() % max(); } -#endif template static void shuffle( V& vector ) { RandomNumberGenerator rng; -#ifdef CATCH_CONFIG_CPP11_SHUFFLE std::shuffle( vector.begin(), vector.end(), rng ); -#else - std::random_shuffle( vector.begin(), vector.end(), rng ); -#endif } }; diff --git a/include/internal/catch_test_case_tracker.hpp b/include/internal/catch_test_case_tracker.hpp index 705f92ab..6654734f 100644 --- a/include/internal/catch_test_case_tracker.hpp +++ b/include/internal/catch_test_case_tracker.hpp @@ -80,7 +80,7 @@ namespace TestCaseTracking { } TrackerContext() - : m_currentTracker( CATCH_NULL ), + : m_currentTracker( nullptr ), m_runState( NotStarted ) {} @@ -89,7 +89,7 @@ namespace TestCaseTracking { void endRun() { m_rootTracker.reset(); - m_currentTracker = CATCH_NULL; + m_currentTracker = nullptr; m_runState = NotStarted; } @@ -147,39 +147,39 @@ namespace TestCaseTracking { {} virtual ~TrackerBase(); - virtual NameAndLocation const& nameAndLocation() const CATCH_OVERRIDE { + virtual NameAndLocation const& nameAndLocation() const override { return m_nameAndLocation; } - virtual bool isComplete() const CATCH_OVERRIDE { + virtual bool isComplete() const override { return m_runState == CompletedSuccessfully || m_runState == Failed; } - virtual bool isSuccessfullyCompleted() const CATCH_OVERRIDE { + virtual bool isSuccessfullyCompleted() const override { return m_runState == CompletedSuccessfully; } - virtual bool isOpen() const CATCH_OVERRIDE { + virtual bool isOpen() const override { return m_runState != NotStarted && !isComplete(); } - virtual bool hasChildren() const CATCH_OVERRIDE { + virtual bool hasChildren() const override { return !m_children.empty(); } - virtual void addChild( Ptr const& child ) CATCH_OVERRIDE { + virtual void addChild( Ptr const& child ) override { 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 ) ); return( it != m_children.end() ) ? 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 return *m_parent; } - virtual void openChild() CATCH_OVERRIDE { + virtual void openChild() override { if( m_runState != ExecutingChildren ) { m_runState = ExecutingChildren; if( m_parent ) @@ -187,8 +187,8 @@ namespace TestCaseTracking { } } - virtual bool isSectionTracker() const CATCH_OVERRIDE { return false; } - virtual bool isIndexTracker() const CATCH_OVERRIDE { return false; } + virtual bool isSectionTracker() const override { return false; } + virtual bool isIndexTracker() const override { return false; } void open() { m_runState = Executing; @@ -197,7 +197,7 @@ namespace TestCaseTracking { m_parent->openChild(); } - virtual void close() CATCH_OVERRIDE { + virtual void close() override { // Close any still open children (e.g. generators) while( &m_ctx.currentTracker() != this ) @@ -226,14 +226,14 @@ namespace TestCaseTracking { moveToParent(); m_ctx.completeCycle(); } - virtual void fail() CATCH_OVERRIDE { + virtual void fail() override { m_runState = Failed; if( m_parent ) m_parent->markAsNeedingAnotherRun(); moveToParent(); m_ctx.completeCycle(); } - virtual void markAsNeedingAnotherRun() CATCH_OVERRIDE { + virtual void markAsNeedingAnotherRun() override { m_runState = NeedsAnotherRun; } private: @@ -262,10 +262,10 @@ namespace TestCaseTracking { } 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 ) { - SectionTracker* section = CATCH_NULL; + SectionTracker* section = nullptr; ITracker& currentTracker = ctx.currentTracker(); if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { @@ -311,10 +311,10 @@ namespace TestCaseTracking { {} 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 ) { - IndexTracker* tracker = CATCH_NULL; + IndexTracker* tracker = nullptr; ITracker& currentTracker = ctx.currentTracker(); if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { @@ -343,7 +343,7 @@ namespace TestCaseTracking { m_children.clear(); } - virtual void close() CATCH_OVERRIDE { + virtual void close() override { TrackerBase::close(); if( m_runState == CompletedSuccessfully && m_index < m_size-1 ) m_runState = Executing; @@ -351,8 +351,8 @@ namespace TestCaseTracking { }; inline ITracker& TrackerContext::startRun() { - m_rootTracker = new SectionTracker( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, CATCH_NULL ); - m_currentTracker = CATCH_NULL; + m_rootTracker = new SectionTracker( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr ); + m_currentTracker = nullptr; m_runState = Executing; return *m_rootTracker; } diff --git a/include/internal/catch_test_registry.hpp b/include/internal/catch_test_registry.hpp index 075ad1c6..b6d423c8 100644 --- a/include/internal/catch_test_registry.hpp +++ b/include/internal/catch_test_registry.hpp @@ -83,7 +83,6 @@ void registerTestCaseFunction } // end namespace Catch -#ifdef CATCH_CONFIG_VARIADIC_MACROS /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ static void TestName(); \ @@ -120,43 +119,5 @@ void registerTestCaseFunction Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); \ 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 diff --git a/include/internal/catch_timer.hpp b/include/internal/catch_timer.hpp index dfb7811f..d8bcfce9 100644 --- a/include/internal/catch_timer.hpp +++ b/include/internal/catch_timer.hpp @@ -41,7 +41,7 @@ namespace Catch { #else uint64_t getCurrentTicks() { timeval t; - gettimeofday(&t,CATCH_NULL); + gettimeofday(&t,nullptr); return static_cast( t.tv_sec ) * 1000000ull + static_cast( t.tv_usec ); } #endif diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp index ae59627c..b39a2fd7 100644 --- a/include/internal/catch_xmlwriter.hpp +++ b/include/internal/catch_xmlwriter.hpp @@ -89,7 +89,7 @@ namespace Catch { ScopedElement( ScopedElement const& other ) : m_writer( other.m_writer ){ - other.m_writer = CATCH_NULL; + other.m_writer = nullptr; } ~ScopedElement() { diff --git a/include/reporters/catch_reporter_automake.hpp b/include/reporters/catch_reporter_automake.hpp index c267d8a9..00478e1f 100644 --- a/include/reporters/catch_reporter_automake.hpp +++ b/include/reporters/catch_reporter_automake.hpp @@ -27,11 +27,11 @@ namespace Catch { 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. stream << ":test-result: "; if (_testCaseStats.totals.assertions.allPassed()) { @@ -45,7 +45,7 @@ namespace Catch { 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'; } diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp index aca5f355..d94c15b4 100644 --- a/include/reporters/catch_reporter_bases.hpp +++ b/include/reporters/catch_reporter_bases.hpp @@ -50,44 +50,44 @@ namespace Catch { m_reporterPrefs.shouldRedirectStdOut = false; } - virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { + virtual ReporterPreferences getPreferences() const override { 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; } - virtual void testGroupStarting( GroupInfo const& _groupInfo ) CATCH_OVERRIDE { + virtual void testGroupStarting( GroupInfo const& _groupInfo ) override { currentGroupInfo = _groupInfo; } - virtual void testCaseStarting( TestCaseInfo const& _testInfo ) CATCH_OVERRIDE { + virtual void testCaseStarting( TestCaseInfo const& _testInfo ) override { currentTestCaseInfo = _testInfo; } - virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE { + virtual void sectionStarting( SectionInfo const& _sectionInfo ) override { m_sectionStack.push_back( _sectionInfo ); } - virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) CATCH_OVERRIDE { + virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) override { m_sectionStack.pop_back(); } - virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) CATCH_OVERRIDE { + virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) override { currentTestCaseInfo.reset(); } - virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) CATCH_OVERRIDE { + virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) override { currentGroupInfo.reset(); } - virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) CATCH_OVERRIDE { + virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) override { currentTestCaseInfo.reset(); currentGroupInfo.reset(); currentTestRunInfo.reset(); } - virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE { + virtual void skipTest( TestCaseInfo const& ) override { // Don't do anything with this by default. // It can optionally be overridden in the derived class. } @@ -157,16 +157,16 @@ namespace Catch { } ~CumulativeReporterBase(); - virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { + virtual ReporterPreferences getPreferences() const override { return m_reporterPrefs; } - virtual void testRunStarting( TestRunInfo const& ) CATCH_OVERRIDE {} - virtual void testGroupStarting( GroupInfo const& ) CATCH_OVERRIDE {} + virtual void testRunStarting( TestRunInfo const& ) 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 ); Ptr node; if( m_sectionStack.empty() ) { @@ -191,9 +191,9 @@ namespace Catch { 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() ); SectionNode& sectionNode = *m_sectionStack.back(); sectionNode.assertions.push_back( assertionStats ); @@ -205,13 +205,13 @@ namespace Catch { prepareExpandedExpression( sectionNode.assertions.back().assertionResult ); return true; } - virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { + virtual void sectionEnded( SectionStats const& sectionStats ) override { assert( !m_sectionStack.empty() ); SectionNode& node = *m_sectionStack.back(); node.stats = sectionStats; m_sectionStack.pop_back(); } - virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { Ptr node = new TestCaseNode( testCaseStats ); assert( m_sectionStack.size() == 0 ); node->children.push_back( m_rootSection ); @@ -222,12 +222,12 @@ namespace Catch { m_deepestSection->stdOut = testCaseStats.stdOut; m_deepestSection->stdErr = testCaseStats.stdErr; } - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { Ptr node = new TestGroupNode( testGroupStats ); node->children.swap( m_testCases ); m_testGroups.push_back( node ); } - virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { + virtual void testRunEnded( TestRunStats const& testRunStats ) override { Ptr node = new TestRunNode( testRunStats ); node->children.swap( m_testGroups ); m_testRuns.push_back( node ); @@ -235,7 +235,7 @@ namespace Catch { } virtual void testRunEndedCumulative() = 0; - virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE {} + virtual void skipTest( TestCaseInfo const& ) override {} virtual void prepareExpandedExpression( AssertionResult& result ) const { if( result.isOk() ) @@ -276,8 +276,8 @@ namespace Catch { : StreamingReporterBase( _config ) {} - virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {} - virtual bool assertionEnded( AssertionStats const& ) CATCH_OVERRIDE { + virtual void assertionStarting( AssertionInfo const& ) override {} + virtual bool assertionEnded( AssertionStats const& ) override { return false; } }; diff --git a/include/reporters/catch_reporter_compact.hpp b/include/reporters/catch_reporter_compact.hpp index 8d6f9085..3987d37c 100644 --- a/include/reporters/catch_reporter_compact.hpp +++ b/include/reporters/catch_reporter_compact.hpp @@ -58,7 +58,7 @@ namespace Catch { return true; } - virtual void sectionEnded(SectionStats const& _sectionStats) CATCH_OVERRIDE { + virtual void sectionEnded(SectionStats const& _sectionStats) override { if (m_config->showDurations() == ShowDurations::Always) { stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; } diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index 6d64b132..29951fcf 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -25,19 +25,19 @@ namespace Catch { m_headerPrinted( false ) {} - virtual ~ConsoleReporter() CATCH_OVERRIDE; + virtual ~ConsoleReporter() override; static std::string getDescription() { 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; } - 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; bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); @@ -54,11 +54,11 @@ namespace Catch { return true; } - virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE { + virtual void sectionStarting( SectionInfo const& _sectionInfo ) override { m_headerPrinted = false; StreamingReporterBase::sectionStarting( _sectionInfo ); } - virtual void sectionEnded( SectionStats const& _sectionStats ) CATCH_OVERRIDE { + virtual void sectionEnded( SectionStats const& _sectionStats ) override { if( _sectionStats.missingAssertions ) { lazyPrint(); Colour colour( Colour::ResultError ); @@ -77,11 +77,11 @@ namespace Catch { StreamingReporterBase::sectionEnded( _sectionStats ); } - virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) CATCH_OVERRIDE { + virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) override { StreamingReporterBase::testCaseEnded( _testCaseStats ); m_headerPrinted = false; } - virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) CATCH_OVERRIDE { + virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) override { if( currentGroupInfo.used ) { printSummaryDivider(); stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; @@ -90,7 +90,7 @@ namespace Catch { } StreamingReporterBase::testGroupEnded( _testGroupStats ); } - virtual void testRunEnded( TestRunStats const& _testRunStats ) CATCH_OVERRIDE { + virtual void testRunEnded( TestRunStats const& _testRunStats ) override { printTotalsDivider( _testRunStats.totals ); printTotals( _testRunStats.totals ); stream << std::endl; @@ -218,10 +218,10 @@ namespace Catch { void printMessage() const { if( !messageLabel.empty() ) stream << messageLabel << ':' << '\n'; - for( auto const& message : messages ) { + for( auto const& msg : messages ) { // If this assertion is a warning ignore any INFO messages - if( printInfoMessages || message.type != ResultWas::Info ) - stream << Text( message.message, TextAttributes().setIndent(2) ) << '\n'; + if( printInfoMessages || msg.type != ResultWas::Info ) + stream << Text( msg.message, TextAttributes().setIndent(2) ) << '\n'; } } void printSourceInfo() const { diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp index 18e501ee..acc5664c 100644 --- a/include/reporters/catch_reporter_junit.hpp +++ b/include/reporters/catch_reporter_junit.hpp @@ -57,20 +57,20 @@ namespace Catch { m_reporterPrefs.shouldRedirectStdOut = true; } - virtual ~JunitReporter() CATCH_OVERRIDE; + virtual ~JunitReporter() override; static std::string getDescription() { 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 ); xml.startElement( "testsuites" ); } - virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { + virtual void testGroupStarting( GroupInfo const& groupInfo ) override { suiteTimer.start(); stdOutForSuite.str(""); stdErrForSuite.str(""); @@ -78,28 +78,28 @@ namespace Catch { CumulativeReporterBase::testGroupStarting( groupInfo ); } - virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) CATCH_OVERRIDE { + virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) override { 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 ) unexpectedExceptions++; return CumulativeReporterBase::assertionEnded( assertionStats ); } - virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { stdOutForSuite << testCaseStats.stdOut; stdErrForSuite << testCaseStats.stdErr; CumulativeReporterBase::testCaseEnded( testCaseStats ); } - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { double suiteTime = suiteTimer.getElapsedSeconds(); CumulativeReporterBase::testGroupEnded( testGroupStats ); writeGroup( *m_testGroups.back(), suiteTime ); } - virtual void testRunEndedCumulative() CATCH_OVERRIDE { + virtual void testRunEndedCumulative() override { xml.endElement(); } diff --git a/include/reporters/catch_reporter_multi.hpp b/include/reporters/catch_reporter_multi.hpp index 4dcd6ec0..6b460bf0 100644 --- a/include/reporters/catch_reporter_multi.hpp +++ b/include/reporters/catch_reporter_multi.hpp @@ -23,79 +23,79 @@ public: public: // IStreamingReporter - virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE { + virtual ReporterPreferences getPreferences() const override { 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 ) reporter->noMatchingTestCases( spec ); } - virtual void testRunStarting( TestRunInfo const& testRunInfo ) CATCH_OVERRIDE { + virtual void testRunStarting( TestRunInfo const& testRunInfo ) override { for( auto const& reporter : m_reporters ) reporter->testRunStarting( testRunInfo ); } - virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE { + virtual void testGroupStarting( GroupInfo const& groupInfo ) override { for( auto const& reporter : m_reporters ) reporter->testGroupStarting( groupInfo ); } - virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { + virtual void testCaseStarting( TestCaseInfo const& testInfo ) override { for( auto const& reporter : m_reporters ) reporter->testCaseStarting( testInfo ); } - virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { + virtual void sectionStarting( SectionInfo const& sectionInfo ) override { for( auto const& reporter : m_reporters ) reporter->sectionStarting( sectionInfo ); } - virtual void assertionStarting( AssertionInfo const& assertionInfo ) CATCH_OVERRIDE { + virtual void assertionStarting( AssertionInfo const& assertionInfo ) override { for( auto const& reporter : m_reporters ) reporter->assertionStarting( assertionInfo ); } // 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; for( auto const& reporter : m_reporters ) clearBuffer |= reporter->assertionEnded( assertionStats ); return clearBuffer; } - virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { + virtual void sectionEnded( SectionStats const& sectionStats ) override { for( auto const& reporter : m_reporters ) reporter->sectionEnded( sectionStats ); } - virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { for( auto const& reporter : m_reporters ) reporter->testCaseEnded( testCaseStats ); } - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { for( auto const& reporter : m_reporters ) reporter->testGroupEnded( testGroupStats ); } - virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { + virtual void testRunEnded( TestRunStats const& testRunStats ) override { for( auto const& reporter : m_reporters ) reporter->testRunEnded( testRunStats ); } - virtual void skipTest( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { + virtual void skipTest( TestCaseInfo const& testInfo ) override { for( auto const& reporter : m_reporters ) reporter->skipTest( testInfo ); } - virtual MultipleReporters* tryAsMulti() CATCH_OVERRIDE { + virtual MultipleReporters* tryAsMulti() override { return this; } diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp index 248ea3fb..6f52615a 100644 --- a/include/reporters/catch_reporter_teamcity.hpp +++ b/include/reporters/catch_reporter_teamcity.hpp @@ -43,33 +43,33 @@ namespace Catch { replaceInPlace( escaped, "]", "|]" ); return escaped; } - virtual ~TeamCityReporter() CATCH_OVERRIDE; + virtual ~TeamCityReporter() override; static std::string getDescription() { 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 ); stream << "##teamcity[testSuiteStarted name='" << escape( groupInfo.name ) << "']\n"; } - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { StreamingReporterBase::testGroupEnded( testGroupStats ); stream << "##teamcity[testSuiteFinished name='" << 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; if( !result.isOk() ) { @@ -140,18 +140,18 @@ namespace Catch { return true; } - virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { + virtual void sectionStarting( SectionInfo const& sectionInfo ) override { m_headerPrintedForThisSection = false; StreamingReporterBase::sectionStarting( sectionInfo ); } - virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { + virtual void testCaseStarting( TestCaseInfo const& testInfo ) override { StreamingReporterBase::testCaseStarting( testInfo ); stream << "##teamcity[testStarted name='" << escape( testInfo.name ) << "']\n"; } - virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE { + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override { StreamingReporterBase::testCaseEnded( testCaseStats ); if( !testCaseStats.stdOut.empty() ) stream << "##teamcity[testStdOut name='" diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 546c1095..cf26834f 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -26,7 +26,7 @@ namespace Catch { m_reporterPrefs.shouldRedirectStdOut = true; } - virtual ~XmlReporter() CATCH_OVERRIDE; + virtual ~XmlReporter() override; static std::string getDescription() { return "Reports test results as an XML document"; @@ -44,11 +44,11 @@ namespace Catch { public: // StreamingReporterBase - virtual void noMatchingTestCases( std::string const& s ) CATCH_OVERRIDE { + virtual void noMatchingTestCases( std::string const& s ) override { StreamingReporterBase::noMatchingTestCases( s ); } - virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE { + virtual void testRunStarting( TestRunInfo const& testInfo ) override { StreamingReporterBase::testRunStarting( testInfo ); std::string stylesheetRef = getStylesheetRef(); if( !stylesheetRef.empty() ) @@ -58,13 +58,13 @@ namespace Catch { 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 ); m_xml.startElement( "Group" ) .writeAttribute( "name", groupInfo.name ); } - virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE { + virtual void testCaseStarting( TestCaseInfo const& testInfo ) override { StreamingReporterBase::testCaseStarting(testInfo); m_xml.startElement( "TestCase" ) .writeAttribute( "name", trim( testInfo.name ) ) @@ -78,7 +78,7 @@ namespace Catch { m_xml.ensureTagClosed(); } - virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE { + virtual void sectionStarting( SectionInfo const& sectionInfo ) override { StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { 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; @@ -166,7 +166,7 @@ namespace Catch { return true; } - virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE { + virtual void sectionEnded( SectionStats const& sectionStats ) override { StreamingReporterBase::sectionEnded( sectionStats ); if( --m_sectionDepth > 0 ) { 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 ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); @@ -197,7 +197,7 @@ namespace Catch { m_xml.endElement(); } - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE { + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) override { StreamingReporterBase::testGroupEnded( testGroupStats ); // TODO: Check testGroupStats.aborting and act accordingly. m_xml.scopedElement( "OverallResults" ) @@ -207,7 +207,7 @@ namespace Catch { m_xml.endElement(); } - virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE { + virtual void testRunEnded( TestRunStats const& testRunStats ) override { StreamingReporterBase::testRunEnded( testRunStats ); m_xml.scopedElement( "OverallResults" ) .writeAttribute( "successes", testRunStats.totals.assertions.passed ) diff --git a/projects/SelfTest/ApproxTests.cpp b/projects/SelfTest/ApproxTests.cpp index 14a8234e..e4bc6ecd 100644 --- a/projects/SelfTest/ApproxTests.cpp +++ b/projects/SelfTest/ApproxTests.cpp @@ -153,7 +153,6 @@ TEST_CASE( "Absolute margin", "[Approx]" ) { //////////////////////////////////////////////////////////////////////////////// -#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) class StrongDoubleTypedef { double d_ = 0.0; @@ -192,6 +191,5 @@ TEST_CASE REQUIRE(Approx(11.0) >= td); } -#endif //////////////////////////////////////////////////////////////////////////////// diff --git a/projects/SelfTest/CmdLineTests.cpp b/projects/SelfTest/CmdLineTests.cpp index 83b79fde..ec14cb8b 100644 --- a/projects/SelfTest/CmdLineTests.cpp +++ b/projects/SelfTest/CmdLineTests.cpp @@ -13,7 +13,7 @@ # pragma clang diagnostic ignored "-Wc++98-compat" #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", "" ) { diff --git a/projects/SelfTest/ConditionTests.cpp b/projects/SelfTest/ConditionTests.cpp index 2eb99ba3..ec56b799 100644 --- a/projects/SelfTest/ConditionTests.cpp +++ b/projects/SelfTest/ConditionTests.cpp @@ -257,32 +257,32 @@ TEST_CASE( "Comparisons between ints where one side is computed", "" ) #pragma GCC diagnostic pop #endif -inline const char* returnsConstNull(){ return CATCH_NULL; } -inline char* returnsNull(){ return CATCH_NULL; } +inline const char* returnsConstNull(){ return nullptr; } +inline char* returnsNull(){ return nullptr; } TEST_CASE( "Pointers can be compared to null", "" ) { - TestData* p = CATCH_NULL; - TestData* pNULL = CATCH_NULL; + TestData* p = nullptr; + TestData* pNULL = nullptr; - REQUIRE( p == CATCH_NULL ); + REQUIRE( p == nullptr ); REQUIRE( p == pNULL ); TestData data; p = &data; - REQUIRE( p != CATCH_NULL ); + REQUIRE( p != nullptr ); const TestData* cp = p; - REQUIRE( cp != CATCH_NULL ); + REQUIRE( cp != nullptr ); const TestData* const cpc = p; - REQUIRE( cpc != CATCH_NULL ); + REQUIRE( cpc != nullptr ); - REQUIRE( returnsNull() == CATCH_NULL ); - REQUIRE( returnsConstNull() == CATCH_NULL ); + REQUIRE( returnsNull() == nullptr ); + REQUIRE( returnsConstNull() == nullptr ); - REQUIRE( CATCH_NULL != p ); + REQUIRE( nullptr != p ); } // Not (!) tests diff --git a/projects/SelfTest/ExceptionTests.cpp b/projects/SelfTest/ExceptionTests.cpp index 8ba5cb54..c9754d4a 100644 --- a/projects/SelfTest/ExceptionTests.cpp +++ b/projects/SelfTest/ExceptionTests.cpp @@ -120,7 +120,7 @@ public: CustomStdException( const std::string& msg ) : m_msg( msg ) {} - ~CustomStdException() CATCH_NOEXCEPT {} + ~CustomStdException() noexcept {} std::string getMessage() const { diff --git a/projects/SelfTest/MessageTests.cpp b/projects/SelfTest/MessageTests.cpp index bed9c137..1c944a3d 100644 --- a/projects/SelfTest/MessageTests.cpp +++ b/projects/SelfTest/MessageTests.cpp @@ -62,7 +62,6 @@ TEST_CASE( "FAIL_CHECK does not abort the test", "[failing][messages][.]" ) WARN( "This message appears in the output"); } -#ifdef CATCH_CONFIG_VARIADIC_MACROS TEST_CASE( "FAIL does not require an argument", "[failing][messages][.]" ) { FAIL(); @@ -71,7 +70,6 @@ TEST_CASE( "SUCCESS does not require an argument", "[messages][.]" ) { SUCCEED(); } -#endif TEST_CASE( "Output from all sections is reported", "[failing][messages][.]" ) { diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 02099a71..aab0295f 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -131,13 +131,13 @@ TEST_CASE( "Sends stuff to stdout and stderr", "[.]" ) inline const char* makeString( bool makeNull ) { - return makeNull ? CATCH_NULL : "valid string"; + return makeNull ? nullptr : "valid string"; } TEST_CASE( "null strings", "" ) { - REQUIRE( makeString( false ) != static_cast(CATCH_NULL)); - REQUIRE( makeString( true ) == static_cast(CATCH_NULL)); + REQUIRE( makeString( false ) != static_cast(nullptr)); + REQUIRE( makeString( true ) == static_cast(nullptr)); } @@ -372,13 +372,11 @@ TEST_CASE( "XmlEncode" ) { } } -#ifdef CATCH_CONFIG_CPP11_LONG_LONG TEST_CASE( "long long", "[c++11][.]" ) { long long l = std::numeric_limits::max(); REQUIRE( l == std::numeric_limits::max() ); } -#endif //TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) { // int i = 0; diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index e03a9e44..8005a2eb 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -43,7 +43,7 @@ std::string parseIntoConfigAndReturnError( const char * (&argv)[size], Catch::Co 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]" ) { diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index 26625b03..ae1e5844 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -236,7 +236,7 @@ struct Obj TEST_CASE("boolean member", "[Tricky]") { Obj obj; - REQUIRE( obj.prop != CATCH_NULL ); + REQUIRE( obj.prop != nullptr ); } // Tests for a problem submitted by Ralph McArdell diff --git a/projects/SelfTest/VariadicMacrosTests.cpp b/projects/SelfTest/VariadicMacrosTests.cpp index b784076d..fd651c5e 100644 --- a/projects/SelfTest/VariadicMacrosTests.cpp +++ b/projects/SelfTest/VariadicMacrosTests.cpp @@ -8,7 +8,6 @@ #include "catch.hpp" -#ifdef CATCH_CONFIG_VARIADIC_MACROS TEST_CASE() { @@ -28,4 +27,3 @@ TEST_CASE( "Variadic macros", "[variadic][sections]" ) } } -#endif