Skip to content

Commit 34f7cfe

Browse files
committed
v1.12.0
1 parent 07b9bda commit 34f7cfe

File tree

6 files changed

+150
-69
lines changed

6 files changed

+150
-69
lines changed

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
[![Github Releases](https://img.shields.io/github/release/philsquared/catch.svg)](https://github.com/philsquared/catch/releases)
44
[![Build Status](https://travis-ci.org/philsquared/Catch.svg?branch=master)](https://travis-ci.org/philsquared/Catch)
55
[![Build status](https://ci.appveyor.com/api/projects/status/hrtk60hv6tw6fght/branch/master?svg=true)](https://ci.appveyor.com/project/philsquared/catch/branch/master)
6-
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/EyEbEIfp8CnnjguW)
6+
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/hgiYhcvH835lHvaA)
77

8-
<a href="https://github.com/philsquared/Catch/releases/download/v1.11.0/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
8+
<a href="https://github.com/philsquared/Catch/releases/download/v1.12.0/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
99

1010
## What's the Catch?
1111

Diff for: conanfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class CatchConan(ConanFile):
66
name = "Catch"
7-
version = "1.11.0"
7+
version = "1.12.0"
88
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
99
author = "philsquared"
1010
generators = "cmake"

Diff for: docs/release-notes.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 1.12.0
2+
3+
### Fixes
4+
* Fixed compilation for strict C++98 mode (ie not gnu++98) and older compilers (#1103)
5+
* `INFO` messages are included in the `xml` reporter output even without `-s` specified.
6+
7+
8+
19
# 1.11.0
210

311
### Fixes

Diff for: include/internal/catch_version.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Catch {
3838
}
3939

4040
inline Version libraryVersion() {
41-
static Version version( 1, 11, 0, "", 0 );
41+
static Version version( 1, 12, 0, "", 0 );
4242
return version;
4343
}
4444

Diff for: single_include/catch.hpp

+137-64
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Catch v1.11.0
3-
* Generated: 2017-10-31 13:42:42.914833
2+
* Catch v1.12.0
3+
* Generated: 2018-01-11 21:56:34.893972
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.
@@ -1320,10 +1320,12 @@ namespace Internal {
13201320
template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } };
13211321

13221322
template<typename T>
1323-
T& removeConst(T const &t) { return const_cast<T&>(t); }
1323+
T& opCast(T const& t) { return const_cast<T&>(t); }
1324+
1325+
// nullptr_t support based on pull request #154 from Konstantin Baumann
13241326
#ifdef CATCH_CONFIG_CPP11_NULLPTR
1325-
inline std::nullptr_t removeConst(std::nullptr_t) { return nullptr; }
1326-
#endif
1327+
inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
1328+
#endif // CATCH_CONFIG_CPP11_NULLPTR
13271329

13281330
// So the compare overloads can be operator agnostic we convey the operator as a template
13291331
// enum, which is used to specialise an Evaluator for doing the comparison.
@@ -1333,90 +1335,161 @@ namespace Internal {
13331335
template<typename T1, typename T2>
13341336
struct Evaluator<T1, T2, IsEqualTo> {
13351337
static bool evaluate( T1 const& lhs, T2 const& rhs) {
1336-
return bool(removeConst(lhs) == removeConst(rhs) );
1338+
return bool( opCast( lhs ) == opCast( rhs ) );
13371339
}
13381340
};
13391341
template<typename T1, typename T2>
13401342
struct Evaluator<T1, T2, IsNotEqualTo> {
13411343
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1342-
return bool(removeConst(lhs) != removeConst(rhs) );
1344+
return bool( opCast( lhs ) != opCast( rhs ) );
13431345
}
13441346
};
13451347
template<typename T1, typename T2>
13461348
struct Evaluator<T1, T2, IsLessThan> {
13471349
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1348-
return bool(removeConst(lhs) < removeConst(rhs) );
1350+
return bool( opCast( lhs ) < opCast( rhs ) );
13491351
}
13501352
};
13511353
template<typename T1, typename T2>
13521354
struct Evaluator<T1, T2, IsGreaterThan> {
13531355
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1354-
return bool(removeConst(lhs) > removeConst(rhs) );
1356+
return bool( opCast( lhs ) > opCast( rhs ) );
13551357
}
13561358
};
13571359
template<typename T1, typename T2>
13581360
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
13591361
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1360-
return bool(removeConst(lhs) >= removeConst(rhs) );
1362+
return bool( opCast( lhs ) >= opCast( rhs ) );
13611363
}
13621364
};
13631365
template<typename T1, typename T2>
13641366
struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
13651367
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1366-
return bool(removeConst(lhs) <= removeConst(rhs) );
1368+
return bool( opCast( lhs ) <= opCast( rhs ) );
13671369
}
13681370
};
13691371

1370-
// Special case for comparing a pointer to an int (deduced for p==0)
1371-
template<typename T>
1372-
struct Evaluator<int const&, T* const&, IsEqualTo> {
1373-
static bool evaluate( int lhs, T* rhs) {
1374-
return reinterpret_cast<void const*>( lhs ) == rhs;
1375-
}
1376-
};
1377-
template<typename T>
1378-
struct Evaluator<T* const&, int const&, IsEqualTo> {
1379-
static bool evaluate( T* lhs, int rhs) {
1380-
return lhs == reinterpret_cast<void const*>( rhs );
1381-
}
1382-
};
1383-
template<typename T>
1384-
struct Evaluator<int const&, T* const&, IsNotEqualTo> {
1385-
static bool evaluate( int lhs, T* rhs) {
1386-
return reinterpret_cast<void const*>( lhs ) != rhs;
1387-
}
1388-
};
1389-
template<typename T>
1390-
struct Evaluator<T* const&, int const&, IsNotEqualTo> {
1391-
static bool evaluate( T* lhs, int rhs) {
1392-
return lhs != reinterpret_cast<void const*>( rhs );
1393-
}
1394-
};
1372+
template<Operator Op, typename T1, typename T2>
1373+
bool applyEvaluator( T1 const& lhs, T2 const& rhs ) {
1374+
return Evaluator<T1, T2, Op>::evaluate( lhs, rhs );
1375+
}
13951376

1396-
template<typename T>
1397-
struct Evaluator<long const&, T* const&, IsEqualTo> {
1398-
static bool evaluate( long lhs, T* rhs) {
1399-
return reinterpret_cast<void const*>( lhs ) == rhs;
1400-
}
1401-
};
1402-
template<typename T>
1403-
struct Evaluator<T* const&, long const&, IsEqualTo> {
1404-
static bool evaluate( T* lhs, long rhs) {
1405-
return lhs == reinterpret_cast<void const*>( rhs );
1406-
}
1407-
};
1408-
template<typename T>
1409-
struct Evaluator<long const&, T* const&, IsNotEqualTo> {
1410-
static bool evaluate( long lhs, T* rhs) {
1411-
return reinterpret_cast<void const*>( lhs ) != rhs;
1412-
}
1413-
};
1414-
template<typename T>
1415-
struct Evaluator<T* const&, long const&, IsNotEqualTo> {
1416-
static bool evaluate( T* lhs, long rhs) {
1417-
return lhs != reinterpret_cast<void const*>( rhs );
1418-
}
1419-
};
1377+
// This level of indirection allows us to specialise for integer types
1378+
// to avoid signed/ unsigned warnings
1379+
1380+
// "base" overload
1381+
template<Operator Op, typename T1, typename T2>
1382+
bool compare( T1 const& lhs, T2 const& rhs ) {
1383+
return Evaluator<T1, T2, Op>::evaluate( lhs, rhs );
1384+
}
1385+
1386+
// unsigned X to int
1387+
template<Operator Op> bool compare( unsigned int lhs, int rhs ) {
1388+
return applyEvaluator<Op>( lhs, static_cast<unsigned int>( rhs ) );
1389+
}
1390+
template<Operator Op> bool compare( unsigned long lhs, int rhs ) {
1391+
return applyEvaluator<Op>( lhs, static_cast<unsigned int>( rhs ) );
1392+
}
1393+
template<Operator Op> bool compare( unsigned char lhs, int rhs ) {
1394+
return applyEvaluator<Op>( lhs, static_cast<unsigned int>( rhs ) );
1395+
}
1396+
1397+
// unsigned X to long
1398+
template<Operator Op> bool compare( unsigned int lhs, long rhs ) {
1399+
return applyEvaluator<Op>( lhs, static_cast<unsigned long>( rhs ) );
1400+
}
1401+
template<Operator Op> bool compare( unsigned long lhs, long rhs ) {
1402+
return applyEvaluator<Op>( lhs, static_cast<unsigned long>( rhs ) );
1403+
}
1404+
template<Operator Op> bool compare( unsigned char lhs, long rhs ) {
1405+
return applyEvaluator<Op>( lhs, static_cast<unsigned long>( rhs ) );
1406+
}
1407+
1408+
// int to unsigned X
1409+
template<Operator Op> bool compare( int lhs, unsigned int rhs ) {
1410+
return applyEvaluator<Op>( static_cast<unsigned int>( lhs ), rhs );
1411+
}
1412+
template<Operator Op> bool compare( int lhs, unsigned long rhs ) {
1413+
return applyEvaluator<Op>( static_cast<unsigned int>( lhs ), rhs );
1414+
}
1415+
template<Operator Op> bool compare( int lhs, unsigned char rhs ) {
1416+
return applyEvaluator<Op>( static_cast<unsigned int>( lhs ), rhs );
1417+
}
1418+
1419+
// long to unsigned X
1420+
template<Operator Op> bool compare( long lhs, unsigned int rhs ) {
1421+
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
1422+
}
1423+
template<Operator Op> bool compare( long lhs, unsigned long rhs ) {
1424+
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
1425+
}
1426+
template<Operator Op> bool compare( long lhs, unsigned char rhs ) {
1427+
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
1428+
}
1429+
1430+
// pointer to long (when comparing against NULL)
1431+
template<Operator Op, typename T> bool compare( long lhs, T* rhs ) {
1432+
return Evaluator<T*, T*, Op>::evaluate( reinterpret_cast<T*>( lhs ), rhs );
1433+
}
1434+
template<Operator Op, typename T> bool compare( T* lhs, long rhs ) {
1435+
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
1436+
}
1437+
1438+
// pointer to int (when comparing against NULL)
1439+
template<Operator Op, typename T> bool compare( int lhs, T* rhs ) {
1440+
return Evaluator<T*, T*, Op>::evaluate( reinterpret_cast<T*>( lhs ), rhs );
1441+
}
1442+
template<Operator Op, typename T> bool compare( T* lhs, int rhs ) {
1443+
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
1444+
}
1445+
1446+
#ifdef CATCH_CONFIG_CPP11_LONG_LONG
1447+
// long long to unsigned X
1448+
template<Operator Op> bool compare( long long lhs, unsigned int rhs ) {
1449+
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
1450+
}
1451+
template<Operator Op> bool compare( long long lhs, unsigned long rhs ) {
1452+
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
1453+
}
1454+
template<Operator Op> bool compare( long long lhs, unsigned long long rhs ) {
1455+
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
1456+
}
1457+
template<Operator Op> bool compare( long long lhs, unsigned char rhs ) {
1458+
return applyEvaluator<Op>( static_cast<unsigned long>( lhs ), rhs );
1459+
}
1460+
1461+
// unsigned long long to X
1462+
template<Operator Op> bool compare( unsigned long long lhs, int rhs ) {
1463+
return applyEvaluator<Op>( static_cast<long>( lhs ), rhs );
1464+
}
1465+
template<Operator Op> bool compare( unsigned long long lhs, long rhs ) {
1466+
return applyEvaluator<Op>( static_cast<long>( lhs ), rhs );
1467+
}
1468+
template<Operator Op> bool compare( unsigned long long lhs, long long rhs ) {
1469+
return applyEvaluator<Op>( static_cast<long>( lhs ), rhs );
1470+
}
1471+
template<Operator Op> bool compare( unsigned long long lhs, char rhs ) {
1472+
return applyEvaluator<Op>( static_cast<long>( lhs ), rhs );
1473+
}
1474+
1475+
// pointer to long long (when comparing against NULL)
1476+
template<Operator Op, typename T> bool compare( long long lhs, T* rhs ) {
1477+
return Evaluator<T*, T*, Op>::evaluate( reinterpret_cast<T*>( lhs ), rhs );
1478+
}
1479+
template<Operator Op, typename T> bool compare( T* lhs, long long rhs ) {
1480+
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
1481+
}
1482+
#endif // CATCH_CONFIG_CPP11_LONG_LONG
1483+
1484+
#ifdef CATCH_CONFIG_CPP11_NULLPTR
1485+
// pointer to nullptr_t (when comparing against nullptr)
1486+
template<Operator Op, typename T> bool compare( std::nullptr_t, T* rhs ) {
1487+
return Evaluator<T*, T*, Op>::evaluate( nullptr, rhs );
1488+
}
1489+
template<Operator Op, typename T> bool compare( T* lhs, std::nullptr_t ) {
1490+
return Evaluator<T*, T*, Op>::evaluate( lhs, nullptr );
1491+
}
1492+
#endif // CATCH_CONFIG_CPP11_NULLPTR
14201493

14211494
} // end of namespace Internal
14221495
} // end of namespace Catch
@@ -1837,7 +1910,7 @@ class BinaryExpression : public DecomposedExpression {
18371910

18381911
void endExpression() const {
18391912
m_rb
1840-
.setResultType( Internal::Evaluator<LhsT, RhsT, Op>::evaluate( m_lhs, m_rhs ) )
1913+
.setResultType( Internal::compare<Op>( m_lhs, m_rhs ) )
18411914
.endExpression( *this );
18421915
}
18431916

@@ -8393,7 +8466,7 @@ namespace Catch {
83938466
}
83948467

83958468
inline Version libraryVersion() {
8396-
static Version version( 1, 11, 0, "", 0 );
8469+
static Version version( 1, 12, 0, "", 0 );
83978470
return version;
83988471
}
83998472

@@ -10207,12 +10280,12 @@ namespace Catch {
1020710280

1020810281
bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
1020910282

10210-
if( includeResults ) {
10283+
if( includeResults || result.getResultType() == ResultWas::Warning ) {
1021110284
// Print any info messages in <Info> tags.
1021210285
for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end();
1021310286
it != itEnd;
1021410287
++it ) {
10215-
if( it->type == ResultWas::Info ) {
10288+
if( it->type == ResultWas::Info && includeResults ) {
1021610289
m_xml.scopedElement( "Info" )
1021710290
.writeText( it->message );
1021810291
} else if ( it->type == ResultWas::Warning ) {

Diff for: test_package/conanfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CatchConanTest(ConanFile):
1010
settings = "os", "compiler", "arch", "build_type"
1111
username = getenv("CONAN_USERNAME", "philsquared")
1212
channel = getenv("CONAN_CHANNEL", "testing")
13-
requires = "Catch/1.11.0@%s/%s" % (username, channel)
13+
requires = "Catch/1.12.0@%s/%s" % (username, channel)
1414

1515
def build(self):
1616
cmake = CMake(self)

0 commit comments

Comments
 (0)