v2.0.1 release

This commit is contained in:
Phil Nash 2017-11-03 12:01:52 +00:00
parent 1c43fb64c1
commit b119ebdde1
6 changed files with 68 additions and 44 deletions

View File

@ -9,7 +9,7 @@ set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest) set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark) set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark)
set(HEADER_DIR ${CATCH_DIR}/include) set(HEADER_DIR ${CATCH_DIR}/include)
set(CATCH_VERSION_NUMBER 2.0.0-develop.6) set(CATCH_VERSION_NUMBER 2.0.1)
if(USE_CPP14) if(USE_CPP14)
message(STATUS "Enabling C++14") message(STATUS "Enabling C++14")

View File

@ -4,7 +4,7 @@ from conans import ConanFile
class CatchConan(ConanFile): class CatchConan(ConanFile):
name = "Catch" name = "Catch"
version = "2.0.0-develop.6" version = "2.0.1"
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD" description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
author = "philsquared" author = "philsquared"
generators = "cmake" generators = "cmake"

View File

@ -1,5 +1,5 @@
<a id="top"></a> <a id="top"></a>
# 2.0.0 (in progress) # 2.0.1
## Breaking changes ## Breaking changes
* Removed C++98 support * Removed C++98 support

View File

@ -37,7 +37,7 @@ namespace Catch {
} }
Version const& libraryVersion() { Version const& libraryVersion() {
static Version version( 2, 0, 0, "develop", 6 ); static Version version( 2, 0, 1, "", 0 );
return version; return version;
} }

View File

@ -1,6 +1,6 @@
/* /*
* Catch v2.0.0-develop.6 * Catch v2.0.1
* Generated: 2017-10-31 15:09:47.277913 * Generated: 2017-11-03 11:53:39.642003
* ---------------------------------------------------------- * ----------------------------------------------------------
* 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) 2017 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2017 Two Blue Cubes Ltd. All rights reserved.
@ -1835,16 +1835,15 @@ namespace Catch {
do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false) do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false)
// end catch_enforce.h // end catch_enforce.h
#include <cmath>
#include <type_traits> #include <type_traits>
namespace Catch { namespace Catch {
namespace Detail { namespace Detail {
double dmax(double lhs, double rhs);
class Approx { class Approx {
private:
bool equalityComparisonImpl(double other) const;
public: public:
explicit Approx ( double value ); explicit Approx ( double value );
@ -1865,14 +1864,8 @@ namespace Detail {
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
friend bool operator == ( const T& lhs, Approx const& rhs ) { friend bool operator == ( const T& lhs, Approx const& rhs ) {
// Thanks to Richard Harris for his help refining this formula
auto lhs_v = static_cast<double>(lhs); auto lhs_v = static_cast<double>(lhs);
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + return rhs.equalityComparisonImpl(lhs_v);
dmax(std::fabs(lhs_v), std::fabs(rhs.m_value)));
if (relativeOK) {
return true;
}
return std::fabs(lhs_v - rhs.m_value) <= rhs.m_margin;
} }
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
@ -1912,14 +1905,21 @@ namespace Detail {
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& epsilon( T const& newEpsilon ) { Approx& epsilon( T const& newEpsilon ) {
m_epsilon = static_cast<double>(newEpsilon); double epsilonAsDouble = static_cast<double>(newEpsilon);
CATCH_ENFORCE(epsilonAsDouble >= 0 && epsilonAsDouble <= 1.0,
"Invalid Approx::epsilon: " << epsilonAsDouble
<< ", Approx::epsilon has to be between 0 and 1");
m_epsilon = epsilonAsDouble;
return *this; return *this;
} }
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type> template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& margin( T const& newMargin ) { Approx& margin( T const& newMargin ) {
m_margin = static_cast<double>(newMargin); double marginAsDouble = static_cast<double>(newMargin);
CATCH_ENFORCE(m_margin >= 0, "Invalid Approx::margin: " << m_margin << ", Approx::Margin has to be non-negative."); CATCH_ENFORCE(marginAsDouble >= 0,
"Invalid Approx::margin: " << marginAsDouble
<< ", Approx::Margin has to be non-negative.");
m_margin = marginAsDouble;
return *this; return *this;
} }
@ -3980,22 +3980,26 @@ namespace Catch {
// Cpp files will be included in the single-header file here // Cpp files will be included in the single-header file here
// start catch_approx.cpp // start catch_approx.cpp
#include <cmath>
#include <limits> #include <limits>
namespace {
// Performs equivalent check of std::fabs(lhs - rhs) <= margin
// But without the subtraction to allow for INFINITY in comparison
bool marginComparison(double lhs, double rhs, double margin) {
return (lhs + margin >= rhs) && (rhs + margin >= lhs);
}
}
namespace Catch { namespace Catch {
namespace Detail { namespace Detail {
double dmax(double lhs, double rhs) {
if (lhs < rhs) {
return rhs;
}
return lhs;
}
Approx::Approx ( double value ) Approx::Approx ( double value )
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ), : m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
m_margin( 0.0 ), m_margin( 0.0 ),
m_scale( 1.0 ), m_scale( 0.0 ),
m_value( value ) m_value( value )
{} {}
@ -4009,6 +4013,12 @@ namespace Detail {
return oss.str(); return oss.str();
} }
bool Approx::equalityComparisonImpl(const double other) const {
// First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
// Thanks to Richard Harris for his help refining the scaled margin value
return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
}
} // end namespace Detail } // end namespace Detail
std::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) { std::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) {
@ -8055,6 +8065,7 @@ namespace Catch {
clara::Parser m_cli; clara::Parser m_cli;
ConfigData m_configData; ConfigData m_configData;
std::shared_ptr<Config> m_config; std::shared_ptr<Config> m_config;
bool m_startupExceptions = false;
}; };
} // end namespace Catch } // end namespace Catch
@ -8186,8 +8197,26 @@ namespace Catch {
Session::Session() { Session::Session() {
static bool alreadyInstantiated = false; static bool alreadyInstantiated = false;
if( alreadyInstantiated ) if( alreadyInstantiated ) {
CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); try { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); }
catch(...) { getMutableRegistryHub().registerStartupException(); }
}
const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();
if ( !exceptions.empty() ) {
m_startupExceptions = true;
Colour colourGuard( Colour::Red );
Catch::cerr() << "Errors occured during startup!" << '\n';
// iterate over all exceptions and notify user
for ( const auto& ex_ptr : exceptions ) {
try {
std::rethrow_exception(ex_ptr);
} catch ( std::exception const& ex ) {
Catch::cerr() << Column( ex.what() ).indent(2) << '\n';
}
}
}
alreadyInstantiated = true; alreadyInstantiated = true;
m_cli = makeCommandLineParser( m_configData ); m_cli = makeCommandLineParser( m_configData );
} }
@ -8210,6 +8239,9 @@ namespace Catch {
} }
int Session::applyCommandLine( int argc, char* argv[] ) { int Session::applyCommandLine( int argc, char* argv[] ) {
if( m_startupExceptions )
return 1;
auto result = m_cli.parse( clara::Args( argc, argv ) ); auto result = m_cli.parse( clara::Args( argc, argv ) );
if( !result ) { if( !result ) {
Catch::cerr() Catch::cerr()
@ -8235,19 +8267,8 @@ namespace Catch {
} }
int Session::run( int argc, char* argv[] ) { int Session::run( int argc, char* argv[] ) {
const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); if( m_startupExceptions )
if ( !exceptions.empty() ) {
Catch::cerr() << "Errors occured during startup!" << '\n';
// iterate over all exceptions and notify user
for ( const auto& ex_ptr : exceptions ) {
try {
std::rethrow_exception(ex_ptr);
} catch ( std::exception const& ex ) {
Catch::cerr() << ex.what() << '\n';
}
}
return 1; return 1;
}
int returnCode = applyCommandLine( argc, argv ); int returnCode = applyCommandLine( argc, argv );
if( returnCode == 0 ) if( returnCode == 0 )
returnCode = run(); returnCode = run();
@ -8306,6 +8327,9 @@ namespace Catch {
} }
int Session::runInternal() { int Session::runInternal() {
if( m_startupExceptions )
return 1;
if( m_configData.showHelp || m_configData.libIdentify ) if( m_configData.showHelp || m_configData.libIdentify )
return 0; return 0;
@ -9802,7 +9826,7 @@ namespace Catch {
} }
Version const& libraryVersion() { Version const& libraryVersion() {
static Version version( 2, 0, 0, "develop", 6 ); static Version version( 2, 0, 1, "", 0 );
return version; return version;
} }

View File

@ -10,7 +10,7 @@ class CatchConanTest(ConanFile):
settings = "os", "compiler", "arch", "build_type" settings = "os", "compiler", "arch", "build_type"
username = getenv("CONAN_USERNAME", "philsquared") username = getenv("CONAN_USERNAME", "philsquared")
channel = getenv("CONAN_CHANNEL", "testing") channel = getenv("CONAN_CHANNEL", "testing")
requires = "Catch/2.0.0-develop.6@%s/%s" % (username, channel) requires = "Catch/2.0.1@%s/%s" % (username, channel)
def build(self): def build(self):
cmake = CMake(self) cmake = CMake(self)