mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-20 11:35:39 +02:00
v3.5.3
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
// Catch v3.5.2
|
||||
// Generated: 2024-01-15 14:06:36.675713
|
||||
// Catch v3.5.3
|
||||
// Generated: 2024-03-01 22:05:56.038084
|
||||
// ----------------------------------------------------------
|
||||
// This file is an amalgamation of multiple different files.
|
||||
// You probably shouldn't edit it directly.
|
||||
@@ -101,8 +101,8 @@ namespace Catch {
|
||||
FDuration mean = FDuration(0);
|
||||
int i = 0;
|
||||
for (auto it = first; it < last; ++it, ++i) {
|
||||
samples.push_back(FDuration(*it));
|
||||
mean += FDuration(*it);
|
||||
samples.push_back(*it);
|
||||
mean += *it;
|
||||
}
|
||||
mean /= i;
|
||||
|
||||
@@ -558,7 +558,7 @@ bool marginComparison(double lhs, double rhs, double margin) {
|
||||
namespace Catch {
|
||||
|
||||
Approx::Approx ( double value )
|
||||
: m_epsilon( std::numeric_limits<float>::epsilon()*100. ),
|
||||
: m_epsilon( static_cast<double>(std::numeric_limits<float>::epsilon())*100. ),
|
||||
m_margin( 0.0 ),
|
||||
m_scale( 0.0 ),
|
||||
m_value( value )
|
||||
@@ -1038,6 +1038,7 @@ namespace Catch {
|
||||
m_messages.back().message += " := ";
|
||||
start = pos;
|
||||
}
|
||||
default:; // noop
|
||||
}
|
||||
}
|
||||
assert(openings.empty() && "Mismatched openings");
|
||||
@@ -1581,8 +1582,10 @@ namespace Catch {
|
||||
while (lastDot > 0 && filename[lastDot - 1] != '.') {
|
||||
--lastDot;
|
||||
}
|
||||
--lastDot;
|
||||
// In theory we could have filename without any extension in it
|
||||
if ( lastDot == 0 ) { return StringRef(); }
|
||||
|
||||
--lastDot;
|
||||
size_t nameStart = lastDot;
|
||||
while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') {
|
||||
--nameStart;
|
||||
@@ -1966,13 +1969,13 @@ namespace Detail {
|
||||
}
|
||||
} // end unnamed namespace
|
||||
|
||||
std::string convertIntoString(StringRef string, bool escape_invisibles) {
|
||||
std::string convertIntoString(StringRef string, bool escapeInvisibles) {
|
||||
std::string ret;
|
||||
// This is enough for the "don't escape invisibles" case, and a good
|
||||
// lower bound on the "escape invisibles" case.
|
||||
ret.reserve(string.size() + 2);
|
||||
|
||||
if (!escape_invisibles) {
|
||||
if (!escapeInvisibles) {
|
||||
ret += '"';
|
||||
ret += string;
|
||||
ret += '"';
|
||||
@@ -2050,7 +2053,7 @@ std::string StringMaker<char const*>::convert(char const* str) {
|
||||
return{ "{null string}" };
|
||||
}
|
||||
}
|
||||
std::string StringMaker<char*>::convert(char* str) {
|
||||
std::string StringMaker<char*>::convert(char* str) { // NOLINT(readability-non-const-parameter)
|
||||
if (str) {
|
||||
return Detail::convertIntoString( str );
|
||||
} else {
|
||||
@@ -2147,8 +2150,8 @@ std::string StringMaker<signed char>::convert(signed char value) {
|
||||
std::string StringMaker<char>::convert(char c) {
|
||||
return ::Catch::Detail::stringify(static_cast<signed char>(c));
|
||||
}
|
||||
std::string StringMaker<unsigned char>::convert(unsigned char c) {
|
||||
return ::Catch::Detail::stringify(static_cast<char>(c));
|
||||
std::string StringMaker<unsigned char>::convert(unsigned char value) {
|
||||
return ::Catch::Detail::stringify(static_cast<char>(value));
|
||||
}
|
||||
|
||||
int StringMaker<float>::precision = 5;
|
||||
@@ -2268,7 +2271,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 3, 5, 2, "", 0 );
|
||||
static Version version( 3, 5, 3, "", 0 );
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -3092,7 +3095,7 @@ namespace Catch {
|
||||
line = trim(line);
|
||||
if( !line.empty() && !startsWith( line, '#' ) ) {
|
||||
if( !startsWith( line, '"' ) )
|
||||
line = '"' + line + '"';
|
||||
line = '"' + CATCH_MOVE(line) + '"';
|
||||
config.testsOrTags.push_back( line );
|
||||
config.testsOrTags.emplace_back( "," );
|
||||
}
|
||||
@@ -3573,21 +3576,21 @@ namespace {
|
||||
|
||||
namespace Catch {
|
||||
|
||||
Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode implSelection,
|
||||
Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode colourSelection,
|
||||
IStream* stream ) {
|
||||
#if defined( CATCH_CONFIG_COLOUR_WIN32 )
|
||||
if ( implSelection == ColourMode::Win32 ) {
|
||||
if ( colourSelection == ColourMode::Win32 ) {
|
||||
return Detail::make_unique<Win32ColourImpl>( stream );
|
||||
}
|
||||
#endif
|
||||
if ( implSelection == ColourMode::ANSI ) {
|
||||
if ( colourSelection == ColourMode::ANSI ) {
|
||||
return Detail::make_unique<ANSIColourImpl>( stream );
|
||||
}
|
||||
if ( implSelection == ColourMode::None ) {
|
||||
if ( colourSelection == ColourMode::None ) {
|
||||
return Detail::make_unique<NoColourImpl>( stream );
|
||||
}
|
||||
|
||||
if ( implSelection == ColourMode::PlatformDefault) {
|
||||
if ( colourSelection == ColourMode::PlatformDefault) {
|
||||
#if defined( CATCH_CONFIG_COLOUR_WIN32 )
|
||||
if ( Win32ColourImpl::useImplementationForStream( *stream ) ) {
|
||||
return Detail::make_unique<Win32ColourImpl>( stream );
|
||||
@@ -3599,7 +3602,7 @@ namespace Catch {
|
||||
return Detail::make_unique<NoColourImpl>( stream );
|
||||
}
|
||||
|
||||
CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(implSelection) );
|
||||
CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(colourSelection) );
|
||||
}
|
||||
|
||||
bool isColourImplAvailable( ColourMode colourSelection ) {
|
||||
@@ -3807,7 +3810,12 @@ namespace Catch {
|
||||
|
||||
namespace Catch {
|
||||
|
||||
ITransientExpression::~ITransientExpression() = default;
|
||||
void ITransientExpression::streamReconstructedExpression(
|
||||
std::ostream& os ) const {
|
||||
// We can't make this function pure virtual to keep ITransientExpression
|
||||
// constexpr, so we write error message instead
|
||||
os << "Some class derived from ITransientExpression without overriding streamReconstructedExpression";
|
||||
}
|
||||
|
||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
|
||||
if( lhs.size() + rhs.size() < 40 &&
|
||||
@@ -4473,7 +4481,7 @@ namespace Catch {
|
||||
m_os{ os }, m_indent_level{ indent_level } {
|
||||
m_os << '{';
|
||||
}
|
||||
JsonObjectWriter::JsonObjectWriter( JsonObjectWriter&& source ):
|
||||
JsonObjectWriter::JsonObjectWriter( JsonObjectWriter&& source ) noexcept:
|
||||
m_os{ source.m_os },
|
||||
m_indent_level{ source.m_indent_level },
|
||||
m_should_comma{ source.m_should_comma },
|
||||
@@ -4504,7 +4512,7 @@ namespace Catch {
|
||||
m_os{ os }, m_indent_level{ indent_level } {
|
||||
m_os << '[';
|
||||
}
|
||||
JsonArrayWriter::JsonArrayWriter( JsonArrayWriter&& source ):
|
||||
JsonArrayWriter::JsonArrayWriter( JsonArrayWriter&& source ) noexcept:
|
||||
m_os{ source.m_os },
|
||||
m_indent_level{ source.m_indent_level },
|
||||
m_should_comma{ source.m_should_comma },
|
||||
@@ -5283,7 +5291,7 @@ namespace Catch {
|
||||
auto kv = splitKVPair( parts[i] );
|
||||
auto key = kv.key, value = kv.value;
|
||||
|
||||
if ( key.empty() || value.empty() ) {
|
||||
if ( key.empty() || value.empty() ) { // NOLINT(bugprone-branch-clone)
|
||||
return {};
|
||||
} else if ( key[0] == 'X' ) {
|
||||
// This is a reporter-specific option, we don't check these
|
||||
@@ -6297,17 +6305,29 @@ namespace Catch {
|
||||
}
|
||||
|
||||
bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
|
||||
bool replaced = false;
|
||||
std::size_t i = str.find( replaceThis );
|
||||
while( i != std::string::npos ) {
|
||||
replaced = true;
|
||||
str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
|
||||
if( i < str.size()-withThis.size() )
|
||||
i = str.find( replaceThis, i+withThis.size() );
|
||||
if (i == std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
std::size_t copyBegin = 0;
|
||||
std::string origStr = CATCH_MOVE(str);
|
||||
str.clear();
|
||||
// There is at least one replacement, so reserve with the best guess
|
||||
// we can make without actually counting the number of occurences.
|
||||
str.reserve(origStr.size() - replaceThis.size() + withThis.size());
|
||||
do {
|
||||
str.append(origStr, copyBegin, i-copyBegin );
|
||||
str += withThis;
|
||||
copyBegin = i + replaceThis.size();
|
||||
if( copyBegin < origStr.size() )
|
||||
i = origStr.find( replaceThis, copyBegin );
|
||||
else
|
||||
i = std::string::npos;
|
||||
} while( i != std::string::npos );
|
||||
if ( copyBegin < origStr.size() ) {
|
||||
str.append(origStr, copyBegin, origStr.size() );
|
||||
}
|
||||
return replaced;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
|
||||
@@ -9099,8 +9119,8 @@ void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
|
||||
m_stream << '\n' << std::flush;
|
||||
StreamingReporterBase::testRunEnded(_testRunStats);
|
||||
}
|
||||
void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) {
|
||||
StreamingReporterBase::testRunStarting(_testInfo);
|
||||
void ConsoleReporter::testRunStarting(TestRunInfo const& _testRunInfo) {
|
||||
StreamingReporterBase::testRunStarting(_testRunInfo);
|
||||
if ( m_config->testSpec().hasFilters() ) {
|
||||
m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: "
|
||||
<< m_config->testSpec() << '\n';
|
||||
@@ -9253,8 +9273,7 @@ namespace Catch {
|
||||
namespace {
|
||||
struct BySectionInfo {
|
||||
BySectionInfo( SectionInfo const& other ): m_other( other ) {}
|
||||
BySectionInfo( BySectionInfo const& other ):
|
||||
m_other( other.m_other ) {}
|
||||
BySectionInfo( BySectionInfo const& other ) = default;
|
||||
bool operator()(
|
||||
Detail::unique_ptr<CumulativeReporterBase::SectionNode> const&
|
||||
node ) const {
|
||||
@@ -9879,8 +9898,8 @@ namespace Catch {
|
||||
return "Outputs listings as JSON. Test listing is Work-in-Progress!";
|
||||
}
|
||||
|
||||
void JsonReporter::testRunStarting( TestRunInfo const& testInfo ) {
|
||||
StreamingReporterBase::testRunStarting( testInfo );
|
||||
void JsonReporter::testRunStarting( TestRunInfo const& runInfo ) {
|
||||
StreamingReporterBase::testRunStarting( runInfo );
|
||||
endListing();
|
||||
|
||||
assert( isInside( Writer::Object ) );
|
||||
@@ -10178,7 +10197,7 @@ namespace Catch {
|
||||
|
||||
static void normalizeNamespaceMarkers(std::string& str) {
|
||||
std::size_t pos = str.find( "::" );
|
||||
while ( pos != str.npos ) {
|
||||
while ( pos != std::string::npos ) {
|
||||
str.replace( pos, 2, "." );
|
||||
pos += 1;
|
||||
pos = str.find( "::", pos );
|
||||
|
Reference in New Issue
Block a user