1
1
/*
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
4
4
* ----------------------------------------------------------
5
5
* This file has been merged from multiple headers. Please don't edit it directly
6
6
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -1320,10 +1320,12 @@ namespace Internal {
1320
1320
template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } };
1321
1321
1322
1322
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
1324
1326
#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
1327
1329
1328
1330
// So the compare overloads can be operator agnostic we convey the operator as a template
1329
1331
// enum, which is used to specialise an Evaluator for doing the comparison.
@@ -1333,90 +1335,161 @@ namespace Internal {
1333
1335
template<typename T1, typename T2>
1334
1336
struct Evaluator<T1, T2, IsEqualTo> {
1335
1337
static bool evaluate( T1 const& lhs, T2 const& rhs) {
1336
- return bool(removeConst( lhs) == removeConst( rhs) );
1338
+ return bool( opCast( lhs ) == opCast( rhs ) );
1337
1339
}
1338
1340
};
1339
1341
template<typename T1, typename T2>
1340
1342
struct Evaluator<T1, T2, IsNotEqualTo> {
1341
1343
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1342
- return bool(removeConst( lhs) != removeConst( rhs) );
1344
+ return bool( opCast( lhs ) != opCast( rhs ) );
1343
1345
}
1344
1346
};
1345
1347
template<typename T1, typename T2>
1346
1348
struct Evaluator<T1, T2, IsLessThan> {
1347
1349
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1348
- return bool(removeConst( lhs) < removeConst( rhs) );
1350
+ return bool( opCast( lhs ) < opCast( rhs ) );
1349
1351
}
1350
1352
};
1351
1353
template<typename T1, typename T2>
1352
1354
struct Evaluator<T1, T2, IsGreaterThan> {
1353
1355
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1354
- return bool(removeConst( lhs) > removeConst( rhs) );
1356
+ return bool( opCast( lhs ) > opCast( rhs ) );
1355
1357
}
1356
1358
};
1357
1359
template<typename T1, typename T2>
1358
1360
struct Evaluator<T1, T2, IsGreaterThanOrEqualTo> {
1359
1361
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1360
- return bool(removeConst( lhs) >= removeConst( rhs) );
1362
+ return bool( opCast( lhs ) >= opCast( rhs ) );
1361
1363
}
1362
1364
};
1363
1365
template<typename T1, typename T2>
1364
1366
struct Evaluator<T1, T2, IsLessThanOrEqualTo> {
1365
1367
static bool evaluate( T1 const& lhs, T2 const& rhs ) {
1366
- return bool(removeConst( lhs) <= removeConst( rhs) );
1368
+ return bool( opCast( lhs ) <= opCast( rhs ) );
1367
1369
}
1368
1370
};
1369
1371
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
+ }
1395
1376
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
1420
1493
1421
1494
} // end of namespace Internal
1422
1495
} // end of namespace Catch
@@ -1837,7 +1910,7 @@ class BinaryExpression : public DecomposedExpression {
1837
1910
1838
1911
void endExpression() const {
1839
1912
m_rb
1840
- .setResultType( Internal::Evaluator<LhsT, RhsT, Op>::evaluate ( m_lhs, m_rhs ) )
1913
+ .setResultType( Internal::compare< Op>( m_lhs, m_rhs ) )
1841
1914
.endExpression( *this );
1842
1915
}
1843
1916
@@ -8393,7 +8466,7 @@ namespace Catch {
8393
8466
}
8394
8467
8395
8468
inline Version libraryVersion() {
8396
- static Version version( 1, 11 , 0, "", 0 );
8469
+ static Version version( 1, 12 , 0, "", 0 );
8397
8470
return version;
8398
8471
}
8399
8472
@@ -10207,12 +10280,12 @@ namespace Catch {
10207
10280
10208
10281
bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
10209
10282
10210
- if( includeResults ) {
10283
+ if( includeResults || result.getResultType() == ResultWas::Warning ) {
10211
10284
// Print any info messages in <Info> tags.
10212
10285
for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end();
10213
10286
it != itEnd;
10214
10287
++it ) {
10215
- if( it->type == ResultWas::Info ) {
10288
+ if( it->type == ResultWas::Info && includeResults ) {
10216
10289
m_xml.scopedElement( "Info" )
10217
10290
.writeText( it->message );
10218
10291
} else if ( it->type == ResultWas::Warning ) {
0 commit comments