This commit is contained in:
Martin Hořeňovský 2017-04-25 11:08:02 +02:00
parent 211b330346
commit fc7f0a02b8
5 changed files with 97 additions and 21 deletions

View File

@ -4,7 +4,7 @@
[![Build Status](https://travis-ci.org/philsquared/Catch.svg?branch=master)](https://travis-ci.org/philsquared/Catch) [![Build Status](https://travis-ci.org/philsquared/Catch.svg?branch=master)](https://travis-ci.org/philsquared/Catch)
[![Build status](https://ci.appveyor.com/api/projects/status/hrtk60hv6tw6fght/branch/master?svg=true)](https://ci.appveyor.com/project/philsquared/catch/branch/master) [![Build status](https://ci.appveyor.com/api/projects/status/hrtk60hv6tw6fght/branch/master?svg=true)](https://ci.appveyor.com/project/philsquared/catch/branch/master)
<a href="https://github.com/philsquared/Catch/releases/download/v1.9.1/catch.hpp">The latest, single header, version can be downloaded directly using this link</a> <a href="https://github.com/philsquared/Catch/releases/download/v1.9.2/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
## What's the Catch? ## What's the Catch?

View File

@ -1,3 +1,24 @@
# 1.9.2
### Improvements and minor changes
* All of `Approx`'s member functions now accept strong typedefs in C++11 mode (#888)
* Previously `Approx::scale`, `Approx::epsilon`, `Approx::margin` and `Approx::operator()` didn't.
### Fixes
* POSIX signals are now disabled by default under QNX (#889)
* QNX does not support current enough (2001) POSIX specification
* JUnit no longer counts exceptions as failures if given test case is marked as ok to fail.
* `Catch::Option` should now have its storage properly aligned.
* Catch no longer attempts to define `uint64_t` on windows (#862)
* This was causing trouble when compiled under Cygwin
### Other
* Catch is now compiled under MSVC 2017 using `std:c++latest` (C++17 mode) in CI
* We now provide cmake script that autoregisters Catch tests into ctest.
* See `contrib` folder.
# 1.9.1 # 1.9.1
### Fixes ### Fixes

View File

@ -38,7 +38,7 @@ namespace Catch {
} }
inline Version libraryVersion() { inline Version libraryVersion() {
static Version version( 1, 9, 1, "", 0 ); static Version version( 1, 9, 2, "", 0 );
return version; return version;
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuitesspanner> <testsuitesspanner>
<testsuite name="<exe-name>" errors="15" failures="75" tests="970" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testsuite name="<exe-name>" errors="13" failures="77" tests="970" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/> <testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
<testcase classname="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}"> <testcase classname="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}">
<error type="TEST_CASE"> <error type="TEST_CASE">

View File

@ -1,6 +1,6 @@
/* /*
* Catch v1.9.1 * Catch v1.9.2
* Generated: 2017-04-09 21:21:06.285364 * Generated: 2017-04-25 10:41:53.040184
* ---------------------------------------------------------- * ----------------------------------------------------------
* 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.
@ -136,13 +136,19 @@
#endif // __clang__ #endif // __clang__
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Cygwin // We know some environments not to support full POSIX signals
#ifdef __CYGWIN__ #if defined(__CYGWIN__) || defined(__QNX__)
# if !defined(CATCH_CONFIG_POSIX_SIGNALS) # if !defined(CATCH_CONFIG_POSIX_SIGNALS)
# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
# endif # endif
#endif
////////////////////////////////////////////////////////////////////////////////
// Cygwin
#ifdef __CYGWIN__
// Required for some versions of Cygwin to declare gettimeofday // Required for some versions of Cygwin to declare gettimeofday
// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
# define _BSD_SOURCE # define _BSD_SOURCE
@ -2397,14 +2403,19 @@ namespace Catch {
// #included from: catch_timer.h // #included from: catch_timer.h
#define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED #define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
#ifdef CATCH_PLATFORM_WINDOWS #ifdef _MSC_VER
typedef unsigned long long uint64_t;
namespace Catch {
typedef unsigned long long UInt64;
}
#else #else
#include <stdint.h> #include <stdint.h>
namespace Catch {
typedef uint64_t UInt64;
}
#endif #endif
namespace Catch { namespace Catch {
class Timer { class Timer {
public: public:
Timer() : m_ticks( 0 ) {} Timer() : m_ticks( 0 ) {}
@ -2414,7 +2425,7 @@ namespace Catch {
double getElapsedSeconds() const; double getElapsedSeconds() const;
private: private:
uint64_t m_ticks; UInt64 m_ticks;
}; };
} // namespace Catch } // namespace Catch
@ -2769,16 +2780,17 @@ namespace Detail {
return Approx( 0 ); return Approx( 0 );
} }
Approx operator()( double value ) { #if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
Approx approx( value );
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx operator()( T value ) {
Approx approx( static_cast<double>(value) );
approx.epsilon( m_epsilon ); approx.epsilon( m_epsilon );
approx.margin( m_margin ); approx.margin( m_margin );
approx.scale( m_scale ); approx.scale( m_scale );
return approx; return approx;
} }
#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
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>
explicit Approx( T value ): Approx(static_cast<double>(value)) explicit Approx( T value ): Approx(static_cast<double>(value))
{} {}
@ -2828,7 +2840,35 @@ namespace Detail {
friend bool operator >= ( Approx const& lhs, T rhs ) { friend bool operator >= ( Approx const& lhs, T rhs ) {
return lhs.m_value > double(rhs) || lhs == rhs; return lhs.m_value > double(rhs) || lhs == rhs;
} }
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& epsilon( T newEpsilon ) {
m_epsilon = double(newEpsilon);
return *this;
}
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& margin( T newMargin ) {
m_margin = double(newMargin);
return *this;
}
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& scale( T newScale ) {
m_scale = double(newScale);
return *this;
}
#else #else
Approx operator()( double value ) {
Approx approx( value );
approx.epsilon( m_epsilon );
approx.margin( m_margin );
approx.scale( m_scale );
return approx;
}
friend bool operator == ( double lhs, Approx const& rhs ) { friend bool operator == ( double lhs, Approx const& rhs ) {
// Thanks to Richard Harris for his help refining this formula // Thanks to Richard Harris for his help refining this formula
bool relativeOK = std::fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( std::fabs(lhs), std::fabs(rhs.m_value) ) ); bool relativeOK = std::fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( std::fabs(lhs), std::fabs(rhs.m_value) ) );
@ -2865,7 +2905,6 @@ namespace Detail {
friend bool operator >= ( Approx const& lhs, double rhs ) { friend bool operator >= ( Approx const& lhs, double rhs ) {
return lhs.m_value > rhs || lhs == rhs; return lhs.m_value > rhs || lhs == rhs;
} }
#endif
Approx& epsilon( double newEpsilon ) { Approx& epsilon( double newEpsilon ) {
m_epsilon = newEpsilon; m_epsilon = newEpsilon;
@ -2881,6 +2920,7 @@ namespace Detail {
m_scale = newScale; m_scale = newScale;
return *this; return *this;
} }
#endif
std::string toString() const { std::string toString() const {
std::ostringstream oss; std::ostringstream oss;
@ -3134,7 +3174,17 @@ namespace Catch {
private: private:
T *nullableValue; T *nullableValue;
union {
char storage[sizeof(T)]; char storage[sizeof(T)];
// These are here to force alignment for the storage
long double dummy1;
void (*dummy2)();
long double dummy3;
#ifdef CATCH_CONFIG_CPP11_LONG_LONG
long long dummy4;
#endif
};
}; };
} // end namespace Catch } // end namespace Catch
@ -8232,7 +8282,7 @@ namespace Catch {
} }
inline Version libraryVersion() { inline Version libraryVersion() {
static Version version( 1, 9, 1, "", 0 ); static Version version( 1, 9, 2, "", 0 );
return version; return version;
} }
@ -10218,7 +10268,8 @@ namespace Catch {
public: public:
JunitReporter( ReporterConfig const& _config ) JunitReporter( ReporterConfig const& _config )
: CumulativeReporterBase( _config ), : CumulativeReporterBase( _config ),
xml( _config.stream() ) xml( _config.stream() ),
m_okToFail( false )
{ {
m_reporterPrefs.shouldRedirectStdOut = true; m_reporterPrefs.shouldRedirectStdOut = true;
} }
@ -10244,8 +10295,11 @@ namespace Catch {
CumulativeReporterBase::testGroupStarting( groupInfo ); CumulativeReporterBase::testGroupStarting( groupInfo );
} }
virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) CATCH_OVERRIDE {
m_okToFail = testCaseInfo.okToFail();
}
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException ) if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
unexpectedExceptions++; unexpectedExceptions++;
return CumulativeReporterBase::assertionEnded( assertionStats ); return CumulativeReporterBase::assertionEnded( assertionStats );
} }
@ -10410,6 +10464,7 @@ namespace Catch {
std::ostringstream stdOutForSuite; std::ostringstream stdOutForSuite;
std::ostringstream stdErrForSuite; std::ostringstream stdErrForSuite;
unsigned int unexpectedExceptions; unsigned int unexpectedExceptions;
bool m_okToFail;
}; };
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter ) INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )