|
5 | 5 |
|
6 | 6 | // SPDX-License-Identifier: BSL-1.0
|
7 | 7 |
|
8 |
| -// Catch v3.5.2 |
9 |
| -// Generated: 2024-01-15 14:06:36.675713 |
| 8 | +// Catch v3.5.3 |
| 9 | +// Generated: 2024-03-01 22:05:56.038084 |
10 | 10 | // ----------------------------------------------------------
|
11 | 11 | // This file is an amalgamation of multiple different files.
|
12 | 12 | // You probably shouldn't edit it directly.
|
@@ -72,8 +72,8 @@ namespace Catch {
|
72 | 72 | FDuration mean = FDuration(0);
|
73 | 73 | int i = 0;
|
74 | 74 | for(auto it = first; it < last; ++it, ++i) {
|
75 |
| - samples.push_back(FDuration(*it)); |
76 |
| - mean += FDuration(*it); |
| 75 | + samples.push_back(*it); |
| 76 | + mean += *it; |
77 | 77 | }
|
78 | 78 | mean /= i;
|
79 | 79 |
|
@@ -432,7 +432,7 @@ namespace {
|
432 | 432 |
|
433 | 433 | namespace Catch {
|
434 | 434 | Approx::Approx(double value)
|
435 |
| - : m_epsilon(std::numeric_limits<float>::epsilon() * 100.) |
| 435 | + : m_epsilon(static_cast<double>(std::numeric_limits<float>::epsilon()) * 100.) |
436 | 436 | , m_margin(0.0)
|
437 | 437 | , m_scale(0.0)
|
438 | 438 | , m_value(value) {}
|
@@ -810,6 +810,7 @@ namespace Catch {
|
810 | 810 | m_messages.back().message += " := ";
|
811 | 811 | start = pos;
|
812 | 812 | }
|
| 813 | + default: ; // noop |
813 | 814 | }
|
814 | 815 | }
|
815 | 816 | assert(openings.empty() && "Mismatched openings");
|
@@ -1196,8 +1197,10 @@ namespace Catch {
|
1196 | 1197 | StringRef extractFilenamePart(StringRef filename) {
|
1197 | 1198 | size_t lastDot = filename.size();
|
1198 | 1199 | while(lastDot > 0 && filename[lastDot - 1] != '.') { --lastDot; }
|
1199 |
| - --lastDot; |
| 1200 | + // In theory we could have filename without any extension in it |
| 1201 | + if(lastDot == 0) { return StringRef(); } |
1200 | 1202 |
|
| 1203 | + --lastDot; |
1201 | 1204 | size_t nameStart = lastDot;
|
1202 | 1205 | while(nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') { --nameStart; }
|
1203 | 1206 |
|
@@ -1473,13 +1476,13 @@ namespace Catch {
|
1473 | 1476 | }
|
1474 | 1477 | } // end unnamed namespace
|
1475 | 1478 |
|
1476 |
| - std::string convertIntoString(StringRef string, bool escape_invisibles) { |
| 1479 | + std::string convertIntoString(StringRef string, bool escapeInvisibles) { |
1477 | 1480 | std::string ret;
|
1478 | 1481 | // This is enough for the "don't escape invisibles" case, and a good
|
1479 | 1482 | // lower bound on the "escape invisibles" case.
|
1480 | 1483 | ret.reserve(string.size() + 2);
|
1481 | 1484 |
|
1482 |
| - if(!escape_invisibles) { |
| 1485 | + if(!escapeInvisibles) { |
1483 | 1486 | ret += '"';
|
1484 | 1487 | ret += string;
|
1485 | 1488 | ret += '"';
|
@@ -1547,6 +1550,7 @@ namespace Catch {
|
1547 | 1550 | }
|
1548 | 1551 |
|
1549 | 1552 | std::string StringMaker<char*>::convert(char* str) {
|
| 1553 | + // NOLINT(readability-non-const-parameter) |
1550 | 1554 | if(str) { return Detail::convertIntoString(str); }
|
1551 | 1555 | else { return {"{null string}"}; }
|
1552 | 1556 | }
|
@@ -1617,7 +1621,7 @@ namespace Catch {
|
1617 | 1621 |
|
1618 | 1622 | std::string StringMaker<char>::convert(char c) { return ::Catch::Detail::stringify(static_cast<signed char>(c)); }
|
1619 | 1623 |
|
1620 |
| - std::string StringMaker<unsigned char>::convert(unsigned char c) { return ::Catch::Detail::stringify(static_cast<char>(c)); } |
| 1624 | + std::string StringMaker<unsigned char>::convert(unsigned char value) { return ::Catch::Detail::stringify(static_cast<char>(value)); } |
1621 | 1625 |
|
1622 | 1626 | int StringMaker<float>::precision = 5;
|
1623 | 1627 |
|
@@ -1699,7 +1703,7 @@ namespace Catch {
|
1699 | 1703 | }
|
1700 | 1704 |
|
1701 | 1705 | Version const& libraryVersion() {
|
1702 |
| - static Version version(3, 5, 2, "", 0); |
| 1706 | + static Version version(3, 5, 3, "", 0); |
1703 | 1707 | return version;
|
1704 | 1708 | }
|
1705 | 1709 | }
|
@@ -2253,7 +2257,7 @@ namespace Catch {
|
2253 | 2257 | while(std::getline(f, line)) {
|
2254 | 2258 | line = trim(line);
|
2255 | 2259 | if(!line.empty() && !startsWith(line, '#')) {
|
2256 |
| - if(!startsWith(line, '"')) line = '"' + line + '"'; |
| 2260 | + if(!startsWith(line, '"')) line = '"' + CATCH_MOVE(line) + '"'; |
2257 | 2261 | config.testsOrTags.push_back(line);
|
2258 | 2262 | config.testsOrTags.emplace_back(",");
|
2259 | 2263 | }
|
@@ -2572,22 +2576,22 @@ namespace Catch {
|
2572 | 2576 | } // end namespace Catch
|
2573 | 2577 |
|
2574 | 2578 | namespace Catch {
|
2575 |
| - Detail::unique_ptr<ColourImpl> makeColourImpl(ColourMode implSelection, IStream* stream) { |
| 2579 | + Detail::unique_ptr<ColourImpl> makeColourImpl(ColourMode colourSelection, IStream* stream) { |
2576 | 2580 | #if defined( CATCH_CONFIG_COLOUR_WIN32 )
|
2577 |
| - if(implSelection == ColourMode::Win32) { return Detail::make_unique<Win32ColourImpl>(stream); } |
| 2581 | + if(colourSelection == ColourMode::Win32) { return Detail::make_unique<Win32ColourImpl>(stream); } |
2578 | 2582 | #endif
|
2579 |
| - if(implSelection == ColourMode::ANSI) { return Detail::make_unique<ANSIColourImpl>(stream); } |
2580 |
| - if(implSelection == ColourMode::None) { return Detail::make_unique<NoColourImpl>(stream); } |
| 2583 | + if(colourSelection == ColourMode::ANSI) { return Detail::make_unique<ANSIColourImpl>(stream); } |
| 2584 | + if(colourSelection == ColourMode::None) { return Detail::make_unique<NoColourImpl>(stream); } |
2581 | 2585 |
|
2582 |
| - if(implSelection == ColourMode::PlatformDefault) { |
| 2586 | + if(colourSelection == ColourMode::PlatformDefault) { |
2583 | 2587 | #if defined( CATCH_CONFIG_COLOUR_WIN32 )
|
2584 | 2588 | if(Win32ColourImpl::useImplementationForStream(*stream)) { return Detail::make_unique<Win32ColourImpl>(stream); }
|
2585 | 2589 | #endif
|
2586 | 2590 | if(ANSIColourImpl::useImplementationForStream(*stream)) { return Detail::make_unique<ANSIColourImpl>(stream); }
|
2587 | 2591 | return Detail::make_unique<NoColourImpl>(stream);
|
2588 | 2592 | }
|
2589 | 2593 |
|
2590 |
| - CATCH_ERROR("Could not create colour impl for selection " << static_cast<int>(implSelection)); |
| 2594 | + CATCH_ERROR("Could not create colour impl for selection " << static_cast<int>(colourSelection)); |
2591 | 2595 | }
|
2592 | 2596 |
|
2593 | 2597 | bool isColourImplAvailable(ColourMode colourSelection) {
|
@@ -2772,7 +2776,11 @@ namespace Catch {
|
2772 | 2776 | #endif // Platform
|
2773 | 2777 |
|
2774 | 2778 | namespace Catch {
|
2775 |
| - ITransientExpression::~ITransientExpression() = default; |
| 2779 | + void ITransientExpression::streamReconstructedExpression(std::ostream& os) const { |
| 2780 | + // We can't make this function pure virtual to keep ITransientExpression |
| 2781 | + // constexpr, so we write error message instead |
| 2782 | + os << "Some class derived from ITransientExpression without overriding streamReconstructedExpression"; |
| 2783 | + } |
2776 | 2784 |
|
2777 | 2785 | void formatReconstructedExpression(std::ostream& os, std::string const& lhs, StringRef op, std::string const& rhs) {
|
2778 | 2786 | if(lhs.size() + rhs.size() < 40 && lhs.find('\n') == std::string::npos && rhs.find('\n') == std::string::npos) os << lhs << ' ' << op << ' ' << rhs;
|
@@ -3311,7 +3319,7 @@ namespace Catch {
|
3311 | 3319 | : m_os{os}
|
3312 | 3320 | , m_indent_level{indent_level} { m_os << '{'; }
|
3313 | 3321 |
|
3314 |
| - JsonObjectWriter::JsonObjectWriter(JsonObjectWriter&& source) |
| 3322 | + JsonObjectWriter::JsonObjectWriter(JsonObjectWriter&& source) noexcept |
3315 | 3323 | : m_os{source.m_os}
|
3316 | 3324 | , m_indent_level{source.m_indent_level}
|
3317 | 3325 | , m_should_comma{source.m_should_comma}
|
@@ -3339,7 +3347,7 @@ namespace Catch {
|
3339 | 3347 | : m_os{os}
|
3340 | 3348 | , m_indent_level{indent_level} { m_os << '['; }
|
3341 | 3349 |
|
3342 |
| - JsonArrayWriter::JsonArrayWriter(JsonArrayWriter&& source) |
| 3350 | + JsonArrayWriter::JsonArrayWriter(JsonArrayWriter&& source) noexcept |
3343 | 3351 | : m_os{source.m_os}
|
3344 | 3352 | , m_indent_level{source.m_indent_level}
|
3345 | 3353 | , m_should_comma{source.m_should_comma}
|
@@ -3923,7 +3931,10 @@ namespace Catch {
|
3923 | 3931 | auto kv = splitKVPair(parts[i]);
|
3924 | 3932 | auto key = kv.key, value = kv.value;
|
3925 | 3933 |
|
3926 |
| - if(key.empty() || value.empty()) { return {}; } |
| 3934 | + if(key.empty() || value.empty()) { |
| 3935 | + // NOLINT(bugprone-branch-clone) |
| 3936 | + return {}; |
| 3937 | + } |
3927 | 3938 | else if(key[0] == 'X') {
|
3928 | 3939 | // This is a reporter-specific option, we don't check these
|
3929 | 3940 | // apart from basic sanity checks
|
@@ -4703,15 +4714,24 @@ namespace Catch {
|
4703 | 4714 | }
|
4704 | 4715 |
|
4705 | 4716 | bool replaceInPlace(std::string& str, std::string const& replaceThis, std::string const& withThis) {
|
4706 |
| - bool replaced = false; |
4707 | 4717 | std::size_t i = str.find(replaceThis);
|
4708 |
| - while(i != std::string::npos) { |
4709 |
| - replaced = true; |
4710 |
| - str = str.substr(0, i) + withThis + str.substr(i + replaceThis.size()); |
4711 |
| - if(i < str.size() - withThis.size()) i = str.find(replaceThis, i + withThis.size()); |
| 4718 | + if(i == std::string::npos) { return false; } |
| 4719 | + std::size_t copyBegin = 0; |
| 4720 | + std::string origStr = CATCH_MOVE(str); |
| 4721 | + str.clear(); |
| 4722 | + // There is at least one replacement, so reserve with the best guess |
| 4723 | + // we can make without actually counting the number of occurences. |
| 4724 | + str.reserve(origStr.size() - replaceThis.size() + withThis.size()); |
| 4725 | + do { |
| 4726 | + str.append(origStr, copyBegin, i - copyBegin); |
| 4727 | + str += withThis; |
| 4728 | + copyBegin = i + replaceThis.size(); |
| 4729 | + if(copyBegin < origStr.size()) i = origStr.find(replaceThis, copyBegin); |
4712 | 4730 | else i = std::string::npos;
|
4713 | 4731 | }
|
4714 |
| - return replaced; |
| 4732 | + while(i != std::string::npos); |
| 4733 | + if(copyBegin < origStr.size()) { str.append(origStr, copyBegin, origStr.size()); } |
| 4734 | + return true; |
4715 | 4735 | }
|
4716 | 4736 |
|
4717 | 4737 | std::vector<StringRef> splitStringRef(StringRef str, char delimiter) {
|
@@ -6875,8 +6895,8 @@ namespace Catch {
|
6875 | 6895 | StreamingReporterBase::testRunEnded(_testRunStats);
|
6876 | 6896 | }
|
6877 | 6897 |
|
6878 |
| - void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) { |
6879 |
| - StreamingReporterBase::testRunStarting(_testInfo); |
| 6898 | + void ConsoleReporter::testRunStarting(TestRunInfo const& _testRunInfo) { |
| 6899 | + StreamingReporterBase::testRunStarting(_testRunInfo); |
6880 | 6900 | if(m_config->testSpec().hasFilters()) { m_stream << m_colour->guardColour(Colour::BrightYellow) << "Filters: " << m_config->testSpec() << '\n'; }
|
6881 | 6901 | m_stream << "Randomness seeded to: " << getSeed() << '\n';
|
6882 | 6902 | }
|
@@ -6993,8 +7013,7 @@ namespace Catch {
|
6993 | 7013 | BySectionInfo(SectionInfo const& other)
|
6994 | 7014 | : m_other(other) {}
|
6995 | 7015 |
|
6996 |
| - BySectionInfo(BySectionInfo const& other) |
6997 |
| - : m_other(other.m_other) {} |
| 7016 | + BySectionInfo(BySectionInfo const& other) = default; |
6998 | 7017 |
|
6999 | 7018 | bool operator()(Detail::unique_ptr<CumulativeReporterBase::SectionNode> const& node) const { return ((node->stats.sectionInfo.name == m_other.name) && (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); }
|
7000 | 7019 |
|
@@ -7455,8 +7474,8 @@ namespace Catch {
|
7455 | 7474 |
|
7456 | 7475 | std::string JsonReporter::getDescription() { return "Outputs listings as JSON. Test listing is Work-in-Progress!"; }
|
7457 | 7476 |
|
7458 |
| - void JsonReporter::testRunStarting(TestRunInfo const& testInfo) { |
7459 |
| - StreamingReporterBase::testRunStarting(testInfo); |
| 7477 | + void JsonReporter::testRunStarting(TestRunInfo const& runInfo) { |
| 7478 | + StreamingReporterBase::testRunStarting(runInfo); |
7460 | 7479 | endListing();
|
7461 | 7480 |
|
7462 | 7481 | assert(isInside( Writer::Object ));
|
@@ -7715,7 +7734,7 @@ namespace Catch {
|
7715 | 7734 |
|
7716 | 7735 | static void normalizeNamespaceMarkers(std::string& str) {
|
7717 | 7736 | std::size_t pos = str.find("::");
|
7718 |
| - while(pos != str.npos) { |
| 7737 | + while(pos != std::string::npos) { |
7719 | 7738 | str.replace(pos, 2, ".");
|
7720 | 7739 | pos += 1;
|
7721 | 7740 | pos = str.find("::", pos);
|
|
0 commit comments