Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/extras/catch_amalgamated.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2024-09-17 10:45:43 +0200
committerMartin Hořeňovský2024-09-17 10:45:43 +0200
commitfa43b77429ba76c462b1898d6cd2f2d7a9416b14 (patch)
treefa9c5c76ec061bd603214810100c8642613e8dd3 /extras/catch_amalgamated.cpp
parent79f2d66ea3f018c00ed78b1ed89806e6f86b1ef0 (diff)
downloadcatch3-3.7.1.tar.gz
v3.7.1v3.7.1
Diffstat (limited to 'extras/catch_amalgamated.cpp')
-rw-r--r--extras/catch_amalgamated.cpp128
1 files changed, 41 insertions, 87 deletions
diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp
index 4178e328..f45c18a0 100644
--- a/extras/catch_amalgamated.cpp
+++ b/extras/catch_amalgamated.cpp
@@ -6,8 +6,8 @@
// SPDX-License-Identifier: BSL-1.0
-// Catch v3.7.0
-// Generated: 2024-08-14 12:04:53.604337
+// Catch v3.7.1
+// Generated: 2024-09-17 10:36:45.608896
// ----------------------------------------------------------
// This file is an amalgamation of multiple different files.
// You probably shouldn't edit it directly.
@@ -627,7 +627,7 @@ std::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) {
namespace Catch {
- AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
+ AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const& _lazyExpression):
lazyExpression(_lazyExpression),
resultType(_resultType) {}
@@ -1170,7 +1170,13 @@ namespace Catch {
namespace Catch {
namespace {
- const int MaxExitCode = 255;
+ static constexpr int TestFailureExitCode = 42;
+ static constexpr int UnspecifiedErrorExitCode = 1;
+ static constexpr int AllTestsSkippedExitCode = 4;
+ static constexpr int NoTestsRunExitCode = 2;
+ static constexpr int UnmatchedTestSpecExitCode = 3;
+ static constexpr int InvalidTestSpecExitCode = 5;
+
IEventListenerPtr createReporter(std::string const& reporterName, ReporterConfig&& config) {
auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, CATCH_MOVE(config));
@@ -1334,8 +1340,7 @@ namespace Catch {
}
int Session::applyCommandLine( int argc, char const * const * argv ) {
- if( m_startupExceptions )
- return 1;
+ if ( m_startupExceptions ) { return UnspecifiedErrorExitCode; }
auto result = m_cli.parse( Clara::Args( argc, argv ) );
@@ -1351,7 +1356,7 @@ namespace Catch {
<< TextFlow::Column( result.errorMessage() ).indent( 2 )
<< "\n\n";
errStream->stream() << "Run with -? for usage\n\n" << std::flush;
- return MaxExitCode;
+ return UnspecifiedErrorExitCode;
}
if( m_configData.showHelp )
@@ -1421,8 +1426,7 @@ namespace Catch {
}
int Session::runInternal() {
- if( m_startupExceptions )
- return 1;
+ if ( m_startupExceptions ) { return UnspecifiedErrorExitCode; }
if (m_configData.showHelp || m_configData.libIdentify) {
return 0;
@@ -1433,7 +1437,7 @@ namespace Catch {
<< ") must be greater than the shard index ("
<< m_configData.shardIndex << ")\n"
<< std::flush;
- return 1;
+ return UnspecifiedErrorExitCode;
}
CATCH_TRY {
@@ -1456,7 +1460,7 @@ namespace Catch {
for ( auto const& spec : invalidSpecs ) {
reporter->reportInvalidTestSpec( spec );
}
- return 1;
+ return InvalidTestSpecExitCode;
}
@@ -1470,29 +1474,29 @@ namespace Catch {
if ( tests.hadUnmatchedTestSpecs()
&& m_config->warnAboutUnmatchedTestSpecs() ) {
- return 3;
+ // UnmatchedTestSpecExitCode
+ return UnmatchedTestSpecExitCode;
}
if ( totals.testCases.total() == 0
&& !m_config->zeroTestsCountAsSuccess() ) {
- return 2;
+ return NoTestsRunExitCode;
}
if ( totals.testCases.total() > 0 &&
totals.testCases.total() == totals.testCases.skipped
&& !m_config->zeroTestsCountAsSuccess() ) {
- return 4;
+ return AllTestsSkippedExitCode;
}
- // Note that on unices only the lower 8 bits are usually used, clamping
- // the return value to 255 prevents false negative when some multiple
- // of 256 tests has failed
- return (std::min) (MaxExitCode, static_cast<int>(totals.assertions.failed));
+ if ( totals.assertions.failed ) { return TestFailureExitCode; }
+ return 0;
+
}
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
catch( std::exception& ex ) {
Catch::cerr() << ex.what() << '\n' << std::flush;
- return MaxExitCode;
+ return UnspecifiedErrorExitCode;
}
#endif
}
@@ -1528,26 +1532,26 @@ namespace Catch {
static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type),
"The size of the TestCaseProperties is different from the assumed size");
- TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) {
+ constexpr TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) {
return static_cast<TestCaseProperties>(
static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)
);
}
- TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) {
+ constexpr TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) {
lhs = static_cast<TestCaseProperties>(
static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)
);
return lhs;
}
- TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) {
+ constexpr TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) {
return static_cast<TestCaseProperties>(
static_cast<TCP_underlying_type>(lhs) & static_cast<TCP_underlying_type>(rhs)
);
}
- bool applies(TestCaseProperties tcp) {
+ constexpr bool applies(TestCaseProperties tcp) {
static_assert(static_cast<TCP_underlying_type>(TestCaseProperties::None) == 0,
"TestCaseProperties::None must be equal to 0");
return tcp != TestCaseProperties::None;
@@ -1586,7 +1590,7 @@ namespace Catch {
return "Anonymous test case " + std::to_string(++counter);
}
- StringRef extractFilenamePart(StringRef filename) {
+ constexpr StringRef extractFilenamePart(StringRef filename) {
size_t lastDot = filename.size();
while (lastDot > 0 && filename[lastDot - 1] != '.') {
--lastDot;
@@ -1604,7 +1608,7 @@ namespace Catch {
}
// Returns the upper bound on size of extra tags ([#file]+[.])
- size_t sizeOfExtraTags(StringRef filepath) {
+ constexpr size_t sizeOfExtraTags(StringRef filepath) {
// [.] is 3, [#] is another 3
const size_t extras = 3 + 3;
return extractFilenamePart(filepath).size() + extras;
@@ -1765,10 +1769,6 @@ namespace Catch {
return lhs.tags < rhs.tags;
}
- TestCaseInfo const& TestCaseHandle::getTestCaseInfo() const {
- return *m_info;
- }
-
} // end namespace Catch
@@ -1909,7 +1909,7 @@ namespace Catch {
namespace {
static auto getCurrentNanosecondsSinceEpoch() -> uint64_t {
- return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
+ return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
}
} // end unnamed namespace
@@ -2280,7 +2280,7 @@ namespace Catch {
}
Version const& libraryVersion() {
- static Version version( 3, 7, 0, "", 0 );
+ static Version version( 3, 7, 1, "", 0 );
return version;
}
@@ -2536,8 +2536,8 @@ namespace Catch {
void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
}
- void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef message) {
- m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
+ void AssertionHandler::handleMessage(ResultWas::OfType resultType, std::string&& message) {
+ m_resultCapture.handleMessage( m_assertionInfo, resultType, CATCH_MOVE(message), m_reaction );
}
auto AssertionHandler::allowThrows() const -> bool {
@@ -2683,7 +2683,7 @@ namespace Catch {
{ TokenType::Argument,
next.substr( delimiterPos + 1, next.size() ) } );
} else {
- if ( next[1] != '-' && next.size() > 2 ) {
+ if ( next.size() > 1 && next[1] != '-' && next.size() > 2 ) {
// Combined short args, e.g. "-ab" for "-a -b"
for ( size_t i = 1; i < next.size(); ++i ) {
m_tokenBuffer.push_back(
@@ -3656,12 +3656,6 @@ namespace Catch {
return *Context::currentContext;
}
- void Context::setResultCapture( IResultCapture* resultCapture ) {
- m_resultCapture = resultCapture;
- }
-
- void Context::setConfig( IConfig const* config ) { m_config = config; }
-
SimplePcg32& sharedRng() {
static SimplePcg32 s_rng;
return s_rng;
@@ -5547,26 +5541,6 @@ ReporterSpec::ReporterSpec(
-namespace Catch {
-
- bool isOk( ResultWas::OfType resultType ) {
- return ( resultType & ResultWas::FailureBit ) == 0;
- }
- bool isJustInfo( int flags ) {
- return flags == ResultWas::Info;
- }
-
- ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {
- return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );
- }
-
- bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }
- bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; }
-
-} // end namespace Catch
-
-
-
#include <cstdio>
#include <sstream>
#include <vector>
@@ -6232,13 +6206,13 @@ namespace Catch {
void RunContext::handleMessage(
AssertionInfo const& info,
ResultWas::OfType resultType,
- StringRef message,
+ std::string&& message,
AssertionReaction& reaction
) {
m_lastAssertionInfo = info;
AssertionResultData data( resultType, LazyExpression( false ) );
- data.message = static_cast<std::string>(message);
+ data.message = CATCH_MOVE( message );
AssertionResult assertionResult{ m_lastAssertionInfo,
CATCH_MOVE( data ) };
@@ -7153,7 +7127,7 @@ namespace Catch {
TestType m_testAsFunction;
public:
- TestInvokerAsFunction( TestType testAsFunction ) noexcept:
+ constexpr TestInvokerAsFunction( TestType testAsFunction ) noexcept:
m_testAsFunction( testAsFunction ) {}
void invoke() const override { m_testAsFunction(); }
@@ -7888,36 +7862,16 @@ namespace {
os.flags(f);
}
- bool shouldNewline(XmlFormatting fmt) {
+ constexpr bool shouldNewline(XmlFormatting fmt) {
return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Newline));
}
- bool shouldIndent(XmlFormatting fmt) {
+ constexpr bool shouldIndent(XmlFormatting fmt) {
return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Indent));
}
} // anonymous namespace
- XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) {
- return static_cast<XmlFormatting>(
- static_cast<std::underlying_type_t<XmlFormatting>>(lhs) |
- static_cast<std::underlying_type_t<XmlFormatting>>(rhs)
- );
- }
-
- XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) {
- return static_cast<XmlFormatting>(
- static_cast<std::underlying_type_t<XmlFormatting>>(lhs) &
- static_cast<std::underlying_type_t<XmlFormatting>>(rhs)
- );
- }
-
-
- XmlEncode::XmlEncode( StringRef str, ForWhat forWhat )
- : m_str( str ),
- m_forWhat( forWhat )
- {}
-
void XmlEncode::encodeTo( std::ostream& os ) const {
// Apostrophe escaping not necessary if we always use " to write attributes
// (see: http://www.w3.org/TR/xml/#syntax)
@@ -11050,9 +11004,9 @@ namespace Catch {
if (!rootName.empty())
name = rootName + '/' + name;
- if ( sectionNode.hasAnyAssertions()
+ if ( sectionNode.stats.assertions.total() > 0
|| !sectionNode.stdOut.empty()
- || !sectionNode.stdErr.empty() ) {
+ || !sectionNode.stdErr.empty() ) {
XmlWriter::ScopedElement e = xml.scopedElement("testCase");
xml.writeAttribute("name"_sr, name);
xml.writeAttribute("duration"_sr, static_cast<long>(sectionNode.stats.durationInSeconds * 1000));