Change some names to protect the ... reserved

This commit is contained in:
Phil Nash 2010-11-10 07:42:15 +00:00
parent d80260001b
commit 3455e55538
7 changed files with 30 additions and 30 deletions

View File

@ -120,7 +120,7 @@ TEST_CASE( "succeeding/conditions/ordered", "Ordering comparison checks that sho
CHECK( data.str_hello >= "hello" ); CHECK( data.str_hello >= "hello" );
CHECK( data.str_hello < "hellp" ); CHECK( data.str_hello < "hellp" );
CHECK( data.str_hello < "z" ); CHECK( data.str_hello < "zebra" );
CHECK( data.str_hello > "hellm" ); CHECK( data.str_hello > "hellm" );
CHECK( data.str_hello > "a" ); CHECK( data.str_hello > "a" );
} }

View File

@ -32,33 +32,33 @@
////// //////
#define EXPECT( pred ) _CATCH_TEST( pred, false, true, "EXPECT" ) #define EXPECT( expr ) INTERNAL_CATCH_TEST( expr, false, true, "EXPECT" )
#define EXPECT_NOT( pred ) _CATCH_TEST( pred, true, true, "EXPECT_NOT" ) #define EXPECT_NOT( expr ) INTERNAL_CATCH_TEST( expr, true, true, "EXPECT_NOT" )
#define EXPECT_THROWS( expr ) _CATCH_THROWS( expr, ..., false, true, "EXPECT_THROWS" ) #define EXPECT_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., false, true, "EXPECT_THROWS" )
#define EXPECT_THROWS_AS( expr, exceptionType ) _CATCH_THROWS_AS( expr, exceptionType, false, true, "EXPECT_THROWS_AS" ) #define EXPECT_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, false, true, "EXPECT_THROWS_AS" )
#define CHECK( pred ) _CATCH_TEST( pred, false, false, "CHECK" ) #define CHECK( expr ) INTERNAL_CATCH_TEST( expr, false, false, "CHECK" )
#define CHECK_NOT( pred ) _CATCH_TEST( pred, true, false, "CHECK_NOT" ) #define CHECK_NOT( expr ) INTERNAL_CATCH_TEST( expr, true, false, "CHECK_NOT" )
#define CHECK_THROWS( expr ) _CATCH_THROWS( expr, ..., false. false, "CHECK_THROWS" ) #define CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., false. false, "CHECK_THROWS" )
#define CHECK_THROWS_AS( expr, exceptionType ) _CATCH_THROWS_AS( expr, exceptionType, false, false, "CHECK_THROWS_AS" ) #define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, false, false, "CHECK_THROWS_AS" )
#define CHECK_NOTHROW( expr ) _CATCH_THROWS_AS( expr, Catch::DummyExceptionType_DontUse, true, false, "CHECK_NOTHROW" ) #define CHECK_NOTHROW( expr ) INTERNAL_CATCH_THROWS_AS( expr, Catch::DummyExceptionType_DontUse, true, false, "CHECK_NOTHROW" )
#define INFO( reason ) _CATCH_MSG( reason, Catch::ResultWas::Info, false, "INFO" ) #define INFO( reason ) INTERNAL_CATCH_MSG( reason, Catch::ResultWas::Info, false, "INFO" )
#define WARN( reason ) _CATCH_MSG( reason, Catch::ResultWas::Warning, false, "WARN" ) #define WARN( reason ) INTERNAL_CATCH_MSG( reason, Catch::ResultWas::Warning, false, "WARN" )
#define FAIL( reason ) _CATCH_MSG( reason, Catch::ResultWas::ExplicitFailure, true, "FAIL" ) #define FAIL( reason ) INTERNAL_CATCH_MSG( reason, Catch::ResultWas::ExplicitFailure, true, "FAIL" )
#define SECTION( name, description ) CATCH_SECTION( name, description ) #define SECTION( name, description ) CATCH_SECTION( name, description )
#define TEST_CASE( name, description ) CATCH_TEST_CASE( name, description ) #define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
#define METHOD_AS_TEST_CASE( method, name, description ) CATCH_METHOD_AS_TEST_CASE( method, name, description ) #define METHOD_AS_TEST_CASE( method, name, description ) CATCH_METHOD_AS_TEST_CASE( method, name, description )
#define REGISTER_REPORTER( name, reporterType ) CATCH_REGISTER_REPORTER( name, reporterType ) #define REGISTER_REPORTER( name, reporterType ) CATCH_REGISTER_REPORTER( name, reporterType )
/////////////// ///////////////
// Still to be implemented // Still to be implemented
#define CHECK_NOFAIL( pred ) // !TBD - reports violation, but doesn't fail Test #define CHECK_NOFAIL( expr ) // !TBD - reports violation, but doesn't fail Test
using Catch::Approx; using Catch::Approx;

View File

@ -247,11 +247,11 @@ inline std::string toString<Approx>( const Approx& value )
} // end namespace Catch } // end namespace Catch
#define _CATCH_TEST( expr, isNot, stopOnFailure, macroName ) \ #define INTERNAL_CATCH_TEST( expr, isNot, stopOnFailure, macroName ) \
Catch::ResultsCapture::acceptExpression( Catch::ResultBuilder( #expr, isNot, __FILE__, __LINE__, macroName )->*expr ); \ Catch::ResultsCapture::acceptExpression( Catch::ResultBuilder( #expr, isNot, __FILE__, __LINE__, macroName )->*expr ); \
Catch::ResultsCapture::acceptResult( expr, stopOnFailure ); Catch::ResultsCapture::acceptResult( expr, stopOnFailure );
#define _CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \ #define INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
Catch::ResultsCapture::acceptExpression( Catch::ResultBuilder( #expr, false, __FILE__, __LINE__, macroName ) ); \ Catch::ResultsCapture::acceptExpression( Catch::ResultBuilder( #expr, false, __FILE__, __LINE__, macroName ) ); \
try \ try \
{ \ { \
@ -263,14 +263,14 @@ inline std::string toString<Approx>( const Approx& value )
Catch::ResultsCapture::acceptResult( !(nothrow), stopOnFailure ); \ Catch::ResultsCapture::acceptResult( !(nothrow), stopOnFailure ); \
} }
#define _CATCH_THROWS_AS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \ #define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \ INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
catch( ... ) \ catch( ... ) \
{ \ { \
Catch::ResultsCapture::acceptResult( false, stopOnFailure ); \ Catch::ResultsCapture::acceptResult( false, stopOnFailure ); \
} }
#define _CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \ #define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \
Catch::ResultsCapture::acceptExpression( Catch::MutableResultInfo( "", false, __FILE__, __LINE__, macroName ) ); \ Catch::ResultsCapture::acceptExpression( Catch::MutableResultInfo( "", false, __FILE__, __LINE__, macroName ) ); \
Catch::ResultsCapture::acceptMessage( reason ); \ Catch::ResultsCapture::acceptMessage( reason ); \
Catch::ResultsCapture::acceptResult( resultType, stopOnFailure ); Catch::ResultsCapture::acceptResult( resultType, stopOnFailure );

View File

@ -13,8 +13,8 @@
#ifndef TWOBLUECUBES_CATCH_COMMON_H_INCLUDED #ifndef TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
#define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED #define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
#define _CATCH_UNIQUE_NAME_LINE2( name, line ) name##line #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
#define _CATCH_UNIQUE_NAME_LINE( name, line ) _CATCH_UNIQUE_NAME_LINE2( name, line ) #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
#define _CATCH_UNIQUE_NAME( name ) _CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) #define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED #endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED

View File

@ -105,12 +105,12 @@ struct AutoReg
} // end namespace Catch } // end namespace Catch
#define CATCH_TEST_CASE( Name, Desc ) \ #define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
static void _CATCH_UNIQUE_NAME( __catchTestFunction )(); \ static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )(); \
namespace{ Catch::AutoReg _CATCH_UNIQUE_NAME( autoRegistrar )( &_CATCH_UNIQUE_NAME( __catchTestFunction ), Name, Desc ); }\ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction ), Name, Desc ); }\
static void _CATCH_UNIQUE_NAME( __catchTestFunction )() static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )()
#define CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \ #define CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
namespace{ Catch::AutoReg _CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, Name, Desc ); } namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, Name, Desc ); }
#endif // TWOBLUECUBES_CATCH_REGISTRY_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_REGISTRY_HPP_INCLUDED

View File

@ -161,6 +161,6 @@ namespace Catch
}; };
} }
#define CATCH_REGISTER_REPORTER( name, reporterType ) Catch::ReporterRegistrar<reporterType> _CATCH_UNIQUE_NAME( __catchReporterReg )( name ); #define CATCH_REGISTER_REPORTER( name, reporterType ) Catch::ReporterRegistrar<reporterType> INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ReporterReg )( name );
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED

View File

@ -34,6 +34,6 @@ namespace Catch
} // end namespace Catch } // end namespace Catch
#define CATCH_SECTION( name, desc ) if( Catch::Section __catchSection = Catch::Section( name, desc ) ) #define CATCH_SECTION( name, desc ) if( Catch::Section catch_internal_Section = Catch::Section( name, desc ) )
#endif // TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED