mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
removed redundant virtuals on override functions (and added a couple of overrides)
This commit is contained in:
@@ -80,19 +80,19 @@ namespace Catch {
|
||||
bool showHelp() const;
|
||||
|
||||
// IConfig interface
|
||||
virtual bool allowThrows() const override;
|
||||
virtual std::ostream& stream() const override;
|
||||
virtual std::string name() const override;
|
||||
virtual bool includeSuccessfulResults() const override;
|
||||
virtual bool warnAboutMissingAssertions() const override;
|
||||
virtual ShowDurations::OrNot showDurations() const override;
|
||||
virtual RunTests::InWhatOrder runOrder() const override;
|
||||
virtual unsigned int rngSeed() const override;
|
||||
virtual UseColour::YesOrNo useColour() const override;
|
||||
virtual bool shouldDebugBreak() const override;
|
||||
virtual int abortAfter() const override;
|
||||
virtual bool showInvisibles() const override;
|
||||
virtual Verbosity verbosity() const override;
|
||||
bool allowThrows() const override;
|
||||
std::ostream& stream() const override;
|
||||
std::string name() const override;
|
||||
bool includeSuccessfulResults() const override;
|
||||
bool warnAboutMissingAssertions() const override;
|
||||
ShowDurations::OrNot showDurations() const override;
|
||||
RunTests::InWhatOrder runOrder() const override;
|
||||
unsigned int rngSeed() const override;
|
||||
UseColour::YesOrNo useColour() const override;
|
||||
bool shouldDebugBreak() const override;
|
||||
int abortAfter() const override;
|
||||
bool showInvisibles() const override;
|
||||
Verbosity verbosity() const override;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -81,7 +81,7 @@ public:
|
||||
.endExpression( *this );
|
||||
}
|
||||
|
||||
virtual void reconstructExpression( std::string& dest ) const override {
|
||||
void reconstructExpression( std::string& dest ) const override {
|
||||
dest = ::Catch::Detail::stringify( m_lhs );
|
||||
}
|
||||
|
||||
@@ -117,11 +117,11 @@ public:
|
||||
.endExpression( *this );
|
||||
}
|
||||
|
||||
virtual bool isBinaryExpression() const override {
|
||||
bool isBinaryExpression() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void reconstructExpression( std::string& dest ) const override {
|
||||
void reconstructExpression( std::string& dest ) const override {
|
||||
std::string lhs = ::Catch::Detail::stringify( m_lhs );
|
||||
std::string rhs = ::Catch::Detail::stringify( m_rhs );
|
||||
char delim = lhs.size() + rhs.size() < 40 &&
|
||||
@@ -151,11 +151,11 @@ public:
|
||||
MatchExpression( ArgT arg, MatcherT matcher, char const* matcherString )
|
||||
: m_arg( arg ), m_matcher( matcher ), m_matcherString( matcherString ) {}
|
||||
|
||||
virtual bool isBinaryExpression() const override {
|
||||
bool isBinaryExpression() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void reconstructExpression( std::string& dest ) const override {
|
||||
void reconstructExpression( std::string& dest ) const override {
|
||||
std::string matcherAsString = m_matcher.toString();
|
||||
dest = ::Catch::Detail::stringify( m_arg );
|
||||
dest += ' ';
|
||||
|
@@ -53,14 +53,14 @@ namespace Matchers {
|
||||
|
||||
template<typename ArgT>
|
||||
struct MatchAllOf : MatcherBase<ArgT> {
|
||||
virtual bool match( ArgT const& arg ) const override {
|
||||
bool match( ArgT const& arg ) const override {
|
||||
for( auto matcher : m_matchers ) {
|
||||
if (!matcher->match(arg))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
std::string description;
|
||||
description.reserve( 4 + m_matchers.size()*32 );
|
||||
description += "( ";
|
||||
@@ -86,14 +86,14 @@ namespace Matchers {
|
||||
template<typename ArgT>
|
||||
struct MatchAnyOf : MatcherBase<ArgT> {
|
||||
|
||||
virtual bool match( ArgT const& arg ) const override {
|
||||
bool match( ArgT const& arg ) const override {
|
||||
for( auto matcher : m_matchers ) {
|
||||
if (matcher->match(arg))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
std::string description;
|
||||
description.reserve( 4 + m_matchers.size()*32 );
|
||||
description += "( ";
|
||||
@@ -122,11 +122,11 @@ namespace Matchers {
|
||||
|
||||
MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
|
||||
|
||||
virtual bool match( ArgT const& arg ) const override {
|
||||
bool match( ArgT const& arg ) const override {
|
||||
return !m_underlyingMatcher.match( arg );
|
||||
}
|
||||
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "not " + m_underlyingMatcher.toString();
|
||||
}
|
||||
MatcherBase<ArgT> const& m_underlyingMatcher;
|
||||
|
@@ -29,7 +29,7 @@ namespace Matchers {
|
||||
|
||||
struct StringMatcherBase : MatcherBase<std::string> {
|
||||
StringMatcherBase( std::string const& operation, CasedString const& comparator );
|
||||
virtual std::string describe() const override;
|
||||
std::string describe() const override;
|
||||
|
||||
CasedString m_comparator;
|
||||
std::string m_operation;
|
||||
@@ -37,19 +37,19 @@ namespace Matchers {
|
||||
|
||||
struct EqualsMatcher : StringMatcherBase {
|
||||
EqualsMatcher( CasedString const& comparator );
|
||||
virtual bool match( std::string const& source ) const override;
|
||||
bool match( std::string const& source ) const override;
|
||||
};
|
||||
struct ContainsMatcher : StringMatcherBase {
|
||||
ContainsMatcher( CasedString const& comparator );
|
||||
virtual bool match( std::string const& source ) const override;
|
||||
bool match( std::string const& source ) const override;
|
||||
};
|
||||
struct StartsWithMatcher : StringMatcherBase {
|
||||
StartsWithMatcher( CasedString const& comparator );
|
||||
virtual bool match( std::string const& source ) const override;
|
||||
bool match( std::string const& source ) const override;
|
||||
};
|
||||
struct EndsWithMatcher : StringMatcherBase {
|
||||
EndsWithMatcher( CasedString const& comparator );
|
||||
virtual bool match( std::string const& source ) const override;
|
||||
bool match( std::string const& source ) const override;
|
||||
};
|
||||
|
||||
} // namespace StdString
|
||||
|
@@ -24,7 +24,7 @@ namespace Matchers {
|
||||
return std::find(v.begin(), v.end(), m_comparator) != v.end();
|
||||
}
|
||||
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "Contains: " + ::Catch::Detail::stringify( m_comparator );
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Matchers {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "Contains: " + ::Catch::Detail::stringify( m_comparator );
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Matchers {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "Equals: " + ::Catch::Detail::stringify( m_comparator );
|
||||
}
|
||||
std::vector<T> const& m_comparator;
|
||||
|
@@ -112,7 +112,7 @@ namespace Catch {
|
||||
arcSafeRelease( m_substr );
|
||||
}
|
||||
|
||||
virtual bool match( NSString* arg ) const override {
|
||||
bool match( NSString* arg ) const override {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -122,12 +122,12 @@ namespace Catch {
|
||||
struct Equals : StringHolder {
|
||||
Equals( NSString* substr ) : StringHolder( substr ){}
|
||||
|
||||
virtual bool match( NSString* str ) const override {
|
||||
bool match( NSString* str ) const override {
|
||||
return (str != nil || m_substr == nil ) &&
|
||||
[str isEqualToString:m_substr];
|
||||
}
|
||||
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "equals string: " + Catch::toString( m_substr );
|
||||
}
|
||||
};
|
||||
@@ -135,12 +135,12 @@ namespace Catch {
|
||||
struct Contains : StringHolder {
|
||||
Contains( NSString* substr ) : StringHolder( substr ){}
|
||||
|
||||
virtual bool match( NSString* str ) const {
|
||||
bool match( NSString* str ) const {
|
||||
return (str != nil || m_substr == nil ) &&
|
||||
[str rangeOfString:m_substr].location != NSNotFound;
|
||||
}
|
||||
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "contains string: " + Catch::toString( m_substr );
|
||||
}
|
||||
};
|
||||
@@ -148,24 +148,24 @@ namespace Catch {
|
||||
struct StartsWith : StringHolder {
|
||||
StartsWith( NSString* substr ) : StringHolder( substr ){}
|
||||
|
||||
virtual bool match( NSString* str ) const {
|
||||
bool match( NSString* str ) const override {
|
||||
return (str != nil || m_substr == nil ) &&
|
||||
[str rangeOfString:m_substr].location == 0;
|
||||
}
|
||||
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "starts with: " + Catch::toString( m_substr );
|
||||
}
|
||||
};
|
||||
struct EndsWith : StringHolder {
|
||||
EndsWith( NSString* substr ) : StringHolder( substr ){}
|
||||
|
||||
virtual bool match( NSString* str ) const {
|
||||
bool match( NSString* str ) const override {
|
||||
return (str != nil || m_substr == nil ) &&
|
||||
[str rangeOfString:m_substr].location == [str length] - [m_substr length];
|
||||
}
|
||||
|
||||
virtual std::string describe() const override {
|
||||
std::string describe() const override {
|
||||
return "ends with: " + Catch::toString( m_substr );
|
||||
}
|
||||
};
|
||||
|
@@ -24,39 +24,39 @@ namespace Catch {
|
||||
public: // IRegistryHub
|
||||
RegistryHub() {
|
||||
}
|
||||
virtual IReporterRegistry const& getReporterRegistry() const override {
|
||||
IReporterRegistry const& getReporterRegistry() const override {
|
||||
return m_reporterRegistry;
|
||||
}
|
||||
virtual ITestCaseRegistry const& getTestCaseRegistry() const override {
|
||||
ITestCaseRegistry const& getTestCaseRegistry() const override {
|
||||
return m_testCaseRegistry;
|
||||
}
|
||||
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override {
|
||||
IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override {
|
||||
return m_exceptionTranslatorRegistry;
|
||||
}
|
||||
virtual ITagAliasRegistry const& getTagAliasRegistry() const override {
|
||||
ITagAliasRegistry const& getTagAliasRegistry() const override {
|
||||
return m_tagAliasRegistry;
|
||||
}
|
||||
virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
|
||||
StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
|
||||
return m_exceptionRegistry;
|
||||
}
|
||||
|
||||
public: // IMutableRegistryHub
|
||||
virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
|
||||
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
|
||||
m_reporterRegistry.registerReporter( name, factory );
|
||||
}
|
||||
virtual void registerListener( IReporterFactoryPtr const& factory ) override {
|
||||
void registerListener( IReporterFactoryPtr const& factory ) override {
|
||||
m_reporterRegistry.registerListener( factory );
|
||||
}
|
||||
virtual void registerTest( TestCase const& testInfo ) override {
|
||||
void registerTest( TestCase const& testInfo ) override {
|
||||
m_testCaseRegistry.registerTest( testInfo );
|
||||
}
|
||||
virtual void registerTranslator( const IExceptionTranslator* translator ) override {
|
||||
void registerTranslator( const IExceptionTranslator* translator ) override {
|
||||
m_exceptionTranslatorRegistry.registerTranslator( translator );
|
||||
}
|
||||
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
|
||||
void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
|
||||
m_tagAliasRegistry.add( alias, tag, lineInfo );
|
||||
}
|
||||
virtual void registerStartupException( std::exception_ptr const& exception ) noexcept override {
|
||||
void registerStartupException( std::exception_ptr const& exception ) noexcept override {
|
||||
m_exceptionRegistry.add(exception);
|
||||
}
|
||||
|
||||
|
@@ -18,9 +18,9 @@ namespace Catch {
|
||||
|
||||
public:
|
||||
|
||||
virtual ~ReporterRegistry() override {}
|
||||
~ReporterRegistry() override {}
|
||||
|
||||
virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override {
|
||||
IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override {
|
||||
FactoryMap::const_iterator it = m_factories.find( name );
|
||||
if( it == m_factories.end() )
|
||||
return nullptr;
|
||||
@@ -34,10 +34,10 @@ namespace Catch {
|
||||
m_listeners.push_back( factory );
|
||||
}
|
||||
|
||||
virtual FactoryMap const& getFactories() const override {
|
||||
FactoryMap const& getFactories() const override {
|
||||
return m_factories;
|
||||
}
|
||||
virtual Listeners const& getListeners() const override {
|
||||
Listeners const& getListeners() const override {
|
||||
return m_listeners;
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@ namespace Catch {
|
||||
|
||||
void endExpression( DecomposedExpression const& expr );
|
||||
|
||||
virtual void reconstructExpression( std::string& dest ) const override;
|
||||
void reconstructExpression( std::string& dest ) const override;
|
||||
|
||||
AssertionResult build() const;
|
||||
AssertionResult build( DecomposedExpression const& expr ) const;
|
||||
|
@@ -31,9 +31,9 @@ namespace Catch {
|
||||
mutable std::ofstream m_ofs;
|
||||
public:
|
||||
FileStream( std::string const& filename );
|
||||
virtual ~FileStream() noexcept;
|
||||
~FileStream() noexcept override;
|
||||
public: // IStream
|
||||
virtual std::ostream& stream() const override;
|
||||
std::ostream& stream() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace Catch {
|
||||
mutable std::ostream m_os;
|
||||
public:
|
||||
CoutStream();
|
||||
virtual ~CoutStream() noexcept;
|
||||
~CoutStream() noexcept override;
|
||||
|
||||
public: // IStream
|
||||
virtual std::ostream& stream() const override;
|
||||
std::ostream& stream() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ namespace Catch {
|
||||
mutable std::ostream m_os;
|
||||
public:
|
||||
DebugOutStream();
|
||||
virtual ~DebugOutStream() noexcept;
|
||||
~DebugOutStream() noexcept override;
|
||||
|
||||
public: // IStream
|
||||
virtual std::ostream& stream() const override;
|
||||
std::ostream& stream() const override;
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -16,9 +16,9 @@ namespace Catch {
|
||||
|
||||
class TagAliasRegistry : public ITagAliasRegistry {
|
||||
public:
|
||||
virtual ~TagAliasRegistry();
|
||||
virtual Option<TagAlias> find( std::string const& alias ) const;
|
||||
virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const;
|
||||
~TagAliasRegistry() override;
|
||||
Option<TagAlias> find( std::string const& alias ) const override;
|
||||
std::string expandAliases( std::string const& unexpandedTestSpec ) const override;
|
||||
void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );
|
||||
|
||||
private:
|
||||
|
@@ -96,10 +96,10 @@ namespace Catch {
|
||||
m_functions.push_back( testCase );
|
||||
}
|
||||
|
||||
virtual std::vector<TestCase> const& getAllTests() const {
|
||||
std::vector<TestCase> const& getAllTests() const override {
|
||||
return m_functions;
|
||||
}
|
||||
virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const {
|
||||
std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override {
|
||||
if( m_sortedFunctions.empty() )
|
||||
enforceNoDuplicateTestCases( m_functions );
|
||||
|
||||
|
@@ -59,7 +59,7 @@ namespace TestCaseTracking {
|
||||
virtual bool isIndexTracker() const = 0;
|
||||
};
|
||||
|
||||
class TrackerContext {
|
||||
class TrackerContext {
|
||||
|
||||
enum RunState {
|
||||
NotStarted,
|
||||
@@ -113,30 +113,29 @@ namespace TestCaseTracking {
|
||||
|
||||
public:
|
||||
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
||||
virtual ~TrackerBase() = default;
|
||||
|
||||
virtual NameAndLocation const& nameAndLocation() const override;
|
||||
virtual bool isComplete() const override;
|
||||
virtual bool isSuccessfullyCompleted() const override;
|
||||
virtual bool isOpen() const override;
|
||||
virtual bool hasChildren() const override;
|
||||
NameAndLocation const& nameAndLocation() const override;
|
||||
bool isComplete() const override;
|
||||
bool isSuccessfullyCompleted() const override;
|
||||
bool isOpen() const override;
|
||||
bool hasChildren() const override;
|
||||
|
||||
|
||||
virtual void addChild( ITrackerPtr const& child ) override;
|
||||
void addChild( ITrackerPtr const& child ) override;
|
||||
|
||||
virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;
|
||||
virtual ITracker& parent() override;
|
||||
ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;
|
||||
ITracker& parent() override;
|
||||
|
||||
virtual void openChild() override;
|
||||
void openChild() override;
|
||||
|
||||
virtual bool isSectionTracker() const override;
|
||||
virtual bool isIndexTracker() const override;
|
||||
bool isSectionTracker() const override;
|
||||
bool isIndexTracker() const override;
|
||||
|
||||
void open();
|
||||
|
||||
virtual void close() override;
|
||||
virtual void fail() override;
|
||||
virtual void markAsNeedingAnotherRun() override;
|
||||
void close() override;
|
||||
void fail() override;
|
||||
void markAsNeedingAnotherRun() override;
|
||||
|
||||
private:
|
||||
void moveToParent();
|
||||
@@ -147,9 +146,8 @@ namespace TestCaseTracking {
|
||||
std::vector<std::string> m_filters;
|
||||
public:
|
||||
SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
||||
virtual ~SectionTracker() = default;
|
||||
|
||||
virtual bool isSectionTracker() const override;
|
||||
bool isSectionTracker() const override;
|
||||
|
||||
static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation );
|
||||
|
||||
@@ -164,17 +162,15 @@ namespace TestCaseTracking {
|
||||
int m_index = -1;
|
||||
public:
|
||||
IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size );
|
||||
virtual ~IndexTracker() = default;
|
||||
|
||||
virtual bool isIndexTracker() const override;
|
||||
bool isIndexTracker() const override;
|
||||
void close() override;
|
||||
|
||||
static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size );
|
||||
|
||||
int index() const;
|
||||
|
||||
void moveNext();
|
||||
|
||||
virtual void close() override;
|
||||
};
|
||||
|
||||
} // namespace TestCaseTracking
|
||||
|
Reference in New Issue
Block a user