Skip to content

Commit

Permalink
v1.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Apr 25, 2017
1 parent 211b330 commit fc7f0a0
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<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?

Expand Down
21 changes: 21 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/internal/catch_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion projects/SelfTest/Baselines/junit.sw.approved.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}">
<error type="TEST_CASE">
Expand Down
91 changes: 73 additions & 18 deletions single_include/catch.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <stdint.h>
namespace Catch {
typedef uint64_t UInt64;
}
#endif

namespace Catch {

class Timer {
public:
Timer() : m_ticks( 0 ) {}
Expand All @@ -2414,7 +2425,7 @@ namespace Catch {
double getElapsedSeconds() const;

private:
uint64_t m_ticks;
UInt64 m_ticks;
};

} // namespace Catch
Expand Down Expand Up @@ -2769,16 +2780,17 @@ namespace Detail {
return Approx( 0 );
}

Approx operator()( double value ) {
Approx approx( value );
#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)

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.margin( m_margin );
approx.scale( m_scale );
return approx;
}

#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)

template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
explicit Approx( T value ): Approx(static_cast<double>(value))
{}
Expand Down Expand Up @@ -2828,7 +2840,35 @@ namespace Detail {
friend bool operator >= ( Approx const& lhs, T 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

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) ) );
Expand Down Expand Up @@ -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;
Expand All @@ -2881,6 +2920,7 @@ namespace Detail {
m_scale = newScale;
return *this;
}
#endif

std::string toString() const {
std::ostringstream oss;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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 );
}
Expand Down Expand Up @@ -10410,6 +10464,7 @@ namespace Catch {
std::ostringstream stdOutForSuite;
std::ostringstream stdErrForSuite;
unsigned int unexpectedExceptions;
bool m_okToFail;
};

INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
Expand Down

0 comments on commit fc7f0a0

Please sign in to comment.