summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/catch.hpp294
1 files changed, 125 insertions, 169 deletions
diff --git a/src/catch.hpp b/src/catch.hpp
index 391c7ab4a..de61226cf 100644
--- a/src/catch.hpp
+++ b/src/catch.hpp
@@ -1,6 +1,6 @@
/*
- * CATCH v1.1 build 3 (master branch)
- * Generated: 2015-05-21 06:16:00.388118
+ * Catch v1.2.1
+ * Generated: 2015-06-30 18:23:27.961086
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -87,19 +87,23 @@
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
-// CATCH_CONFIG_SFINAE : is basic (C++03) SFINAE supported?
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
-// A lot of this code is based on Boost (1.53)
+// In general each macro has a _NO_<feature name> form
+// (e.g. CATCH_CONFIG_CPP11_NO_NULLPTR) 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 __clang__
# if __has_feature(cxx_nullptr)
-# define CATCH_CONFIG_CPP11_NULLPTR
+# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif
# if __has_feature(cxx_noexcept)
-# define CATCH_CONFIG_CPP11_NOEXCEPT
+# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# endif
#endif // __clang__
@@ -108,51 +112,26 @@
// 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
-
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) )
-
-#define CATCH_CONFIG_CPP11_NULLPTR
+# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
#endif
#endif // __GNUC__
@@ -161,17 +140,13 @@
// Visual C++
#ifdef _MSC_VER
-#if (_MSC_VER >= 1310 ) // (VC++ 7.0+)
-//#define CATCH_CONFIG_SFINAE // Not confirmed
-#endif
-
#if (_MSC_VER >= 1600)
-#define CATCH_CONFIG_CPP11_NULLPTR
+# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
#endif
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
-#define CATCH_CONFIG_CPP11_NOEXCEPT
-#define CATCH_CONFIG_CPP11_GENERATED_METHODS
+#define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
+#define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
#endif
#endif // _MSC_VER
@@ -182,9 +157,7 @@
( defined __GNUC__ && __GNUC__ >= 3 ) || \
( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
-#ifndef CATCH_CONFIG_NO_VARIADIC_MACROS
-#define CATCH_CONFIG_VARIADIC_MACROS
-#endif
+#define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
#endif
@@ -196,36 +169,52 @@
# define CATCH_CPP11_OR_GREATER
-# ifndef CATCH_CONFIG_CPP11_NULLPTR
-# define CATCH_CONFIG_CPP11_NULLPTR
+# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
+# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif
-# ifndef CATCH_CONFIG_CPP11_NOEXCEPT
-# define CATCH_CONFIG_CPP11_NOEXCEPT
+# ifndef CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
+# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
# endif
-# ifndef CATCH_CONFIG_CPP11_GENERATED_METHODS
-# define CATCH_CONFIG_CPP11_GENERATED_METHODS
+# ifndef CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
+# define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
# endif
-# ifndef CATCH_CONFIG_CPP11_IS_ENUM
-# define CATCH_CONFIG_CPP11_IS_ENUM
+# ifndef CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
+# define CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
# endif
-# ifndef CATCH_CONFIG_CPP11_TUPLE
-# define CATCH_CONFIG_CPP11_TUPLE
+# ifndef CATCH_INTERNAL_CONFIG_CPP11_TUPLE
+# define CATCH_INTERNAL_CONFIG_CPP11_TUPLE
# endif
-# ifndef CATCH_CONFIG_SFINAE
-//# define CATCH_CONFIG_SFINAE // Don't use, for now
-# endif
-
-# ifndef CATCH_CONFIG_VARIADIC_MACROS
-# define CATCH_CONFIG_VARIADIC_MACROS
+# ifndef CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
+# define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
# 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
+
// noexcept support:
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
# define CATCH_NOEXCEPT noexcept
@@ -798,8 +787,8 @@ namespace Catch {
ResultDisposition::Flags resultDisposition );
template<typename T>
- ExpressionLhs<T const&> operator->* ( T const& operand );
- ExpressionLhs<bool> operator->* ( bool value );
+ ExpressionLhs<T const&> operator <= ( T const& operand );
+ ExpressionLhs<bool> operator <= ( bool value );
template<typename T>
ResultBuilder& operator << ( T const& value ) {
@@ -1022,40 +1011,6 @@ namespace Internal {
// #included from: catch_tostring.h
#define TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
-// #included from: catch_sfinae.hpp
-#define TWOBLUECUBES_CATCH_SFINAE_HPP_INCLUDED
-
-// Try to detect if the current compiler supports SFINAE
-
-namespace Catch {
-
- struct TrueType {
- static const bool value = true;
- typedef void Enable;
- char sizer[1];
- };
- struct FalseType {
- static const bool value = false;
- typedef void Disable;
- char sizer[2];
- };
-
-#ifdef CATCH_CONFIG_SFINAE
-
- template<bool> struct NotABooleanExpression;
-
- template<bool c> struct If : NotABooleanExpression<c> {};
- template<> struct If<true> : TrueType {};
- template<> struct If<false> : FalseType {};
-
- template<int size> struct SizedIf;
- template<> struct SizedIf<sizeof(TrueType)> : TrueType {};
- template<> struct SizedIf<sizeof(FalseType)> : FalseType {};
-
-#endif // CATCH_CONFIG_SFINAE
-
-} // end namespace Catch
-
#include <sstream>
#include <iomanip>
#include <limits>
@@ -1154,32 +1109,13 @@ namespace Detail {
extern std::string unprintableString;
-// SFINAE is currently disabled by default for all compilers.
-// If the non SFINAE version of IsStreamInsertable is ambiguous for you
-// and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE
-#ifdef CATCH_CONFIG_SFINAE
-
- template<typename T>
- class IsStreamInsertableHelper {
- template<int N> struct TrueIfSizeable : TrueType {};
-
- template<typename T2>
- static TrueIfSizeable<sizeof((*(std::ostream*)0) << *((T2 const*)0))> dummy(T2*);
- static FalseType dummy(...);
-
- public:
- typedef SizedIf<sizeof(dummy((T*)0))> type;
- };
-
- template<typename T>
- struct IsStreamInsertable : IsStreamInsertableHelper<T>::type {};
-
-#else
-
struct BorgType {
template<typename T> BorgType( T const& );
};
+ struct TrueType { char sizer[1]; };
+ struct FalseType { char sizer[2]; };
+
TrueType& testStreamable( std::ostream& );
FalseType testStreamable( FalseType );
@@ -1192,8 +1128,6 @@ namespace Detail {
enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
};
-#endif
-
#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
template<typename T,
bool IsEnum = std::is_enum<T>::value
@@ -1461,11 +1395,11 @@ private:
namespace Catch {
template<typename T>
- inline ExpressionLhs<T const&> ResultBuilder::operator->* ( T const& operand ) {
+ inline ExpressionLhs<T const&> ResultBuilder::operator <= ( T const& operand ) {
return ExpressionLhs<T const&>( *this, operand );
}
- inline ExpressionLhs<bool> ResultBuilder::operator->* ( bool value ) {
+ inline ExpressionLhs<bool> ResultBuilder::operator <= ( bool value ) {
return ExpressionLhs<bool>( *this, value );
}
@@ -1637,7 +1571,7 @@ namespace Catch {
do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
try { \
- ( __catchResult->*expr ).endExpression(); \
+ ( __catchResult <= expr ).endExpression(); \
} \
catch( ... ) { \
__catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
@@ -5016,32 +4950,15 @@ namespace SectionTracking {
RunState runState() const { return m_runState; }
- TrackedSection* findChild( std::string const& childName ) {
- TrackedSections::iterator it = m_children.find( childName );
- return it != m_children.end()
- ? &it->second
- : NULL;
- }
- TrackedSection* acquireChild( std::string const& childName ) {
- if( TrackedSection* child = findChild( childName ) )
- return child;
- m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
- return findChild( childName );
- }
+ TrackedSection* findChild( std::string const& childName );
+ TrackedSection* acquireChild( std::string const& childName );
+
void enter() {
if( m_runState == NotStarted )
m_runState = Executing;
}
- void leave() {
- for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
- it != itEnd;
- ++it )
- if( it->second.runState() != Completed ) {
- m_runState = ExecutingChildren;
- return;
- }
- m_runState = Completed;
- }
+ void leave();
+
TrackedSection* getParent() {
return m_parent;
}
@@ -5054,9 +4971,31 @@ namespace SectionTracking {
RunState m_runState;
TrackedSections m_children;
TrackedSection* m_parent;
-
};
+ inline TrackedSection* TrackedSection::findChild( std::string const& childName ) {
+ TrackedSections::iterator it = m_children.find( childName );
+ return it != m_children.end()
+ ? &it->second
+ : NULL;
+ }
+ inline TrackedSection* TrackedSection::acquireChild( std::string const& childName ) {
+ if( TrackedSection* child = findChild( childName ) )
+ return child;
+ m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
+ return findChild( childName );
+ }
+ inline void TrackedSection::leave() {
+ for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
+ it != itEnd;
+ ++it )
+ if( it->second.runState() != Completed ) {
+ m_runState = ExecutingChildren;
+ return;
+ }
+ m_runState = Completed;
+ }
+
class TestCaseTracker {
public:
TestCaseTracker( std::string const& testCaseName )
@@ -5539,18 +5478,19 @@ namespace Catch {
struct Version {
Version( unsigned int _majorVersion,
unsigned int _minorVersion,
- unsigned int _buildNumber,
- char const* const _branchName )
- : majorVersion( _majorVersion ),
- minorVersion( _minorVersion ),
- buildNumber( _buildNumber ),
- branchName( _branchName )
- {}
+ unsigned int _patchNumber,
+ std::string const& _branchName,
+ unsigned int _buildNumber );
unsigned int const majorVersion;
unsigned int const minorVersion;
+ unsigned int const patchNumber;
+
+ // buildNumber is only used if branchName is not null
+ std::string const branchName;
unsigned int const buildNumber;
- char const* const branchName;
+
+ friend std::ostream& operator << ( std::ostream& os, Version const& version );
private:
void operator=( Version const& );
@@ -5670,12 +5610,7 @@ namespace Catch {
}
void showHelp( std::string const& processName ) {
- Catch::cout() << "\nCatch v" << libraryVersion.majorVersion << "."
- << libraryVersion.minorVersion << " build "
- << libraryVersion.buildNumber;
- if( libraryVersion.branchName != std::string( "master" ) )
- Catch::cout() << " (" << libraryVersion.branchName << " branch)";
- Catch::cout() << "\n";
+ Catch::cout() << "\nCatch v" << libraryVersion << "\n";
m_cli.usage( Catch::cout(), processName );
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
@@ -5692,9 +5627,10 @@ namespace Catch {
catch( std::exception& ex ) {
{
Colour colourGuard( Colour::Red );
- Catch::cerr() << "\nError(s) in input:\n"
- << Text( ex.what(), TextAttributes().setIndent(2) )
- << "\n\n";
+ Catch::cerr()
+ << "\nError(s) in input:\n"
+ << Text( ex.what(), TextAttributes().setIndent(2) )
+ << "\n\n";
}
m_cli.usage( Catch::cout(), m_configData.processName );
return (std::numeric_limits<int>::max)();
@@ -6806,8 +6742,33 @@ namespace Catch {
namespace Catch {
- // These numbers are maintained by a script
- Version libraryVersion( 1, 1, 3, "master" );
+ Version::Version
+ ( unsigned int _majorVersion,
+ unsigned int _minorVersion,
+ unsigned int _patchNumber,
+ std::string const& _branchName,
+ unsigned int _buildNumber )
+ : majorVersion( _majorVersion ),
+ minorVersion( _minorVersion ),
+ patchNumber( _patchNumber ),
+ branchName( _branchName ),
+ buildNumber( _buildNumber )
+ {}
+
+ std::ostream& operator << ( std::ostream& os, Version const& version ) {
+ os << version.majorVersion << "."
+ << version.minorVersion << "."
+ << version.patchNumber;
+
+ if( !version.branchName.empty() ) {
+ os << "-" << version.branchName
+ << "." << version.buildNumber;
+ }
+ return os;
+ }
+
+ Version libraryVersion( 1, 2, 1, "", 0 );
+
}
// #included from: catch_message.hpp
@@ -8733,12 +8694,7 @@ namespace Catch {
stream << "\n" << getLineOfChars<'~'>() << "\n";
Colour colour( Colour::SecondaryText );
stream << currentTestRunInfo->name
- << " is a Catch v" << libraryVersion.majorVersion << "."
- << libraryVersion.minorVersion << " b"
- << libraryVersion.buildNumber;
- if( libraryVersion.branchName != std::string( "master" ) )
- stream << " (" << libraryVersion.branchName << ")";
- stream << " host application.\n"
+ << " is a Catch v" << libraryVersion << " host application.\n"
<< "Run with -? for options\n\n";
if( m_config->rngSeed() != 0 )