6
6
7
7
// SPDX-License-Identifier: BSL-1.0
8
8
9
- // Catch v3.7.0
10
- // Generated: 2024-08-14 12:04:53.604337
9
+ // Catch v3.7.1
10
+ // Generated: 2024-09-17 10:36:45.608896
11
11
// ----------------------------------------------------------
12
12
// This file is an amalgamation of multiple different files.
13
13
// You probably shouldn't edit it directly.
@@ -627,7 +627,7 @@ std::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) {
627
627
628
628
namespace Catch {
629
629
630
- AssertionResultData::AssertionResultData (ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
630
+ AssertionResultData::AssertionResultData (ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
631
631
lazyExpression (_lazyExpression),
632
632
resultType (_resultType) {}
633
633
@@ -1170,7 +1170,13 @@ namespace Catch {
1170
1170
namespace Catch {
1171
1171
1172
1172
namespace {
1173
- const int MaxExitCode = 255 ;
1173
+ static constexpr int TestFailureExitCode = 42 ;
1174
+ static constexpr int UnspecifiedErrorExitCode = 1 ;
1175
+ static constexpr int AllTestsSkippedExitCode = 4 ;
1176
+ static constexpr int NoTestsRunExitCode = 2 ;
1177
+ static constexpr int UnmatchedTestSpecExitCode = 3 ;
1178
+ static constexpr int InvalidTestSpecExitCode = 5 ;
1179
+
1174
1180
1175
1181
IEventListenerPtr createReporter (std::string const & reporterName, ReporterConfig&& config) {
1176
1182
auto reporter = Catch::getRegistryHub ().getReporterRegistry ().create (reporterName, CATCH_MOVE (config));
@@ -1334,8 +1340,7 @@ namespace Catch {
1334
1340
}
1335
1341
1336
1342
int Session::applyCommandLine ( int argc, char const * const * argv ) {
1337
- if ( m_startupExceptions )
1338
- return 1 ;
1343
+ if ( m_startupExceptions ) { return UnspecifiedErrorExitCode; }
1339
1344
1340
1345
auto result = m_cli.parse ( Clara::Args ( argc, argv ) );
1341
1346
@@ -1351,7 +1356,7 @@ namespace Catch {
1351
1356
<< TextFlow::Column ( result.errorMessage () ).indent ( 2 )
1352
1357
<< " \n\n " ;
1353
1358
errStream->stream () << " Run with -? for usage\n\n " << std::flush;
1354
- return MaxExitCode ;
1359
+ return UnspecifiedErrorExitCode ;
1355
1360
}
1356
1361
1357
1362
if ( m_configData.showHelp )
@@ -1421,8 +1426,7 @@ namespace Catch {
1421
1426
}
1422
1427
1423
1428
int Session::runInternal () {
1424
- if ( m_startupExceptions )
1425
- return 1 ;
1429
+ if ( m_startupExceptions ) { return UnspecifiedErrorExitCode; }
1426
1430
1427
1431
if (m_configData.showHelp || m_configData.libIdentify ) {
1428
1432
return 0 ;
@@ -1433,7 +1437,7 @@ namespace Catch {
1433
1437
<< " ) must be greater than the shard index ("
1434
1438
<< m_configData.shardIndex << " )\n "
1435
1439
<< std::flush;
1436
- return 1 ;
1440
+ return UnspecifiedErrorExitCode ;
1437
1441
}
1438
1442
1439
1443
CATCH_TRY {
@@ -1456,7 +1460,7 @@ namespace Catch {
1456
1460
for ( auto const & spec : invalidSpecs ) {
1457
1461
reporter->reportInvalidTestSpec ( spec );
1458
1462
}
1459
- return 1 ;
1463
+ return InvalidTestSpecExitCode ;
1460
1464
}
1461
1465
1462
1466
@@ -1470,29 +1474,29 @@ namespace Catch {
1470
1474
1471
1475
if ( tests.hadUnmatchedTestSpecs ()
1472
1476
&& m_config->warnAboutUnmatchedTestSpecs () ) {
1473
- return 3 ;
1477
+ // UnmatchedTestSpecExitCode
1478
+ return UnmatchedTestSpecExitCode;
1474
1479
}
1475
1480
1476
1481
if ( totals.testCases .total () == 0
1477
1482
&& !m_config->zeroTestsCountAsSuccess () ) {
1478
- return 2 ;
1483
+ return NoTestsRunExitCode ;
1479
1484
}
1480
1485
1481
1486
if ( totals.testCases .total () > 0 &&
1482
1487
totals.testCases .total () == totals.testCases .skipped
1483
1488
&& !m_config->zeroTestsCountAsSuccess () ) {
1484
- return 4 ;
1489
+ return AllTestsSkippedExitCode ;
1485
1490
}
1486
1491
1487
- // Note that on unices only the lower 8 bits are usually used, clamping
1488
- // the return value to 255 prevents false negative when some multiple
1489
- // of 256 tests has failed
1490
- return (std::min) (MaxExitCode, static_cast <int >(totals.assertions .failed ));
1492
+ if ( totals.assertions .failed ) { return TestFailureExitCode; }
1493
+ return 0 ;
1494
+
1491
1495
}
1492
1496
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
1493
1497
catch ( std::exception& ex ) {
1494
1498
Catch::cerr () << ex.what () << ' \n ' << std::flush;
1495
- return MaxExitCode ;
1499
+ return UnspecifiedErrorExitCode ;
1496
1500
}
1497
1501
#endif
1498
1502
}
@@ -1528,26 +1532,26 @@ namespace Catch {
1528
1532
static_assert (sizeof (TestCaseProperties) == sizeof (TCP_underlying_type),
1529
1533
" The size of the TestCaseProperties is different from the assumed size" );
1530
1534
1531
- TestCaseProperties operator |(TestCaseProperties lhs, TestCaseProperties rhs) {
1535
+ constexpr TestCaseProperties operator |(TestCaseProperties lhs, TestCaseProperties rhs) {
1532
1536
return static_cast <TestCaseProperties>(
1533
1537
static_cast <TCP_underlying_type>(lhs) | static_cast <TCP_underlying_type>(rhs)
1534
1538
);
1535
1539
}
1536
1540
1537
- TestCaseProperties& operator |=(TestCaseProperties& lhs, TestCaseProperties rhs) {
1541
+ constexpr TestCaseProperties& operator |=(TestCaseProperties& lhs, TestCaseProperties rhs) {
1538
1542
lhs = static_cast <TestCaseProperties>(
1539
1543
static_cast <TCP_underlying_type>(lhs) | static_cast <TCP_underlying_type>(rhs)
1540
1544
);
1541
1545
return lhs;
1542
1546
}
1543
1547
1544
- TestCaseProperties operator &(TestCaseProperties lhs, TestCaseProperties rhs) {
1548
+ constexpr TestCaseProperties operator &(TestCaseProperties lhs, TestCaseProperties rhs) {
1545
1549
return static_cast <TestCaseProperties>(
1546
1550
static_cast <TCP_underlying_type>(lhs) & static_cast <TCP_underlying_type>(rhs)
1547
1551
);
1548
1552
}
1549
1553
1550
- bool applies (TestCaseProperties tcp) {
1554
+ constexpr bool applies (TestCaseProperties tcp) {
1551
1555
static_assert (static_cast <TCP_underlying_type>(TestCaseProperties::None) == 0 ,
1552
1556
" TestCaseProperties::None must be equal to 0" );
1553
1557
return tcp != TestCaseProperties::None;
@@ -1586,7 +1590,7 @@ namespace Catch {
1586
1590
return " Anonymous test case " + std::to_string (++counter);
1587
1591
}
1588
1592
1589
- StringRef extractFilenamePart (StringRef filename) {
1593
+ constexpr StringRef extractFilenamePart (StringRef filename) {
1590
1594
size_t lastDot = filename.size ();
1591
1595
while (lastDot > 0 && filename[lastDot - 1 ] != ' .' ) {
1592
1596
--lastDot;
@@ -1604,7 +1608,7 @@ namespace Catch {
1604
1608
}
1605
1609
1606
1610
// Returns the upper bound on size of extra tags ([#file]+[.])
1607
- size_t sizeOfExtraTags (StringRef filepath) {
1611
+ constexpr size_t sizeOfExtraTags (StringRef filepath) {
1608
1612
// [.] is 3, [#] is another 3
1609
1613
const size_t extras = 3 + 3 ;
1610
1614
return extractFilenamePart (filepath).size () + extras;
@@ -1765,10 +1769,6 @@ namespace Catch {
1765
1769
return lhs.tags < rhs.tags ;
1766
1770
}
1767
1771
1768
- TestCaseInfo const & TestCaseHandle::getTestCaseInfo () const {
1769
- return *m_info;
1770
- }
1771
-
1772
1772
} // end namespace Catch
1773
1773
1774
1774
@@ -1909,7 +1909,7 @@ namespace Catch {
1909
1909
1910
1910
namespace {
1911
1911
static auto getCurrentNanosecondsSinceEpoch () -> uint64_t {
1912
- return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock ::now ().time_since_epoch ()).count ();
1912
+ return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock ::now ().time_since_epoch ()).count ();
1913
1913
}
1914
1914
} // end unnamed namespace
1915
1915
@@ -2280,7 +2280,7 @@ namespace Catch {
2280
2280
}
2281
2281
2282
2282
Version const & libraryVersion () {
2283
- static Version version ( 3 , 7 , 0 , " " , 0 );
2283
+ static Version version ( 3 , 7 , 1 , " " , 0 );
2284
2284
return version;
2285
2285
}
2286
2286
@@ -2536,8 +2536,8 @@ namespace Catch {
2536
2536
void AssertionHandler::handleExpr ( ITransientExpression const & expr ) {
2537
2537
m_resultCapture.handleExpr ( m_assertionInfo, expr, m_reaction );
2538
2538
}
2539
- void AssertionHandler::handleMessage (ResultWas::OfType resultType, StringRef message) {
2540
- m_resultCapture.handleMessage ( m_assertionInfo, resultType, message, m_reaction );
2539
+ void AssertionHandler::handleMessage (ResultWas::OfType resultType, std::string&& message) {
2540
+ m_resultCapture.handleMessage ( m_assertionInfo, resultType, CATCH_MOVE ( message) , m_reaction );
2541
2541
}
2542
2542
2543
2543
auto AssertionHandler::allowThrows () const -> bool {
@@ -2683,7 +2683,7 @@ namespace Catch {
2683
2683
{ TokenType::Argument,
2684
2684
next.substr ( delimiterPos + 1 , next.size () ) } );
2685
2685
} else {
2686
- if ( next[1 ] != ' -' && next.size () > 2 ) {
2686
+ if ( next. size () > 1 && next [1 ] != ' -' && next.size () > 2 ) {
2687
2687
// Combined short args, e.g. "-ab" for "-a -b"
2688
2688
for ( size_t i = 1 ; i < next.size (); ++i ) {
2689
2689
m_tokenBuffer.push_back (
@@ -3656,12 +3656,6 @@ namespace Catch {
3656
3656
return *Context::currentContext;
3657
3657
}
3658
3658
3659
- void Context::setResultCapture ( IResultCapture* resultCapture ) {
3660
- m_resultCapture = resultCapture;
3661
- }
3662
-
3663
- void Context::setConfig ( IConfig const * config ) { m_config = config; }
3664
-
3665
3659
SimplePcg32& sharedRng () {
3666
3660
static SimplePcg32 s_rng;
3667
3661
return s_rng;
@@ -5547,26 +5541,6 @@ ReporterSpec::ReporterSpec(
5547
5541
5548
5542
5549
5543
5550
- namespace Catch {
5551
-
5552
- bool isOk ( ResultWas::OfType resultType ) {
5553
- return ( resultType & ResultWas::FailureBit ) == 0 ;
5554
- }
5555
- bool isJustInfo ( int flags ) {
5556
- return flags == ResultWas::Info;
5557
- }
5558
-
5559
- ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {
5560
- return static_cast <ResultDisposition::Flags>( static_cast <int >( lhs ) | static_cast <int >( rhs ) );
5561
- }
5562
-
5563
- bool shouldContinueOnFailure ( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0 ; }
5564
- bool shouldSuppressFailure ( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0 ; }
5565
-
5566
- } // end namespace Catch
5567
-
5568
-
5569
-
5570
5544
#include < cstdio>
5571
5545
#include < sstream>
5572
5546
#include < vector>
@@ -6232,13 +6206,13 @@ namespace Catch {
6232
6206
void RunContext::handleMessage (
6233
6207
AssertionInfo const & info,
6234
6208
ResultWas::OfType resultType,
6235
- StringRef message,
6209
+ std::string&& message,
6236
6210
AssertionReaction& reaction
6237
6211
) {
6238
6212
m_lastAssertionInfo = info;
6239
6213
6240
6214
AssertionResultData data ( resultType, LazyExpression ( false ) );
6241
- data.message = static_cast <std::string>( message);
6215
+ data.message = CATCH_MOVE ( message );
6242
6216
AssertionResult assertionResult{ m_lastAssertionInfo,
6243
6217
CATCH_MOVE ( data ) };
6244
6218
@@ -7153,7 +7127,7 @@ namespace Catch {
7153
7127
TestType m_testAsFunction;
7154
7128
7155
7129
public:
7156
- TestInvokerAsFunction ( TestType testAsFunction ) noexcept :
7130
+ constexpr TestInvokerAsFunction ( TestType testAsFunction ) noexcept :
7157
7131
m_testAsFunction( testAsFunction ) {}
7158
7132
7159
7133
void invoke () const override { m_testAsFunction (); }
@@ -7888,36 +7862,16 @@ namespace {
7888
7862
os.flags (f);
7889
7863
}
7890
7864
7891
- bool shouldNewline (XmlFormatting fmt) {
7865
+ constexpr bool shouldNewline (XmlFormatting fmt) {
7892
7866
return !!(static_cast <std::underlying_type_t <XmlFormatting>>(fmt & XmlFormatting::Newline));
7893
7867
}
7894
7868
7895
- bool shouldIndent (XmlFormatting fmt) {
7869
+ constexpr bool shouldIndent (XmlFormatting fmt) {
7896
7870
return !!(static_cast <std::underlying_type_t <XmlFormatting>>(fmt & XmlFormatting::Indent));
7897
7871
}
7898
7872
7899
7873
} // anonymous namespace
7900
7874
7901
- XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) {
7902
- return static_cast <XmlFormatting>(
7903
- static_cast <std::underlying_type_t <XmlFormatting>>(lhs) |
7904
- static_cast <std::underlying_type_t <XmlFormatting>>(rhs)
7905
- );
7906
- }
7907
-
7908
- XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) {
7909
- return static_cast <XmlFormatting>(
7910
- static_cast <std::underlying_type_t <XmlFormatting>>(lhs) &
7911
- static_cast <std::underlying_type_t <XmlFormatting>>(rhs)
7912
- );
7913
- }
7914
-
7915
-
7916
- XmlEncode::XmlEncode ( StringRef str, ForWhat forWhat )
7917
- : m_str( str ),
7918
- m_forWhat ( forWhat )
7919
- {}
7920
-
7921
7875
void XmlEncode::encodeTo ( std::ostream& os ) const {
7922
7876
// Apostrophe escaping not necessary if we always use " to write attributes
7923
7877
// (see: http://www.w3.org/TR/xml/#syntax)
@@ -11050,9 +11004,9 @@ namespace Catch {
11050
11004
if (!rootName.empty ())
11051
11005
name = rootName + ' /' + name;
11052
11006
11053
- if ( sectionNode.hasAnyAssertions ()
11007
+ if ( sectionNode.stats . assertions . total () > 0
11054
11008
|| !sectionNode.stdOut .empty ()
11055
- || !sectionNode.stdErr .empty () ) {
11009
+ || !sectionNode.stdErr .empty () ) {
11056
11010
XmlWriter::ScopedElement e = xml.scopedElement (" testCase" );
11057
11011
xml.writeAttribute (" name" _sr, name);
11058
11012
xml.writeAttribute (" duration" _sr, static_cast <long >(sectionNode.stats .durationInSeconds * 1000 ));
0 commit comments