Browse Source

Catch updated to v2.1.2.

main
offa 6 years ago
parent
commit
88d2ceb4b3
1 changed files with 88 additions and 41 deletions
  1. +88
    -41
      test/catch/catch.hpp

+ 88
- 41
test/catch/catch.hpp View File

/* /*
* Catch v2.1.1
* Generated: 2018-01-26 16:04:07.190063
* Catch v2.1.2
* Generated: 2018-02-09 17:05:21.506253
* ---------------------------------------------------------- * ----------------------------------------------------------
* 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) 2018 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved.
// start catch.hpp // start catch.hpp




#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 1
#define CATCH_VERSION_PATCH 2

#ifdef __clang__ #ifdef __clang__
# pragma clang system_header # pragma clang system_header
#elif defined __GNUC__ #elif defined __GNUC__
# define CATCH_CPP14_OR_GREATER # define CATCH_CPP14_OR_GREATER
# endif # endif


# if __cplusplus >= 201703L
# define CATCH_CPP17_OR_GREATER
# endif

#endif

#if defined(CATCH_CPP17_OR_GREATER)
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
#endif #endif


#ifdef __clang__ #ifdef __clang__
// Visual C++ // Visual C++
#ifdef _MSC_VER #ifdef _MSC_VER


# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
# endif

// Universal Windows platform does not support SEH // Universal Windows platform does not support SEH
// Or console colours (or console at all...) // Or console colours (or console at all...)
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
# define CATCH_CONFIG_POSIX_SIGNALS # define CATCH_CONFIG_POSIX_SIGNALS
#endif #endif


#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_INTERNAL_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
#endif

#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
template<typename T> template<typename T>
typename std::enable_if<!std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& ) { typename std::enable_if<!std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& ) {
return Detail::unprintableString; return Detail::unprintableString;
};
}
template<typename T> template<typename T>
typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) { typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {
return convertUnknownEnumToString( value ); return convertUnknownEnumToString( value );
};
}


} // namespace Detail } // namespace Detail


} }


template<typename R> template<typename R>
struct StringMaker<R, typename std::enable_if<is_range<R>::value && !std::is_array<R>::value>::type> {
struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> {
static std::string convert( R const& range ) { static std::string convert( R const& range ) {
return rangeToString( range ); return rangeToString( range );
} }


// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
template<typename LhsT, typename RhsT> template<typename LhsT, typename RhsT>
auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); };
auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); }
template<typename T> template<typename T>
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); } auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
template<typename T> template<typename T>
auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; } auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }


template<typename LhsT, typename RhsT> template<typename LhsT, typename RhsT>
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); };
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); }
template<typename T> template<typename T>
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); } auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
template<typename T> template<typename T>
BrightGreen = Bright | Green, BrightGreen = Bright | Green,
LightGrey = Bright | Grey, LightGrey = Bright | Grey,
BrightWhite = Bright | White, BrightWhite = Bright | White,
BrightYellow = Bright | Yellow,


// By intention // By intention
FileName = LightGrey, FileName = LightGrey,
Warning = Yellow,
Warning = BrightYellow,
ResultError = BrightRed, ResultError = BrightRed,
ResultSuccess = BrightGreen, ResultSuccess = BrightGreen,
ResultExpectedFailure = Warning, ResultExpectedFailure = Warning,
Success = Green, Success = Green,


OriginalExpression = Cyan, OriginalExpression = Cyan,
ReconstructedExpression = Yellow,
ReconstructedExpression = BrightYellow,


SecondaryText = LightGrey, SecondaryText = LightGrey,
Headers = White Headers = White
#ifdef CATCH_TRAP #ifdef CATCH_TRAP
#define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }
#else #else
#define CATCH_BREAK_INTO_DEBUGGER() (void)0, 0
namespace Catch {
inline void doNothing() {}
}
#define CATCH_BREAK_INTO_DEBUGGER() Catch::doNothing()
#endif #endif


// end catch_debugger.h // end catch_debugger.h
// //
// See https://github.com/philsquared/Clara for more details // See https://github.com/philsquared/Clara for more details


// Clara v1.1.1
// Clara v1.1.2




#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH #ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH
struct BoundRef : NonCopyable { struct BoundRef : NonCopyable {
virtual ~BoundRef() = default; virtual ~BoundRef() = default;
virtual auto isContainer() const -> bool { return false; } virtual auto isContainer() const -> bool { return false; }
virtual auto isFlag() const -> bool { return false; }
}; };
struct BoundValueRefBase : BoundRef { struct BoundValueRefBase : BoundRef {
virtual auto setValue( std::string const &arg ) -> ParserResult = 0; virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
}; };
struct BoundFlagRefBase : BoundRef { struct BoundFlagRefBase : BoundRef {
virtual auto setFlag( bool flag ) -> ParserResult = 0; virtual auto setFlag( bool flag ) -> ParserResult = 0;
virtual auto isFlag() const -> bool { return true; }
}; };


template<typename T> template<typename T>
if( token.type != TokenType::Argument ) if( token.type != TokenType::Argument )
return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );


assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
assert( !m_ref->isFlag() );
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() ); auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );


auto result = valueRef->setValue( remainingTokens->token ); auto result = valueRef->setValue( remainingTokens->token );
if( remainingTokens && remainingTokens->type == TokenType::Option ) { if( remainingTokens && remainingTokens->type == TokenType::Option ) {
auto const &token = *remainingTokens; auto const &token = *remainingTokens;
if( isMatch(token.token ) ) { if( isMatch(token.token ) ) {
if( auto flagRef = dynamic_cast<detail::BoundFlagRefBase*>( m_ref.get() ) ) {
if( m_ref->isFlag() ) {
auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );
auto result = flagRef->setFlag( true ); auto result = flagRef->setFlag( true );
if( !result ) if( !result )
return InternalParseResult( result ); return InternalParseResult( result );
if( result.value() == ParseResultType::ShortCircuitAll ) if( result.value() == ParseResultType::ShortCircuitAll )
return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
} else { } else {
assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() ); auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
++remainingTokens; ++remainingTokens;
if( !remainingTokens ) if( !remainingTokens )
case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED ); case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );
case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN ); case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );
case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN );


case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );

default:
CATCH_ERROR( "Unknown colour requested" );
} }
} }


case Colour::BrightRed: return setColour( "[1;31m" ); case Colour::BrightRed: return setColour( "[1;31m" );
case Colour::BrightGreen: return setColour( "[1;32m" ); case Colour::BrightGreen: return setColour( "[1;32m" );
case Colour::BrightWhite: return setColour( "[1;37m" ); case Colour::BrightWhite: return setColour( "[1;37m" );
case Colour::BrightYellow: return setColour( "[1;33m" );


case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
default: CATCH_INTERNAL_ERROR( "Unknown colour requested" );
} }
} }
static IColourImpl* instance() { static IColourImpl* instance() {
# pragma GCC diagnostic ignored "-Wmissing-field-initializers" # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif #endif


#if (defined(CATCH_PLATFORM_WINDOWS) && defined(CATCH_CONFIG_WINDOWS_SEH)) || defined(CATCH_CONFIG_POSIX_SIGNALS)
namespace { namespace {
// Report the error condition // Report the error condition
void reportFatal( char const * const message ) { void reportFatal( char const * const message ) {
Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
} }
} }
#endif


#if defined ( CATCH_PLATFORM_WINDOWS ) ///////////////////////////////////////// #if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////


// end catch_matchers_string.cpp // end catch_matchers_string.cpp
// start catch_message.cpp // start catch_message.cpp


// start catch_uncaught_exceptions.h

namespace Catch {
bool uncaught_exceptions();
} // end namespace Catch

// end catch_uncaught_exceptions.h
namespace Catch { namespace Catch {


MessageInfo::MessageInfo( std::string const& _macroName, MessageInfo::MessageInfo( std::string const& _macroName,
getResultCapture().pushScopedMessage( m_info ); getResultCapture().pushScopedMessage( m_info );
} }


#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17
#endif
ScopedMessage::~ScopedMessage() { ScopedMessage::~ScopedMessage() {
if ( !std::uncaught_exception() ){
if ( !uncaught_exceptions() ){
getResultCapture().popScopedMessage(m_info); getResultCapture().popScopedMessage(m_info);
} }
} }
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

} // end namespace Catch } // end namespace Catch
// end catch_message.cpp // end catch_message.cpp
// start catch_random_number_generator.cpp // start catch_random_number_generator.cpp
handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction );
} }
} }
Counts assertions = m_totals.assertions - prevAssertions;
bool missingAssertions = testForMissingAssertions(assertions);

m_testCaseTracker->close(); m_testCaseTracker->close();
handleUnfinishedSections(); handleUnfinishedSections();
m_messages.clear(); m_messages.clear();


Counts assertions = m_totals.assertions - prevAssertions;
bool missingAssertions = testForMissingAssertions(assertions);
SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions);
m_reporter->sectionEnded(testCaseSectionStats); m_reporter->sectionEnded(testCaseSectionStats);
} }
m_timer.start(); m_timer.start();
} }


#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17
#endif
Section::~Section() { Section::~Section() {
if( m_sectionIncluded ) { if( m_sectionIncluded ) {
SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() ); SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
if( std::uncaught_exception() )
if( uncaught_exceptions() )
getResultCapture().sectionEndedEarly( endInfo ); getResultCapture().sectionEndedEarly( endInfo );
else else
getResultCapture().sectionEnded( endInfo ); getResultCapture().sectionEnded( endInfo );
} }
} }
#if defined(_MSC_VER)
#pragma warning(pop)
#endif


// This indicates whether the section should be executed or not // This indicates whether the section should be executed or not
Section::operator bool() const { Section::operator bool() const {


#include <ostream> #include <ostream>
#include <cstring> #include <cstring>
#include <cstdint>

namespace {
const uint32_t byte_2_lead = 0xC0;
const uint32_t byte_3_lead = 0xE0;
const uint32_t byte_4_lead = 0xF0;
}


namespace Catch { namespace Catch {
StringRef::StringRef( char const* rawChars ) noexcept StringRef::StringRef( char const* rawChars ) noexcept
// Make adjustments for uft encodings // Make adjustments for uft encodings
for( size_type i=0; i < m_size; ++i ) { for( size_type i=0; i < m_size; ++i ) {
char c = m_start[i]; char c = m_start[i];
if( ( c & 0b11000000 ) == 0b11000000 ) {
if( ( c & 0b11100000 ) == 0b11000000 )
if( ( c & byte_2_lead ) == byte_2_lead ) {
noChars--;
if (( c & byte_3_lead ) == byte_3_lead )
noChars--;
if( ( c & byte_4_lead ) == byte_4_lead )
noChars--; noChars--;
else if( ( c & 0b11110000 ) == 0b11100000 )
noChars-=2;
else if( ( c & 0b11111000 ) == 0b11110000 )
noChars-=3;
} }
} }
return noChars; return noChars;


} }
// end catch_totals.cpp // end catch_totals.cpp
// start catch_uncaught_exceptions.cpp

#include <exception>

namespace Catch {
bool uncaught_exceptions() {
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
return std::uncaught_exceptions() > 0;
#else
return std::uncaught_exception();
#endif
}
} // end namespace Catch
// end catch_uncaught_exceptions.cpp
// start catch_version.cpp // start catch_version.cpp


#include <ostream> #include <ostream>
} }


Version const& libraryVersion() { Version const& libraryVersion() {
static Version version( 2, 1, 1, "", 0 );
static Version version( 2, 1, 2, "", 0 );
return version; return version;
} }


m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
} }


JunitReporter::~JunitReporter() {};
JunitReporter::~JunitReporter() {}


std::string JunitReporter::getDescription() { std::string JunitReporter::getDescription() {
return "Reports test results in an XML format that looks like Ant's junitreport target"; return "Reports test results in an XML format that looks like Ant's junitreport target";

Loading…
Cancel
Save