6
6
7
7
// SPDX-License-Identifier: BSL-1.0
8
8
9
- // Catch v3.5.2
10
- // Generated: 2024-01-15 14:06:36.675713
9
+ // Catch v3.5.3
10
+ // Generated: 2024-03-01 22:05:56.038084
11
11
// ----------------------------------------------------------
12
12
// This file is an amalgamation of multiple different files.
13
13
// You probably shouldn't edit it directly.
@@ -101,8 +101,8 @@ namespace Catch {
101
101
FDuration mean = FDuration (0 );
102
102
int i = 0 ;
103
103
for (auto it = first; it < last; ++it, ++i) {
104
- samples.push_back (FDuration ( *it) );
105
- mean += FDuration ( *it) ;
104
+ samples.push_back (*it);
105
+ mean += *it;
106
106
}
107
107
mean /= i;
108
108
@@ -558,7 +558,7 @@ bool marginComparison(double lhs, double rhs, double margin) {
558
558
namespace Catch {
559
559
560
560
Approx::Approx ( double value )
561
- : m_epsilon( std::numeric_limits<float >::epsilon()*100 . ),
561
+ : m_epsilon( static_cast < double >( std::numeric_limits<float >::epsilon() )*100 . ),
562
562
m_margin ( 0.0 ),
563
563
m_scale( 0.0 ),
564
564
m_value( value )
@@ -1038,6 +1038,7 @@ namespace Catch {
1038
1038
m_messages.back ().message += " := " ;
1039
1039
start = pos;
1040
1040
}
1041
+ default :; // noop
1041
1042
}
1042
1043
}
1043
1044
assert (openings.empty () && " Mismatched openings" );
@@ -1581,8 +1582,10 @@ namespace Catch {
1581
1582
while (lastDot > 0 && filename[lastDot - 1 ] != ' .' ) {
1582
1583
--lastDot;
1583
1584
}
1584
- --lastDot;
1585
+ // In theory we could have filename without any extension in it
1586
+ if ( lastDot == 0 ) { return StringRef (); }
1585
1587
1588
+ --lastDot;
1586
1589
size_t nameStart = lastDot;
1587
1590
while (nameStart > 0 && filename[nameStart - 1 ] != ' /' && filename[nameStart - 1 ] != ' \\ ' ) {
1588
1591
--nameStart;
@@ -1966,13 +1969,13 @@ namespace Detail {
1966
1969
}
1967
1970
} // end unnamed namespace
1968
1971
1969
- std::string convertIntoString (StringRef string, bool escape_invisibles ) {
1972
+ std::string convertIntoString (StringRef string, bool escapeInvisibles ) {
1970
1973
std::string ret;
1971
1974
// This is enough for the "don't escape invisibles" case, and a good
1972
1975
// lower bound on the "escape invisibles" case.
1973
1976
ret.reserve (string.size () + 2 );
1974
1977
1975
- if (!escape_invisibles ) {
1978
+ if (!escapeInvisibles ) {
1976
1979
ret += ' "' ;
1977
1980
ret += string;
1978
1981
ret += ' "' ;
@@ -2050,7 +2053,7 @@ std::string StringMaker<char const*>::convert(char const* str) {
2050
2053
return { " {null string}" };
2051
2054
}
2052
2055
}
2053
- std::string StringMaker<char *>::convert(char * str) {
2056
+ std::string StringMaker<char *>::convert(char * str) { // NOLINT(readability-non-const-parameter)
2054
2057
if (str) {
2055
2058
return Detail::convertIntoString ( str );
2056
2059
} else {
@@ -2147,8 +2150,8 @@ std::string StringMaker<signed char>::convert(signed char value) {
2147
2150
std::string StringMaker<char >::convert(char c) {
2148
2151
return ::Catch::Detail::stringify (static_cast <signed char >(c));
2149
2152
}
2150
- std::string StringMaker<unsigned char >::convert(unsigned char c ) {
2151
- return ::Catch::Detail::stringify (static_cast <char >(c ));
2153
+ std::string StringMaker<unsigned char >::convert(unsigned char value ) {
2154
+ return ::Catch::Detail::stringify (static_cast <char >(value ));
2152
2155
}
2153
2156
2154
2157
int StringMaker<float >::precision = 5 ;
@@ -2268,7 +2271,7 @@ namespace Catch {
2268
2271
}
2269
2272
2270
2273
Version const & libraryVersion () {
2271
- static Version version ( 3 , 5 , 2 , " " , 0 );
2274
+ static Version version ( 3 , 5 , 3 , " " , 0 );
2272
2275
return version;
2273
2276
}
2274
2277
@@ -3092,7 +3095,7 @@ namespace Catch {
3092
3095
line = trim (line);
3093
3096
if ( !line.empty () && !startsWith ( line, ' #' ) ) {
3094
3097
if ( !startsWith ( line, ' "' ) )
3095
- line = ' "' + line + ' "' ;
3098
+ line = ' "' + CATCH_MOVE ( line) + ' "' ;
3096
3099
config.testsOrTags .push_back ( line );
3097
3100
config.testsOrTags .emplace_back ( " ," );
3098
3101
}
@@ -3573,21 +3576,21 @@ namespace {
3573
3576
3574
3577
namespace Catch {
3575
3578
3576
- Detail::unique_ptr<ColourImpl> makeColourImpl ( ColourMode implSelection ,
3579
+ Detail::unique_ptr<ColourImpl> makeColourImpl ( ColourMode colourSelection ,
3577
3580
IStream* stream ) {
3578
3581
#if defined( CATCH_CONFIG_COLOUR_WIN32 )
3579
- if ( implSelection == ColourMode::Win32 ) {
3582
+ if ( colourSelection == ColourMode::Win32 ) {
3580
3583
return Detail::make_unique<Win32ColourImpl>( stream );
3581
3584
}
3582
3585
#endif
3583
- if ( implSelection == ColourMode::ANSI ) {
3586
+ if ( colourSelection == ColourMode::ANSI ) {
3584
3587
return Detail::make_unique<ANSIColourImpl>( stream );
3585
3588
}
3586
- if ( implSelection == ColourMode::None ) {
3589
+ if ( colourSelection == ColourMode::None ) {
3587
3590
return Detail::make_unique<NoColourImpl>( stream );
3588
3591
}
3589
3592
3590
- if ( implSelection == ColourMode::PlatformDefault) {
3593
+ if ( colourSelection == ColourMode::PlatformDefault) {
3591
3594
#if defined( CATCH_CONFIG_COLOUR_WIN32 )
3592
3595
if ( Win32ColourImpl::useImplementationForStream ( *stream ) ) {
3593
3596
return Detail::make_unique<Win32ColourImpl>( stream );
@@ -3599,7 +3602,7 @@ namespace Catch {
3599
3602
return Detail::make_unique<NoColourImpl>( stream );
3600
3603
}
3601
3604
3602
- CATCH_ERROR ( " Could not create colour impl for selection " << static_cast <int >(implSelection ) );
3605
+ CATCH_ERROR ( " Could not create colour impl for selection " << static_cast <int >(colourSelection ) );
3603
3606
}
3604
3607
3605
3608
bool isColourImplAvailable ( ColourMode colourSelection ) {
@@ -3807,7 +3810,12 @@ namespace Catch {
3807
3810
3808
3811
namespace Catch {
3809
3812
3810
- ITransientExpression::~ITransientExpression () = default ;
3813
+ void ITransientExpression::streamReconstructedExpression (
3814
+ std::ostream& os ) const {
3815
+ // We can't make this function pure virtual to keep ITransientExpression
3816
+ // constexpr, so we write error message instead
3817
+ os << " Some class derived from ITransientExpression without overriding streamReconstructedExpression" ;
3818
+ }
3811
3819
3812
3820
void formatReconstructedExpression ( std::ostream &os, std::string const & lhs, StringRef op, std::string const & rhs ) {
3813
3821
if ( lhs.size () + rhs.size () < 40 &&
@@ -4473,7 +4481,7 @@ namespace Catch {
4473
4481
m_os{ os }, m_indent_level{ indent_level } {
4474
4482
m_os << ' {' ;
4475
4483
}
4476
- JsonObjectWriter::JsonObjectWriter ( JsonObjectWriter&& source ):
4484
+ JsonObjectWriter::JsonObjectWriter ( JsonObjectWriter&& source ) noexcept :
4477
4485
m_os{ source.m_os },
4478
4486
m_indent_level{ source.m_indent_level },
4479
4487
m_should_comma{ source.m_should_comma },
@@ -4504,7 +4512,7 @@ namespace Catch {
4504
4512
m_os{ os }, m_indent_level{ indent_level } {
4505
4513
m_os << ' [' ;
4506
4514
}
4507
- JsonArrayWriter::JsonArrayWriter ( JsonArrayWriter&& source ):
4515
+ JsonArrayWriter::JsonArrayWriter ( JsonArrayWriter&& source ) noexcept :
4508
4516
m_os{ source.m_os },
4509
4517
m_indent_level{ source.m_indent_level },
4510
4518
m_should_comma{ source.m_should_comma },
@@ -5283,7 +5291,7 @@ namespace Catch {
5283
5291
auto kv = splitKVPair ( parts[i] );
5284
5292
auto key = kv.key , value = kv.value ;
5285
5293
5286
- if ( key.empty () || value.empty () ) {
5294
+ if ( key.empty () || value.empty () ) { // NOLINT(bugprone-branch-clone)
5287
5295
return {};
5288
5296
} else if ( key[0 ] == ' X' ) {
5289
5297
// This is a reporter-specific option, we don't check these
@@ -6297,17 +6305,29 @@ namespace Catch {
6297
6305
}
6298
6306
6299
6307
bool replaceInPlace ( std::string& str, std::string const & replaceThis, std::string const & withThis ) {
6300
- bool replaced = false ;
6301
6308
std::size_t i = str.find ( replaceThis );
6302
- while ( i != std::string::npos ) {
6303
- replaced = true ;
6304
- str = str.substr ( 0 , i ) + withThis + str.substr ( i+replaceThis.size () );
6305
- if ( i < str.size ()-withThis.size () )
6306
- i = str.find ( replaceThis, i+withThis.size () );
6309
+ if (i == std::string::npos) {
6310
+ return false ;
6311
+ }
6312
+ std::size_t copyBegin = 0 ;
6313
+ std::string origStr = CATCH_MOVE (str);
6314
+ str.clear ();
6315
+ // There is at least one replacement, so reserve with the best guess
6316
+ // we can make without actually counting the number of occurences.
6317
+ str.reserve (origStr.size () - replaceThis.size () + withThis.size ());
6318
+ do {
6319
+ str.append (origStr, copyBegin, i-copyBegin );
6320
+ str += withThis;
6321
+ copyBegin = i + replaceThis.size ();
6322
+ if ( copyBegin < origStr.size () )
6323
+ i = origStr.find ( replaceThis, copyBegin );
6307
6324
else
6308
6325
i = std::string::npos;
6326
+ } while ( i != std::string::npos );
6327
+ if ( copyBegin < origStr.size () ) {
6328
+ str.append (origStr, copyBegin, origStr.size () );
6309
6329
}
6310
- return replaced ;
6330
+ return true ;
6311
6331
}
6312
6332
6313
6333
std::vector<StringRef> splitStringRef ( StringRef str, char delimiter ) {
@@ -9099,8 +9119,8 @@ void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
9099
9119
m_stream << ' \n ' << std::flush;
9100
9120
StreamingReporterBase::testRunEnded (_testRunStats);
9101
9121
}
9102
- void ConsoleReporter::testRunStarting (TestRunInfo const & _testInfo ) {
9103
- StreamingReporterBase::testRunStarting (_testInfo );
9122
+ void ConsoleReporter::testRunStarting (TestRunInfo const & _testRunInfo ) {
9123
+ StreamingReporterBase::testRunStarting (_testRunInfo );
9104
9124
if ( m_config->testSpec ().hasFilters () ) {
9105
9125
m_stream << m_colour->guardColour ( Colour::BrightYellow ) << " Filters: "
9106
9126
<< m_config->testSpec () << ' \n ' ;
@@ -9253,8 +9273,7 @@ namespace Catch {
9253
9273
namespace {
9254
9274
struct BySectionInfo {
9255
9275
BySectionInfo ( SectionInfo const & other ): m_other( other ) {}
9256
- BySectionInfo ( BySectionInfo const & other ):
9257
- m_other ( other.m_other ) {}
9276
+ BySectionInfo ( BySectionInfo const & other ) = default ;
9258
9277
bool operator ()(
9259
9278
Detail::unique_ptr<CumulativeReporterBase::SectionNode> const &
9260
9279
node ) const {
@@ -9879,8 +9898,8 @@ namespace Catch {
9879
9898
return " Outputs listings as JSON. Test listing is Work-in-Progress!" ;
9880
9899
}
9881
9900
9882
- void JsonReporter::testRunStarting ( TestRunInfo const & testInfo ) {
9883
- StreamingReporterBase::testRunStarting ( testInfo );
9901
+ void JsonReporter::testRunStarting ( TestRunInfo const & runInfo ) {
9902
+ StreamingReporterBase::testRunStarting ( runInfo );
9884
9903
endListing ();
9885
9904
9886
9905
assert ( isInside ( Writer::Object ) );
@@ -10178,7 +10197,7 @@ namespace Catch {
10178
10197
10179
10198
static void normalizeNamespaceMarkers (std::string& str) {
10180
10199
std::size_t pos = str.find ( " ::" );
10181
- while ( pos != str. npos ) {
10200
+ while ( pos != std::string:: npos ) {
10182
10201
str.replace ( pos, 2 , " ." );
10183
10202
pos += 1 ;
10184
10203
pos = str.find ( " ::" , pos );
0 commit comments