Skip to content

Commit 3b2f206

Browse files
committed
v1.6.0 build - including release notes
1 parent 4e4d733 commit 3b2f206

File tree

5 files changed

+98
-34
lines changed

5 files changed

+98
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![catch logo](catch-logo-small.png)
22

3-
*v1.5.9*
3+
*v1.6.0*
44

55
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.svg?branch=master)](https://travis-ci.org/philsquared/Catch)
66

docs/Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Other
1717

1818
* [Why Catch?](why-catch.md)
1919
* [Contributing](contributing.md)
20+
* [Release Nodes](release-notes.md)

docs/release-notes.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# 1.6.0
2+
3+
### Cmake/ projects:
4+
* Moved CMakeLists.txt to root, made it friendlier for CLion and generating XCode and VS projects, and removed the manually maintained XCode and VS projects.
5+
6+
### Features/ Changes:
7+
* Approx now supports >= and <=
8+
* Can now use \ to escape chars in test names on command line
9+
* Standardize C++11 feature toggles
10+
11+
### Fixes:
12+
* Blue shell colour
13+
* Missing argument to CATCH_CHECK_THROWS
14+
* Don't encode extended ASCII in XML
15+
* use std::shuffle on more compilers (fixes deprecation warning/error)
16+
* Use __COUNTER__ more consistently (where available)
17+
18+
### Other:
19+
* Tweaks and changes to scripts - particularly for Approval test - to make them more portable
20+
21+
# Older versions
22+
Release notes were not maintained prior to v1.6.0, but you should be able to work them out from the Git history
23+
24+
---
25+
26+
[Home](Readme.md)

include/internal/catch_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace Catch {
3737
return os;
3838
}
3939

40-
Version libraryVersion( 1, 5, 9, "", 0 );
40+
Version libraryVersion( 1, 6, 0, "", 0 );
4141

4242
}
4343

single_include/catch.hpp

Lines changed: 69 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Catch v1.5.9
3-
* Generated: 2016-11-29 12:14:38.049276
2+
* Catch v1.6.0
3+
* Generated: 2017-01-11 16:38:09.405017
44
* ----------------------------------------------------------
55
* This file has been merged from multiple headers. Please don't edit it directly
66
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -60,21 +60,6 @@
6060
// #included from: catch_common.h
6161
#define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
6262

63-
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
64-
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
65-
#ifdef CATCH_CONFIG_COUNTER
66-
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
67-
#else
68-
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
69-
#endif
70-
71-
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
72-
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
73-
74-
#include <sstream>
75-
#include <stdexcept>
76-
#include <algorithm>
77-
7863
// #included from: catch_compiler_capabilities.h
7964
#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
8065

@@ -181,6 +166,7 @@
181166
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
182167
#define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
183168
#define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
169+
#define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
184170
#endif
185171

186172
#endif // _MSC_VER
@@ -246,6 +232,9 @@
246232
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR)
247233
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
248234
# endif
235+
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE)
236+
# define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
237+
# endif
249238

250239
#endif // __cplusplus >= 201103L
251240

@@ -268,18 +257,21 @@
268257
#if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS)
269258
# define CATCH_CONFIG_VARIADIC_MACROS
270259
#endif
271-
#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)
260+
#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)
272261
# define CATCH_CONFIG_CPP11_LONG_LONG
273262
#endif
274-
#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11)
263+
#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11)
275264
# define CATCH_CONFIG_CPP11_OVERRIDE
276265
#endif
277-
#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)
266+
#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)
278267
# define CATCH_CONFIG_CPP11_UNIQUE_PTR
279268
#endif
280269
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
281270
# define CATCH_CONFIG_COUNTER
282271
#endif
272+
#if defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_NO_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_NO_CPP11)
273+
# define CATCH_CONFIG_CPP11_SHUFFLE
274+
#endif
283275

284276
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
285277
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
@@ -315,6 +307,21 @@
315307
# define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
316308
#endif
317309

310+
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
311+
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
312+
#ifdef CATCH_CONFIG_COUNTER
313+
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
314+
#else
315+
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
316+
#endif
317+
318+
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
319+
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
320+
321+
#include <sstream>
322+
#include <stdexcept>
323+
#include <algorithm>
324+
318325
namespace Catch {
319326

320327
struct IConfig;
@@ -2668,6 +2675,26 @@ namespace Detail {
26682675
return !operator==( rhs, lhs );
26692676
}
26702677

2678+
friend bool operator <= ( double lhs, Approx const& rhs )
2679+
{
2680+
return lhs < rhs.m_value || lhs == rhs;
2681+
}
2682+
2683+
friend bool operator <= ( Approx const& lhs, double rhs )
2684+
{
2685+
return lhs.m_value < rhs || lhs == rhs;
2686+
}
2687+
2688+
friend bool operator >= ( double lhs, Approx const& rhs )
2689+
{
2690+
return lhs > rhs.m_value || lhs == rhs;
2691+
}
2692+
2693+
friend bool operator >= ( Approx const& lhs, double rhs )
2694+
{
2695+
return lhs.m_value > rhs || lhs == rhs;
2696+
}
2697+
26712698
Approx& epsilon( double newEpsilon ) {
26722699
m_epsilon = newEpsilon;
26732700
return *this;
@@ -3257,11 +3284,12 @@ namespace Catch {
32573284
namespace Catch {
32583285

32593286
class TestSpecParser {
3260-
enum Mode{ None, Name, QuotedName, Tag };
3287+
enum Mode{ None, Name, QuotedName, Tag, EscapedName };
32613288
Mode m_mode;
32623289
bool m_exclusion;
32633290
std::size_t m_start, m_pos;
32643291
std::string m_arg;
3292+
std::vector<std::size_t> m_escapeChars;
32653293
TestSpec::Filter m_currentFilter;
32663294
TestSpec m_testSpec;
32673295
ITagAliasRegistry const* m_tagAliases;
@@ -3274,6 +3302,7 @@ namespace Catch {
32743302
m_exclusion = false;
32753303
m_start = std::string::npos;
32763304
m_arg = m_tagAliases->expandAliases( arg );
3305+
m_escapeChars.clear();
32773306
for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
32783307
visitChar( m_arg[m_pos] );
32793308
if( m_mode == Name )
@@ -3292,6 +3321,7 @@ namespace Catch {
32923321
case '~': m_exclusion = true; return;
32933322
case '[': return startNewMode( Tag, ++m_pos );
32943323
case '"': return startNewMode( QuotedName, ++m_pos );
3324+
case '\\': return escape();
32953325
default: startNewMode( Name, m_pos ); break;
32963326
}
32973327
}
@@ -3307,7 +3337,11 @@ namespace Catch {
33073337
addPattern<TestSpec::NamePattern>();
33083338
startNewMode( Tag, ++m_pos );
33093339
}
3340+
else if( c == '\\' )
3341+
escape();
33103342
}
3343+
else if( m_mode == EscapedName )
3344+
m_mode = Name;
33113345
else if( m_mode == QuotedName && c == '"' )
33123346
addPattern<TestSpec::NamePattern>();
33133347
else if( m_mode == Tag && c == ']' )
@@ -3317,10 +3351,17 @@ namespace Catch {
33173351
m_mode = mode;
33183352
m_start = start;
33193353
}
3354+
void escape() {
3355+
m_mode = EscapedName;
3356+
m_escapeChars.push_back( m_pos );
3357+
}
33203358
std::string subString() const { return m_arg.substr( m_start, m_pos - m_start ); }
33213359
template<typename T>
33223360
void addPattern() {
33233361
std::string token = subString();
3362+
for( size_t i = 0; i < m_escapeChars.size(); ++i )
3363+
token = token.substr( 0, m_escapeChars[i] ) + token.substr( m_escapeChars[i]+1 );
3364+
m_escapeChars.clear();
33243365
if( startsWith( token, "exclude:" ) ) {
33253366
m_exclusion = true;
33263367
token = token.substr( 8 );
@@ -6458,26 +6499,22 @@ namespace Catch {
64586499
#include <iostream>
64596500
#include <algorithm>
64606501

6461-
#ifdef CATCH_CPP14_OR_GREATER
6462-
#include <random>
6463-
#endif
6464-
64656502
namespace Catch {
64666503

64676504
struct RandomNumberGenerator {
64686505
typedef std::ptrdiff_t result_type;
64696506

64706507
result_type operator()( result_type n ) const { return std::rand() % n; }
64716508

6472-
#ifdef CATCH_CPP14_OR_GREATER
6509+
#ifdef CATCH_CONFIG_CPP11_SHUFFLE
64736510
static constexpr result_type min() { return 0; }
64746511
static constexpr result_type max() { return 1000000; }
64756512
result_type operator()() const { return std::rand() % max(); }
64766513
#endif
64776514
template<typename V>
64786515
static void shuffle( V& vector ) {
64796516
RandomNumberGenerator rng;
6480-
#ifdef CATCH_CPP14_OR_GREATER
6517+
#ifdef CATCH_CONFIG_CPP11_SHUFFLE
64816518
std::shuffle( vector.begin(), vector.end(), rng );
64826519
#else
64836520
std::random_shuffle( vector.begin(), vector.end(), rng );
@@ -7147,7 +7184,7 @@ namespace {
71477184
case Colour::White: return setColour( "[0m" );
71487185
case Colour::Red: return setColour( "[0;31m" );
71497186
case Colour::Green: return setColour( "[0;32m" );
7150-
case Colour::Blue: return setColour( "[0:34m" );
7187+
case Colour::Blue: return setColour( "[0;34m" );
71517188
case Colour::Cyan: return setColour( "[0;36m" );
71527189
case Colour::Yellow: return setColour( "[0;33m" );
71537190
case Colour::Grey: return setColour( "[1;30m" );
@@ -7582,7 +7619,7 @@ namespace Catch {
75827619
return os;
75837620
}
75847621

7585-
Version libraryVersion( 1, 5, 9, "", 0 );
7622+
Version libraryVersion( 1, 6, 0, "", 0 );
75867623

75877624
}
75887625

@@ -8349,7 +8386,7 @@ namespace Catch {
83498386
}
83508387
std::string ResultBuilder::reconstructExpression() const {
83518388
if( m_exprComponents.op == "" )
8352-
return m_exprComponents.lhs.empty() ? m_assertionInfo.capturedExpression : m_exprComponents.op + m_exprComponents.lhs;
8389+
return m_exprComponents.lhs.empty() ? m_assertionInfo.capturedExpression : m_exprComponents.lhs;
83538390
else if( m_exprComponents.op == "matches" )
83548391
return m_exprComponents.lhs + " " + m_exprComponents.rhs;
83558392
else if( m_exprComponents.op != "!" ) {
@@ -8967,7 +9004,7 @@ namespace Catch {
89679004
default:
89689005
// Escape control chars - based on contribution by @espenalb in PR #465 and
89699006
// by @mrpi PR #588
8970-
if ( ( c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' )
9007+
if ( ( c >= 0 && c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' )
89719008
os << "&#x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>( c ) << ';';
89729009
else
89739010
os << c;
@@ -10400,7 +10437,7 @@ int main (int argc, char * const argv[]) {
1040010437
#define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_ELSE" )
1040110438
#define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CATCH_CHECK_NOFAIL" )
1040210439

10403-
#define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS" )
10440+
#define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, "", "CATCH_CHECK_THROWS" )
1040410441
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS_AS" )
1040510442
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, matcher, "CATCH_CHECK_THROWS_WITH" )
1040610443
#define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_NOTHROW" )

0 commit comments

Comments
 (0)