- incorporation of pull request #154 to allow comparison with nullptr_t
- some compiler capability tweaks
This commit is contained in:
Phil Nash 2013-04-22 18:55:12 +01:00
parent 4dd3f68dd9
commit 471eba2c32
8 changed files with 157 additions and 111 deletions

View File

@ -1,6 +1,6 @@
![catch logo](https://raw.github.com/philsquared/Catch/Integration/catch-logo-small.png) ![catch logo](https://raw.github.com/philsquared/Catch/Integration/catch-logo-small.png)
## CATCH v0.9 build 35 (integration branch) ## CATCH v0.9 build 36 (integration branch)
An automated test framework for C, C++ and Objective-C. An automated test framework for C, C++ and Objective-C.
This branch may contain code that is experimental or not yet fully tested. This branch may contain code that is experimental or not yet fully tested.

View File

@ -33,6 +33,14 @@ namespace Internal {
template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } }; template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } };
template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } }; template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } };
template<typename T>
inline T& opCast(const T& t) { return const_cast<T&>(t); }
// nullptr_t support based on pull request #154 from Konstantin Baumann
#ifdef CATCH_CONFIG_CPP11_NULLPTR
inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
#endif // CATCH_CONFIG_CPP11_NULLPTR
// So the compare overloads can be operator agnostic we convey the operator as a template // So the compare overloads can be operator agnostic we convey the operator as a template
// enum, which is used to specialise an Evaluator for doing the comparison. // enum, which is used to specialise an Evaluator for doing the comparison.
@ -42,37 +50,37 @@ namespace Internal {
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsEqualTo> { struct Evaluator<T1, T2, IsEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs) { static bool evaluate( const T1& lhs, const T2& rhs) {
return const_cast<T1&>( lhs ) == const_cast<T2&>( rhs ); return opCast( lhs ) == opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsNotEqualTo> { struct Evaluator<T1, T2, IsNotEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) != const_cast<T2&>( rhs ); return opCast( lhs ) != opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThan> { struct Evaluator<T1, T2, IsLessThan> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) < const_cast<T2&>( rhs ); return opCast( lhs ) < opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThan> { struct Evaluator<T1, T2, IsGreaterThan> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) > const_cast<T2&>( rhs ); return opCast( lhs ) > opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> { struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) >= const_cast<T2&>( rhs ); return opCast( lhs ) >= opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThanOrEqualTo> { struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) <= const_cast<T2&>( rhs ); return opCast( lhs ) <= opCast( rhs );
} }
}; };
@ -150,6 +158,16 @@ namespace Internal {
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) ); return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
} }
#ifdef CATCH_CONFIG_CPP11_NULLPTR
// pointer to nullptr_t (when comparing against nullptr)
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
return Evaluator<T*, T*, Op>::evaluate( NULL, rhs );
}
template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
return Evaluator<T*, T*, Op>::evaluate( lhs, NULL );
}
#endif // CATCH_CONFIG_CPP11_NULLPTR
} // end of namespace Internal } // end of namespace Internal
} // end of namespace Catch } // end of namespace Catch

View File

@ -189,7 +189,6 @@ namespace Catch
bool aborting; bool aborting;
}; };
// !Work In progress
struct IStreamingReporter : IShared { struct IStreamingReporter : IShared {
virtual ~IStreamingReporter(); virtual ~IStreamingReporter();

View File

@ -13,7 +13,7 @@
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 0, 9, 35, "integration" ); Version libraryVersion( 0, 9, 36, "integration" );
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -1,6 +1,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CatchSelfTest is a CATCH v0.9 b35 (integration) host application. CatchSelfTest is a CATCH v0.9 b36 (integration) host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -5278,10 +5278,10 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Anonymous test case 1 Anonymous test case 1
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
VariadicMacrosTests.cpp:12 VariadicMacrosTests.cpp:11
............................................................................... ...............................................................................
VariadicMacrosTests.cpp:14: VariadicMacrosTests.cpp:13:
PASSED: PASSED:
with message: with message:
anonymous test case anonymous test case
@ -5289,10 +5289,10 @@ with message:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Test case with one argument Test case with one argument
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
VariadicMacrosTests.cpp:17 VariadicMacrosTests.cpp:16
............................................................................... ...............................................................................
VariadicMacrosTests.cpp:19: VariadicMacrosTests.cpp:18:
PASSED: PASSED:
with message: with message:
no assertions no assertions
@ -5301,10 +5301,10 @@ with message:
Variadic macros Variadic macros
Section with one argument Section with one argument
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
VariadicMacrosTests.cpp:24 VariadicMacrosTests.cpp:23
............................................................................... ...............................................................................
VariadicMacrosTests.cpp:26: VariadicMacrosTests.cpp:25:
PASSED: PASSED:
with message: with message:
no assertions no assertions
@ -5535,7 +5535,7 @@ with message:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CatchSelfTest is a CATCH v0.9 b35 (integration) host application. CatchSelfTest is a CATCH v0.9 b36 (integration) host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -14009,18 +14009,18 @@ TrickyTests.cpp:349: s == "7" succeeded for: "7" == "7"
[Finished: 'non streamable - with conv. op' All tests passed (1 assertion in 1 test case)] [Finished: 'non streamable - with conv. op' All tests passed (1 assertion in 1 test case)]
[Running: Anonymous test case 1] [Running: Anonymous test case 1]
VariadicMacrosTests.cpp:14: succeeded VariadicMacrosTests.cpp:13: succeeded
[with message: anonymous test case] [with message: anonymous test case]
[Finished: 'Anonymous test case 1' All tests passed (1 assertion in 1 test case)] [Finished: 'Anonymous test case 1' All tests passed (1 assertion in 1 test case)]
[Running: Test case with one argument] [Running: Test case with one argument]
VariadicMacrosTests.cpp:19: succeeded VariadicMacrosTests.cpp:18: succeeded
[with message: no assertions] [with message: no assertions]
[Finished: 'Test case with one argument' All tests passed (1 assertion in 1 test case)] [Finished: 'Test case with one argument' All tests passed (1 assertion in 1 test case)]
[Running: Variadic macros] [Running: Variadic macros]
[Started section: 'Section with one argument'] [Started section: 'Section with one argument']
VariadicMacrosTests.cpp:26: succeeded VariadicMacrosTests.cpp:25: succeeded
[with message: no assertions] [with message: no assertions]
[End of section: 'Section with one argument' 1 assertion passed] [End of section: 'Section with one argument' 1 assertion passed]

View File

@ -348,3 +348,15 @@ TEST_CASE( "non streamable - with conv. op", "" )
std::string s = Catch::toString( awkward ); std::string s = Catch::toString( awkward );
REQUIRE( s == "7" ); REQUIRE( s == "7" );
} }
#ifdef CATCH_CONFIG_CPP11_NULLPTR
#include <memory>
TEST_CASE( "null_ptr", "" )
{
std::unique_ptr<int> ptr;
REQUIRE(ptr.get() == nullptr);
}
#endif

View File

@ -503,8 +503,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)"; ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default"; CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CXX0X_EXTENSIONS = YES; CLANG_WARN_CXX0X_EXTENSIONS = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@ -522,7 +522,7 @@
GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_VERSION = ""; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
@ -551,8 +551,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)"; ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "compiler-default"; CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CXX0X_EXTENSIONS = YES; CLANG_WARN_CXX0X_EXTENSIONS = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@ -564,7 +564,7 @@
GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_VERSION = ""; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES;

View File

@ -1,6 +1,6 @@
/* /*
* CATCH v0.9 build 35 (integration branch) * CATCH v0.9 build 36 (integration branch)
* Generated: 2013-04-20 23:19:15.811241 * Generated: 2013-04-22 18:53:02.845247
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -21,14 +21,6 @@
#pragma clang diagnostic ignored "-Wpadded" #pragma clang diagnostic ignored "-Wpadded"
#endif #endif
// 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_CONFIG_VARIADIC_MACROS
#endif
// #included from: internal/catch_notimplemented_exception.h // #included from: internal/catch_notimplemented_exception.h
#define TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_H_INCLUDED #define TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_H_INCLUDED
@ -372,6 +364,77 @@ namespace Catch {
}; };
} }
// #included from: internal/catch_compiler_capabilities.h
#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
// Much of the following code is based on Boost (1.53)
////////////////////////////////////////////////////////////////////////////////
// Borland
#ifdef __BORLANDC__
#if (__BORLANDC__ > 0x582 )
//#define CATCH_CONFIG_SFINAE // Not confirmed
#endif
#endif // __BORLANDC__
////////////////////////////////////////////////////////////////////////////////
// EDG
#ifdef __EDG_VERSION__
#if (__EDG_VERSION__ > 238 )
//#define CATCH_CONFIG_SFINAE // Not confirmed
#endif
#endif // __EDG_VERSION__
////////////////////////////////////////////////////////////////////////////////
// Digital Mars
#ifdef __DMC__
#if (__DMC__ > 0x840 )
//#define CATCH_CONFIG_SFINAE // Not confirmed
#endif
#endif // __DMC__
////////////////////////////////////////////////////////////////////////////////
// GCC
#ifdef __GNUC__
#if __GNUC__ < 3
#if (__GNUC_MINOR__ >= 96 )
#define CATCH_CONFIG_SFINAE
#endif
#elif __GNUC__ >= 3
// #define CATCH_CONFIG_SFINAE // Taking this out completely for now
#endif // __GNUC__ < 3
#endif // __GNUC__
////////////////////////////////////////////////////////////////////////////////
// Visual C++
#ifdef _MSC_VER
#if (_MSC_VER >= 1310 ) // (VC++ 7.0+)
//#define CATCH_CONFIG_SFINAE // Not confirmed
#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_CONFIG_VARIADIC_MACROS
#endif
namespace Catch { namespace Catch {
template<typename C> template<typename C>
@ -508,69 +571,6 @@ private:
#define TWOBLUECUBES_CATCH_SFINAE_HPP_INCLUDED #define TWOBLUECUBES_CATCH_SFINAE_HPP_INCLUDED
// Try to detect if the current compiler supports SFINAE // Try to detect if the current compiler supports SFINAE
// #included from: catch_compiler_capabilities.h
#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
// Much of the following code is based on Boost (1.53)
////////////////////////////////////////////////////////////////////////////////
// Borland
#ifdef __BORLANDC__
#if (__BORLANDC__ > 0x582 )
//#define CATCH_SFINAE // Not confirmed
#endif
#endif // __BORLANDC__
////////////////////////////////////////////////////////////////////////////////
// EDG
#ifdef __EDG_VERSION__
#if (__EDG_VERSION__ > 238 )
//#define CATCH_SFINAE // Not confirmed
#endif
#endif // __EDG_VERSION__
////////////////////////////////////////////////////////////////////////////////
// Digital Mars
#ifdef __DMC__
#if (__DMC__ > 0x840 )
//#define CATCH_SFINAE // Not confirmed
#endif
#endif // __DMC__
////////////////////////////////////////////////////////////////////////////////
// GCC
#ifdef __GNUC__
#if __GNUC__ < 3
#if (__GNUC_MINOR__ >= 96 )
#define CATCH_SFINAE
#endif
#elif __GNUC__ >= 3
// #define CATCH_SFINAE // Taking this out completely for now
#endif // __GNUC__ < 3
#endif // __GNUC__
////////////////////////////////////////////////////////////////////////////////
// Visual C++
#ifdef _MSC_VER
#if (_MSC_VER >= 1310 ) // (VC++ 7.0+)
//#define CATCH_SFINAE // Not confirmed
#endif
#endif // _MSC_VER
namespace Catch { namespace Catch {
@ -585,7 +585,7 @@ namespace Catch {
char sizer[2]; char sizer[2];
}; };
#ifdef CATCH_SFINAE #ifdef CATCH_CONFIG_SFINAE
template<bool> struct NotABooleanExpression; template<bool> struct NotABooleanExpression;
@ -597,7 +597,7 @@ namespace Catch {
template<> struct SizedIf<sizeof(TrueType)> : TrueType {}; template<> struct SizedIf<sizeof(TrueType)> : TrueType {};
template<> struct SizedIf<sizeof(FalseType)> : FalseType {}; template<> struct SizedIf<sizeof(FalseType)> : FalseType {};
#endif // CATCH_SFINAE #endif // CATCH_CONFIG_SFINAE
} // end namespace Catch } // end namespace Catch
@ -656,8 +656,8 @@ namespace Detail {
// SFINAE is currently disabled by default for all compilers. // SFINAE is currently disabled by default for all compilers.
// If the non SFINAE version of IsStreamInsertable is ambiguous for you // If the non SFINAE version of IsStreamInsertable is ambiguous for you
// and your compiler supports SFINAE, try #defining CATCH_SFINAE // and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE
#ifdef CATCH_SFINAE #ifdef CATCH_CONFIG_SFINAE
template<typename T> template<typename T>
class IsStreamInsertableHelper { class IsStreamInsertableHelper {
@ -993,6 +993,14 @@ namespace Internal {
template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } }; template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } };
template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } }; template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } };
template<typename T>
inline T& opCast(const T& t) { return const_cast<T&>(t); }
// nullptr_t support based on pull request #154 from Konstantin Baumann
#ifdef CATCH_CONFIG_CPP11_NULLPTR
inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
#endif // CATCH_CONFIG_CPP11_NULLPTR
// So the compare overloads can be operator agnostic we convey the operator as a template // So the compare overloads can be operator agnostic we convey the operator as a template
// enum, which is used to specialise an Evaluator for doing the comparison. // enum, which is used to specialise an Evaluator for doing the comparison.
template<typename T1, typename T2, Operator Op> template<typename T1, typename T2, Operator Op>
@ -1001,37 +1009,37 @@ namespace Internal {
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsEqualTo> { struct Evaluator<T1, T2, IsEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs) { static bool evaluate( const T1& lhs, const T2& rhs) {
return const_cast<T1&>( lhs ) == const_cast<T2&>( rhs ); return opCast( lhs ) == opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsNotEqualTo> { struct Evaluator<T1, T2, IsNotEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) != const_cast<T2&>( rhs ); return opCast( lhs ) != opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThan> { struct Evaluator<T1, T2, IsLessThan> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) < const_cast<T2&>( rhs ); return opCast( lhs ) < opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThan> { struct Evaluator<T1, T2, IsGreaterThan> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) > const_cast<T2&>( rhs ); return opCast( lhs ) > opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> { struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) >= const_cast<T2&>( rhs ); return opCast( lhs ) >= opCast( rhs );
} }
}; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct Evaluator<T1, T2, IsLessThanOrEqualTo> { struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
static bool evaluate( const T1& lhs, const T2& rhs ) { static bool evaluate( const T1& lhs, const T2& rhs ) {
return const_cast<T1&>( lhs ) <= const_cast<T2&>( rhs ); return opCast( lhs ) <= opCast( rhs );
} }
}; };
@ -1109,6 +1117,16 @@ namespace Internal {
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) ); return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
} }
#ifdef CATCH_CONFIG_CPP11_NULLPTR
// pointer to nullptr_t (when comparing against nullptr)
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
return Evaluator<T*, T*, Op>::evaluate( NULL, rhs );
}
template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
return Evaluator<T*, T*, Op>::evaluate( lhs, NULL );
}
#endif // CATCH_CONFIG_CPP11_NULLPTR
} // end of namespace Internal } // end of namespace Internal
} // end of namespace Catch } // end of namespace Catch
@ -2420,7 +2438,6 @@ namespace Catch
bool aborting; bool aborting;
}; };
// !Work In progress
struct IStreamingReporter : IShared { struct IStreamingReporter : IShared {
virtual ~IStreamingReporter(); virtual ~IStreamingReporter();
@ -6155,7 +6172,7 @@ namespace Catch {
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 0, 9, 35, "integration" ); Version libraryVersion( 0, 9, 36, "integration" );
} }
// #included from: catch_text.hpp // #included from: catch_text.hpp