Merge branch 'develop' into feature/release_information

This commit is contained in:
Niels Lohmann 2017-01-12 21:30:08 +01:00
commit 98ad3c3ac1

101
test/thirdparty/catch/catch.hpp vendored Executable file → Normal file
View file

@ -1,6 +1,6 @@
/* /*
* Catch v1.5.9 * Catch v1.6.0
* Generated: 2016-11-29 12:14:38.049276 * Generated: 2017-01-11 16:38:09.405017
* ---------------------------------------------------------- * ----------------------------------------------------------
* 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.
@ -60,21 +60,6 @@
// #included from: catch_common.h // #included from: catch_common.h
#define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED #define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
#ifdef CATCH_CONFIG_COUNTER
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
#else
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
#endif
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
#include <sstream>
#include <stdexcept>
#include <algorithm>
// #included from: catch_compiler_capabilities.h // #included from: catch_compiler_capabilities.h
#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED #define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
@ -181,6 +166,7 @@
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015)) #if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
#define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT #define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
#define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS #define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
#define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
#endif #endif
#endif // _MSC_VER #endif // _MSC_VER
@ -246,6 +232,9 @@
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) # if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR)
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR # define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
# endif # endif
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE)
# define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
# endif
#endif // __cplusplus >= 201103L #endif // __cplusplus >= 201103L
@ -268,18 +257,21 @@
#if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS) #if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS)
# define CATCH_CONFIG_VARIADIC_MACROS # define CATCH_CONFIG_VARIADIC_MACROS
#endif #endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_CPP11) #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 # define CATCH_CONFIG_CPP11_LONG_LONG
#endif #endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11) #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 # define CATCH_CONFIG_CPP11_OVERRIDE
#endif #endif
#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11) #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 # define CATCH_CONFIG_CPP11_UNIQUE_PTR
#endif #endif
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
# define CATCH_CONFIG_COUNTER # define CATCH_CONFIG_COUNTER
#endif #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_SUPPRESS_PARENTHESES_WARNINGS) #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
@ -315,6 +307,21 @@
# define CATCH_AUTO_PTR( T ) std::auto_ptr<T> # define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
#endif #endif
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
#ifdef CATCH_CONFIG_COUNTER
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
#else
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
#endif
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
#include <sstream>
#include <stdexcept>
#include <algorithm>
namespace Catch { namespace Catch {
struct IConfig; struct IConfig;
@ -2668,6 +2675,26 @@ namespace Detail {
return !operator==( rhs, lhs ); return !operator==( rhs, lhs );
} }
friend bool operator <= ( double lhs, Approx const& rhs )
{
return lhs < rhs.m_value || lhs == rhs;
}
friend bool operator <= ( Approx const& lhs, double rhs )
{
return lhs.m_value < rhs || lhs == rhs;
}
friend bool operator >= ( double lhs, Approx const& rhs )
{
return lhs > rhs.m_value || lhs == rhs;
}
friend bool operator >= ( Approx const& lhs, double rhs )
{
return lhs.m_value > rhs || lhs == rhs;
}
Approx& epsilon( double newEpsilon ) { Approx& epsilon( double newEpsilon ) {
m_epsilon = newEpsilon; m_epsilon = newEpsilon;
return *this; return *this;
@ -3257,11 +3284,12 @@ namespace Catch {
namespace Catch { namespace Catch {
class TestSpecParser { class TestSpecParser {
enum Mode{ None, Name, QuotedName, Tag }; enum Mode{ None, Name, QuotedName, Tag, EscapedName };
Mode m_mode; Mode m_mode;
bool m_exclusion; bool m_exclusion;
std::size_t m_start, m_pos; std::size_t m_start, m_pos;
std::string m_arg; std::string m_arg;
std::vector<std::size_t> m_escapeChars;
TestSpec::Filter m_currentFilter; TestSpec::Filter m_currentFilter;
TestSpec m_testSpec; TestSpec m_testSpec;
ITagAliasRegistry const* m_tagAliases; ITagAliasRegistry const* m_tagAliases;
@ -3274,6 +3302,7 @@ namespace Catch {
m_exclusion = false; m_exclusion = false;
m_start = std::string::npos; m_start = std::string::npos;
m_arg = m_tagAliases->expandAliases( arg ); m_arg = m_tagAliases->expandAliases( arg );
m_escapeChars.clear();
for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
visitChar( m_arg[m_pos] ); visitChar( m_arg[m_pos] );
if( m_mode == Name ) if( m_mode == Name )
@ -3292,6 +3321,7 @@ namespace Catch {
case '~': m_exclusion = true; return; case '~': m_exclusion = true; return;
case '[': return startNewMode( Tag, ++m_pos ); case '[': return startNewMode( Tag, ++m_pos );
case '"': return startNewMode( QuotedName, ++m_pos ); case '"': return startNewMode( QuotedName, ++m_pos );
case '\\': return escape();
default: startNewMode( Name, m_pos ); break; default: startNewMode( Name, m_pos ); break;
} }
} }
@ -3307,7 +3337,11 @@ namespace Catch {
addPattern<TestSpec::NamePattern>(); addPattern<TestSpec::NamePattern>();
startNewMode( Tag, ++m_pos ); startNewMode( Tag, ++m_pos );
} }
else if( c == '\\' )
escape();
} }
else if( m_mode == EscapedName )
m_mode = Name;
else if( m_mode == QuotedName && c == '"' ) else if( m_mode == QuotedName && c == '"' )
addPattern<TestSpec::NamePattern>(); addPattern<TestSpec::NamePattern>();
else if( m_mode == Tag && c == ']' ) else if( m_mode == Tag && c == ']' )
@ -3317,10 +3351,17 @@ namespace Catch {
m_mode = mode; m_mode = mode;
m_start = start; m_start = start;
} }
void escape() {
m_mode = EscapedName;
m_escapeChars.push_back( m_pos );
}
std::string subString() const { return m_arg.substr( m_start, m_pos - m_start ); } std::string subString() const { return m_arg.substr( m_start, m_pos - m_start ); }
template<typename T> template<typename T>
void addPattern() { void addPattern() {
std::string token = subString(); std::string token = subString();
for( size_t i = 0; i < m_escapeChars.size(); ++i )
token = token.substr( 0, m_escapeChars[i] ) + token.substr( m_escapeChars[i]+1 );
m_escapeChars.clear();
if( startsWith( token, "exclude:" ) ) { if( startsWith( token, "exclude:" ) ) {
m_exclusion = true; m_exclusion = true;
token = token.substr( 8 ); token = token.substr( 8 );
@ -6458,10 +6499,6 @@ namespace Catch {
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#ifdef CATCH_CPP14_OR_GREATER
#include <random>
#endif
namespace Catch { namespace Catch {
struct RandomNumberGenerator { struct RandomNumberGenerator {
@ -6469,7 +6506,7 @@ namespace Catch {
result_type operator()( result_type n ) const { return std::rand() % n; } result_type operator()( result_type n ) const { return std::rand() % n; }
#ifdef CATCH_CPP14_OR_GREATER #ifdef CATCH_CONFIG_CPP11_SHUFFLE
static constexpr result_type min() { return 0; } static constexpr result_type min() { return 0; }
static constexpr result_type max() { return 1000000; } static constexpr result_type max() { return 1000000; }
result_type operator()() const { return std::rand() % max(); } result_type operator()() const { return std::rand() % max(); }
@ -6477,7 +6514,7 @@ namespace Catch {
template<typename V> template<typename V>
static void shuffle( V& vector ) { static void shuffle( V& vector ) {
RandomNumberGenerator rng; RandomNumberGenerator rng;
#ifdef CATCH_CPP14_OR_GREATER #ifdef CATCH_CONFIG_CPP11_SHUFFLE
std::shuffle( vector.begin(), vector.end(), rng ); std::shuffle( vector.begin(), vector.end(), rng );
#else #else
std::random_shuffle( vector.begin(), vector.end(), rng ); std::random_shuffle( vector.begin(), vector.end(), rng );
@ -7147,7 +7184,7 @@ namespace {
case Colour::White: return setColour( "[0m" ); case Colour::White: return setColour( "[0m" );
case Colour::Red: return setColour( "[0;31m" ); case Colour::Red: return setColour( "[0;31m" );
case Colour::Green: return setColour( "[0;32m" ); case Colour::Green: return setColour( "[0;32m" );
case Colour::Blue: return setColour( "[0:34m" ); case Colour::Blue: return setColour( "[0;34m" );
case Colour::Cyan: return setColour( "[0;36m" ); case Colour::Cyan: return setColour( "[0;36m" );
case Colour::Yellow: return setColour( "[0;33m" ); case Colour::Yellow: return setColour( "[0;33m" );
case Colour::Grey: return setColour( "[1;30m" ); case Colour::Grey: return setColour( "[1;30m" );
@ -7582,7 +7619,7 @@ namespace Catch {
return os; return os;
} }
Version libraryVersion( 1, 5, 9, "", 0 ); Version libraryVersion( 1, 6, 0, "", 0 );
} }
@ -8349,7 +8386,7 @@ namespace Catch {
} }
std::string ResultBuilder::reconstructExpression() const { std::string ResultBuilder::reconstructExpression() const {
if( m_exprComponents.op == "" ) if( m_exprComponents.op == "" )
return m_exprComponents.lhs.empty() ? m_assertionInfo.capturedExpression : m_exprComponents.op + m_exprComponents.lhs; return m_exprComponents.lhs.empty() ? m_assertionInfo.capturedExpression : m_exprComponents.lhs;
else if( m_exprComponents.op == "matches" ) else if( m_exprComponents.op == "matches" )
return m_exprComponents.lhs + " " + m_exprComponents.rhs; return m_exprComponents.lhs + " " + m_exprComponents.rhs;
else if( m_exprComponents.op != "!" ) { else if( m_exprComponents.op != "!" ) {
@ -8967,7 +9004,7 @@ namespace Catch {
default: default:
// Escape control chars - based on contribution by @espenalb in PR #465 and // Escape control chars - based on contribution by @espenalb in PR #465 and
// by @mrpi PR #588 // by @mrpi PR #588
if ( ( c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' ) if ( ( c >= 0 && c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' )
os << "&#x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>( c ) << ';'; os << "&#x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>( c ) << ';';
else else
os << c; os << c;
@ -10400,7 +10437,7 @@ int main (int argc, char * const argv[]) {
#define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_ELSE" ) #define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_ELSE" )
#define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CATCH_CHECK_NOFAIL" ) #define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CATCH_CHECK_NOFAIL" )
#define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS" ) #define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, "", "CATCH_CHECK_THROWS" )
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS_AS" ) #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS_AS" )
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, matcher, "CATCH_CHECK_THROWS_WITH" ) #define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, matcher, "CATCH_CHECK_THROWS_WITH" )
#define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_NOTHROW" ) #define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_NOTHROW" )