diff --git a/README.md b/README.md index bc75683b..f4f30fd3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![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) -The latest, single header, version can be downloaded directly using this link +The latest, single header, version can be downloaded directly using this link ## What's the Catch? diff --git a/docs/release-notes.md b/docs/release-notes.md index 7e1165f1..99445eb5 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -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 ### Fixes diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index 0141a720..fdf3be6e 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -38,7 +38,7 @@ namespace Catch { } inline Version libraryVersion() { - static Version version( 1, 9, 1, "", 0 ); + static Version version( 1, 9, 2, "", 0 ); return version; } diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index b1b02add..49df947e 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,6 +1,6 @@ - + diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 45328b85..f0d5e756 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * Catch v1.9.1 - * Generated: 2017-04-09 21:21:06.285364 + * Catch v1.9.2 + * Generated: 2017-04-25 10:41:53.040184 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -136,13 +136,19 @@ #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// -// Cygwin -#ifdef __CYGWIN__ +// We know some environments not to support full POSIX signals +#if defined(__CYGWIN__) || defined(__QNX__) # if !defined(CATCH_CONFIG_POSIX_SIGNALS) # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS # endif +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Cygwin +#ifdef __CYGWIN__ + // Required for some versions of Cygwin to declare gettimeofday // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin # define _BSD_SOURCE @@ -2397,14 +2403,19 @@ namespace Catch { // #included from: catch_timer.h #define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED -#ifdef CATCH_PLATFORM_WINDOWS -typedef unsigned long long uint64_t; +#ifdef _MSC_VER + +namespace Catch { + typedef unsigned long long UInt64; +} #else #include +namespace Catch { + typedef uint64_t UInt64; +} #endif namespace Catch { - class Timer { public: Timer() : m_ticks( 0 ) {} @@ -2414,7 +2425,7 @@ namespace Catch { double getElapsedSeconds() const; private: - uint64_t m_ticks; + UInt64 m_ticks; }; } // namespace Catch @@ -2769,16 +2780,17 @@ namespace Detail { return Approx( 0 ); } - Approx operator()( double value ) { - Approx approx( value ); +#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) + + template ::value>::type> + Approx operator()( T value ) { + Approx approx( static_cast(value) ); approx.epsilon( m_epsilon ); approx.margin( m_margin ); approx.scale( m_scale ); return approx; } -#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) - template ::value>::type> explicit Approx( T value ): Approx(static_cast(value)) {} @@ -2828,7 +2840,35 @@ namespace Detail { friend bool operator >= ( Approx const& lhs, T rhs ) { return lhs.m_value > double(rhs) || lhs == rhs; } + + template ::value>::type> + Approx& epsilon( T newEpsilon ) { + m_epsilon = double(newEpsilon); + return *this; + } + + template ::value>::type> + Approx& margin( T newMargin ) { + m_margin = double(newMargin); + return *this; + } + + template ::value>::type> + Approx& scale( T newScale ) { + m_scale = double(newScale); + return *this; + } + #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 ) { // 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) ) ); @@ -2865,7 +2905,6 @@ namespace Detail { friend bool operator >= ( Approx const& lhs, double rhs ) { return lhs.m_value > rhs || lhs == rhs; } -#endif Approx& epsilon( double newEpsilon ) { m_epsilon = newEpsilon; @@ -2881,6 +2920,7 @@ namespace Detail { m_scale = newScale; return *this; } +#endif std::string toString() const { std::ostringstream oss; @@ -3133,8 +3173,18 @@ namespace Catch { } private: - T* nullableValue; - char storage[sizeof(T)]; + T *nullableValue; + union { + 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 @@ -8232,7 +8282,7 @@ namespace Catch { } inline Version libraryVersion() { - static Version version( 1, 9, 1, "", 0 ); + static Version version( 1, 9, 2, "", 0 ); return version; } @@ -10218,7 +10268,8 @@ namespace Catch { public: JunitReporter( ReporterConfig const& _config ) : CumulativeReporterBase( _config ), - xml( _config.stream() ) + xml( _config.stream() ), + m_okToFail( false ) { m_reporterPrefs.shouldRedirectStdOut = true; } @@ -10244,8 +10295,11 @@ namespace Catch { CumulativeReporterBase::testGroupStarting( groupInfo ); } + virtual void testCaseStarting( TestCaseInfo const& testCaseInfo ) CATCH_OVERRIDE { + m_okToFail = testCaseInfo.okToFail(); + } virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { - if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException ) + if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) unexpectedExceptions++; return CumulativeReporterBase::assertionEnded( assertionStats ); } @@ -10410,6 +10464,7 @@ namespace Catch { std::ostringstream stdOutForSuite; std::ostringstream stdErrForSuite; unsigned int unexpectedExceptions; + bool m_okToFail; }; INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )