From 2a9d8d9e368a8da58733df6746baff4bb76312d2 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 23 Apr 2013 18:58:56 +0100 Subject: [PATCH] Changed "const X ref"s to "X const ref"s - Brought older code up to current convention (with the help of a Python script) --- include/internal/catch_approx.hpp | 12 ++-- include/internal/catch_assertionresult.h | 8 +-- include/internal/catch_assertionresult.hpp | 8 +-- include/internal/catch_capture.hpp | 14 ++-- include/internal/catch_commandline.hpp | 56 +++++++-------- include/internal/catch_common.h | 24 +++---- include/internal/catch_config.hpp | 16 ++--- include/internal/catch_context.h | 4 +- include/internal/catch_context_impl.hpp | 8 +-- include/internal/catch_debugger.hpp | 4 +- include/internal/catch_evaluate.hpp | 18 ++--- .../internal/catch_expression_decomposer.hpp | 4 +- include/internal/catch_expression_lhs.hpp | 24 +++---- .../internal/catch_expressionresult_builder.h | 16 ++--- .../catch_expressionresult_builder.hpp | 14 ++-- include/internal/catch_generators_impl.hpp | 2 +- include/internal/catch_interfaces_capture.h | 2 +- .../internal/catch_interfaces_generators.h | 2 +- .../internal/catch_interfaces_registry_hub.h | 8 +-- include/internal/catch_interfaces_reporter.h | 6 +- include/internal/catch_interfaces_testcase.h | 4 +- include/internal/catch_list.hpp | 10 +-- include/internal/catch_matchers.hpp | 68 +++++++++---------- .../internal/catch_notimplemented_exception.h | 2 +- .../catch_notimplemented_exception.hpp | 2 +- include/internal/catch_objc.hpp | 6 +- include/internal/catch_option.hpp | 2 +- include/internal/catch_registry_hub.hpp | 12 ++-- .../internal/catch_reporter_registrars.hpp | 8 +-- include/internal/catch_reporter_registry.hpp | 6 +- include/internal/catch_runner_impl.hpp | 22 +++--- include/internal/catch_running_test.hpp | 10 +-- include/internal/catch_section.hpp | 6 +- include/internal/catch_section_info.hpp | 6 +- include/internal/catch_stream.hpp | 2 +- include/internal/catch_tags.hpp | 20 +++--- include/internal/catch_test_case_info.h | 40 +++++------ include/internal/catch_test_case_info.hpp | 40 +++++------ .../catch_test_case_registry_impl.hpp | 16 ++--- include/internal/catch_test_registry.hpp | 4 +- include/internal/catch_test_spec.h | 14 ++-- include/internal/catch_tostring.hpp | 10 +-- include/internal/catch_totals.hpp | 10 +-- include/internal/catch_xmlwriter.hpp | 24 +++---- 44 files changed, 297 insertions(+), 297 deletions(-) diff --git a/include/internal/catch_approx.hpp b/include/internal/catch_approx.hpp index 128ef050..2f467a36 100644 --- a/include/internal/catch_approx.hpp +++ b/include/internal/catch_approx.hpp @@ -24,7 +24,7 @@ namespace Detail { m_value( value ) {} - Approx( const Approx& other ) + Approx( Approx const& other ) : m_epsilon( other.m_epsilon ), m_scale( other.m_scale ), m_value( other.m_value ) @@ -41,20 +41,20 @@ namespace Detail { return approx; } - friend bool operator == ( double lhs, const Approx& rhs ) { + friend bool operator == ( double lhs, Approx const& rhs ) { // Thanks to Richard Harris for his help refining this formula return fabs( lhs - rhs.m_value ) < rhs.m_epsilon * (rhs.m_scale + (std::max)( fabs(lhs), fabs(rhs.m_value) ) ); } - friend bool operator == ( const Approx& lhs, double rhs ) { + friend bool operator == ( Approx const& lhs, double rhs ) { return operator==( rhs, lhs ); } - friend bool operator != ( double lhs, const Approx& rhs ) { + friend bool operator != ( double lhs, Approx const& rhs ) { return !operator==( lhs, rhs ); } - friend bool operator != ( const Approx& lhs, double rhs ) { + friend bool operator != ( Approx const& lhs, double rhs ) { return !operator==( rhs, lhs ); } @@ -82,7 +82,7 @@ namespace Detail { } template<> -inline std::string toString( const Detail::Approx& value ) { +inline std::string toString( Detail::Approx const& value ) { return value.toString(); } diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h index 37372b67..b3f63e04 100644 --- a/include/internal/catch_assertionresult.h +++ b/include/internal/catch_assertionresult.h @@ -16,9 +16,9 @@ namespace Catch { struct AssertionInfo { AssertionInfo() {} - AssertionInfo( const std::string& _macroName, - const SourceLineInfo& _lineInfo, - const std::string& _capturedExpression, + AssertionInfo( std::string const& _macroName, + SourceLineInfo const& _lineInfo, + std::string const& _capturedExpression, ResultDisposition::Flags _resultDisposition ); std::string macroName; @@ -39,7 +39,7 @@ namespace Catch { class AssertionResult { public: AssertionResult(); - AssertionResult( const AssertionInfo& info, const AssertionResultData& data ); + AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); ~AssertionResult(); bool isOk() const; diff --git a/include/internal/catch_assertionresult.hpp b/include/internal/catch_assertionresult.hpp index 91853307..5ba2f458 100644 --- a/include/internal/catch_assertionresult.hpp +++ b/include/internal/catch_assertionresult.hpp @@ -13,9 +13,9 @@ namespace Catch { - AssertionInfo::AssertionInfo( const std::string& _macroName, - const SourceLineInfo& _lineInfo, - const std::string& _capturedExpression, + AssertionInfo::AssertionInfo( std::string const& _macroName, + SourceLineInfo const& _lineInfo, + std::string const& _capturedExpression, ResultDisposition::Flags _resultDisposition ) : macroName( _macroName ), lineInfo( _lineInfo ), @@ -28,7 +28,7 @@ namespace Catch { AssertionResult::AssertionResult() {} - AssertionResult::AssertionResult( const AssertionInfo& info, const AssertionResultData& data ) + AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) : m_info( info ), m_resultData( data ) {} diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 81eb4a0d..a8aa98b1 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -27,8 +27,8 @@ namespace Catch { } template - ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher, - const std::string& matcherCallAsString ) { + ExpressionResultBuilder expressionResultBuilderFromMatcher( MatcherT const& matcher, + std::string const& matcherCallAsString ) { std::string matcherAsString = matcher.toString(); if( matcherAsString == "{?}" ) matcherAsString = matcherCallAsString; @@ -38,18 +38,18 @@ namespace Catch { } template - ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher, - const ArgT& arg, - const std::string& matcherCallAsString ) { + ExpressionResultBuilder expressionResultBuilderFromMatcher( MatcherT const& matcher, + ArgT const& arg, + std::string const& matcherCallAsString ) { return expressionResultBuilderFromMatcher( matcher, matcherCallAsString ) .setLhs( Catch::toString( arg ) ) .setResultType( matcher.match( arg ) ); } template - ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher, + ExpressionResultBuilder expressionResultBuilderFromMatcher( MatcherT const& matcher, ArgT* arg, - const std::string& matcherCallAsString ) { + std::string const& matcherCallAsString ) { return expressionResultBuilderFromMatcher( matcher, matcherCallAsString ) .setLhs( Catch::toString( arg ) ) .setResultType( matcher.match( arg ) ); diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index 4c32d7f3..7657da6b 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -17,20 +17,20 @@ namespace Catch { public: Command(){} - explicit Command( const std::string& name ) : m_name( name ) { + explicit Command( std::string const& name ) : m_name( name ) { } - Command& operator += ( const std::string& arg ) { + Command& operator += ( std::string const& arg ) { m_args.push_back( arg ); return *this; } - Command& operator += ( const Command& other ) { + Command& operator += ( Command const& other ) { std::copy( other.m_args.begin(), other.m_args.end(), std::back_inserter( m_args ) ); if( m_name.empty() ) m_name = other.m_name; return *this; } - Command operator + ( const Command& other ) { + Command operator + ( Command const& other ) { Command newCommand( *this ); newCommand += other; return newCommand; @@ -45,7 +45,7 @@ namespace Catch { std::size_t argsCount() const { return m_args.size(); } CATCH_ATTRIBUTE_NORETURN - void raiseError( const std::string& message ) const { + void raiseError( std::string const& message ) const { std::ostringstream oss; if( m_name.empty() ) oss << "Error while parsing " << m_name << ". " << message << "."; @@ -76,14 +76,14 @@ namespace Catch { exeName = exeName.substr( pos+1 ); return exeName; } - Command find( const std::string& arg1, const std::string& arg2, const std::string& arg3 ) const { + Command find( std::string const& arg1, std::string const& arg2, std::string const& arg3 ) const { return find( arg1 ) + find( arg2 ) + find( arg3 ); } - Command find( const std::string& shortArg, const std::string& longArg ) const { + Command find( std::string const& shortArg, std::string const& longArg ) const { return find( shortArg ) + find( longArg ); } - Command find( const std::string& arg ) const { + Command find( std::string const& arg ) const { if( arg.empty() ) return getArgs( "", 1 ); else @@ -97,7 +97,7 @@ namespace Catch { } private: - Command getArgs( const std::string& cmdName, std::size_t from ) const { + Command getArgs( std::string const& cmdName, std::size_t from ) const { Command command( cmdName ); for( std::size_t i = from; i < m_argc && m_argv[i][0] != '-'; ++i ) command += m_argv[i]; @@ -116,7 +116,7 @@ namespace Catch { virtual ~OptionParser() {} - Command find( const CommandParser& parser ) const { + Command find( CommandParser const& parser ) const { Command cmd; for( std::vector::const_iterator it = m_optionNames.begin(); it != m_optionNames.end(); @@ -125,7 +125,7 @@ namespace Catch { return cmd; } - void validateArgs( const Command& args ) const { + void validateArgs( Command const& args ) const { if( tooFewArgs( args ) || tooManyArgs( args ) ) { std::ostringstream oss; if( m_maxArgs == -1 ) @@ -138,14 +138,14 @@ namespace Catch { } } - void parseIntoConfig( const CommandParser& parser, ConfigData& config ) { + void parseIntoConfig( CommandParser const& parser, ConfigData& config ) { if( Command cmd = find( parser ) ) { validateArgs( cmd ); parseIntoConfig( cmd, config ); } } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) = 0; + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) = 0; virtual std::string argsSynopsis() const = 0; virtual std::string optionSummary() const = 0; virtual std::string optionDescription() const { return ""; } @@ -171,10 +171,10 @@ namespace Catch { protected: - bool tooFewArgs( const Command& args ) const { + bool tooFewArgs( Command const& args ) const { return args.argsCount() < static_cast( m_minArgs ); } - bool tooManyArgs( const Command& args ) const { + bool tooManyArgs( Command const& args ) const { return m_maxArgs >= 0 && args.argsCount() > static_cast( m_maxArgs ); } std::vector m_optionNames; @@ -201,7 +201,7 @@ namespace Catch { return ""; } - virtual void parseIntoConfig( const Command&, ConfigData& ) { + virtual void parseIntoConfig( Command const&, ConfigData& ) { // Does not affect config } }; @@ -254,7 +254,7 @@ namespace Catch { "that start with 'a/b/', except 'a/b/c', which is included"; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { std::string groupName; for( std::size_t i = 0; i < cmd.argsCount(); ++i ) { if( i != 0 ) @@ -300,7 +300,7 @@ namespace Catch { "matches all tests tagged [one], except those also tagged [two]"; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { std::string groupName; for( std::size_t i = 0; i < cmd.argsCount(); ++i ) { if( i != 0 ) @@ -345,7 +345,7 @@ namespace Catch { ;//" -l xml"; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { config.listSpec = List::Tests; if( cmd.argsCount() >= 1 ) { if( cmd[0] == "all" ) @@ -404,7 +404,7 @@ namespace Catch { "of the root node."; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { config.reporter = cmd[0]; } }; @@ -438,7 +438,7 @@ namespace Catch { " -o %debug \t(The IDE's debug output window - currently only Windows' " "OutputDebugString is supported)."; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { if( cmd[0][0] == '%' ) config.stream = cmd[0].substr( 1 ); else @@ -465,7 +465,7 @@ namespace Catch { "added worked first time!). To see successful, as well as failing, test results " "just pass this option."; } - virtual void parseIntoConfig( const Command&, ConfigData& config ) { + virtual void parseIntoConfig( Command const&, ConfigData& config ) { config.includeWhichResults = Include::SuccessfulResults; } }; @@ -491,7 +491,7 @@ namespace Catch { "built your code with the DEBUG preprocessor symbol"; } - virtual void parseIntoConfig( const Command&, ConfigData& config ) { + virtual void parseIntoConfig( Command const&, ConfigData& config ) { config.shouldDebugBreak = true; } }; @@ -521,7 +521,7 @@ namespace Catch { " -n \"tests of the widget component\""; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { config.name = cmd[0]; } }; @@ -550,7 +550,7 @@ namespace Catch { "number causes it to abort after that number of assertion failures."; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { int threshold = 1; if( cmd.argsCount() == 1 ) { std::stringstream ss; @@ -589,7 +589,7 @@ namespace Catch { "as not to contribute additional noise."; } - virtual void parseIntoConfig( const Command&, ConfigData& config ) { + virtual void parseIntoConfig( Command const&, ConfigData& config ) { config.allowThrows = false; } }; @@ -620,7 +620,7 @@ namespace Catch { " -w NoAssertions"; } - virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) { + virtual void parseIntoConfig( Command const& cmd, ConfigData& config ) { for( std::size_t i = 0; i < cmd.argsCount(); ++i ) { if( cmd[i] == "NoAssertions" ) config.warnings = (ConfigData::WarnAbout::What)( config.warnings | ConfigData::WarnAbout::NoAssertions ); @@ -655,7 +655,7 @@ namespace Catch { add(); // Keep this one last } - void parseIntoConfig( const CommandParser& parser, ConfigData& config ) { + void parseIntoConfig( CommandParser const& parser, ConfigData& config ) { config.name = parser.exeName(); if( endsWith( config.name, ".exe" ) ) config.name = config.name.substr( 0, config.name.size()-4 ); diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index d6627878..954f6170 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -28,8 +28,8 @@ namespace Catch { class NonCopyable { - NonCopyable( const NonCopyable& ); - void operator = ( const NonCopyable& ); + NonCopyable( NonCopyable const& ); + void operator = ( NonCopyable const& ); protected: NonCopyable() {} virtual ~NonCopyable(); @@ -67,17 +67,17 @@ namespace Catch { } template - inline void forEach( const ContainerT& container, Function function ) { + inline void forEach( ContainerT const& container, Function function ) { std::for_each( container.begin(), container.end(), function ); } - inline bool startsWith( const std::string& s, const std::string& prefix ) { + inline bool startsWith( std::string const& s, std::string const& prefix ) { return s.size() >= prefix.size() && s.substr( 0, prefix.size() ) == prefix; } - inline bool endsWith( const std::string& s, const std::string& suffix ) { + inline bool endsWith( std::string const& s, std::string const& suffix ) { return s.size() >= suffix.size() && s.substr( s.size()-suffix.size(), suffix.size() ) == suffix; } - inline bool contains( const std::string& s, const std::string& infix ) { + inline bool contains( std::string const& s, std::string const& infix ) { return s.find( infix ) != std::string::npos; } inline void toLowerInPlace( std::string& s ) { @@ -90,12 +90,12 @@ namespace Catch { } struct pluralise { - pluralise( std::size_t count, const std::string& label ) + pluralise( std::size_t count, std::string const& label ) : m_count( count ), m_label( label ) {} - friend std::ostream& operator << ( std::ostream& os, const pluralise& pluraliser ) { + friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { os << pluraliser.m_count << " " << pluraliser.m_label; if( pluraliser.m_count != 1 ) os << "s"; @@ -109,11 +109,11 @@ namespace Catch { struct SourceLineInfo { SourceLineInfo() : line( 0 ){} - SourceLineInfo( const std::string& _file, std::size_t _line ) + SourceLineInfo( std::string const& _file, std::size_t _line ) : file( _file ), line( _line ) {} - SourceLineInfo( const SourceLineInfo& other ) + SourceLineInfo( SourceLineInfo const& other ) : file( other.file ), line( other.line ) {} @@ -125,7 +125,7 @@ namespace Catch { std::size_t line; }; - inline std::ostream& operator << ( std::ostream& os, const SourceLineInfo& info ) { + inline std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { #ifndef __GNUG__ os << info.file << "(" << info.line << ")"; #else @@ -135,7 +135,7 @@ namespace Catch { } CATCH_ATTRIBUTE_NORETURN - inline void throwLogicError( const std::string& message, const SourceLineInfo& locationInfo ) { + inline void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ) { std::ostringstream oss; oss << locationInfo << ": Internal Catch error: '" << message << "'"; throw std::logic_error( oss.str() ); diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 0e5de388..87c7d734 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -77,8 +77,8 @@ namespace Catch { class Config : public IConfig { private: - Config( const Config& other ); - Config& operator = ( const Config& other ); + Config( Config const& other ); + Config& operator = ( Config const& other ); virtual void dummy(); public: @@ -86,7 +86,7 @@ namespace Catch { : m_os( std::cout.rdbuf() ) {} - Config( const ConfigData& data ) + Config( ConfigData const& data ) : m_data( data ), m_os( std::cout.rdbuf() ) {} @@ -96,7 +96,7 @@ namespace Catch { m_stream.release(); } - void setFilename( const std::string& filename ) { + void setFilename( std::string const& filename ) { m_data.outputFilename = filename; } @@ -104,7 +104,7 @@ namespace Catch { return m_data.listSpec; } - const std::string& getFilename() const { + std::string const& getFilename() const { return m_data.outputFilename ; } @@ -132,14 +132,14 @@ namespace Catch { m_os.rdbuf( buf ? buf : std::cout.rdbuf() ); } - void useStream( const std::string& streamName ) { + void useStream( std::string const& streamName ) { Stream stream = createStream( streamName ); setStreamBuf( stream.streamBuf ); m_stream.release(); m_stream = stream; } - void addTestSpec( const std::string& testSpec ) { + void addTestSpec( std::string const& testSpec ) { TestCaseFilters filters( testSpec ); filters.addFilter( TestCaseFilter( testSpec ) ); m_data.filters.push_back( filters ); @@ -157,7 +157,7 @@ namespace Catch { return m_data.allowThrows; } - const ConfigData& data() const { + ConfigData const& data() const { return m_data; } ConfigData& data() { diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h index 831d22a3..5b4976c6 100644 --- a/include/internal/catch_context.h +++ b/include/internal/catch_context.h @@ -29,7 +29,7 @@ namespace Catch { virtual IResultCapture& getResultCapture() = 0; virtual IRunner& getRunner() = 0; - virtual size_t getGeneratorIndex( const std::string& fileInfo, size_t totalSize ) = 0; + virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) = 0; virtual bool advanceGeneratorsForCurrentTest() = 0; virtual const IConfig* getConfig() const = 0; }; @@ -45,7 +45,7 @@ namespace Catch { IContext& getCurrentContext(); IMutableContext& getCurrentMutableContext(); void cleanUpContext(); - Stream createStream( const std::string& streamName ); + Stream createStream( std::string const& streamName ); } diff --git a/include/internal/catch_context_impl.hpp b/include/internal/catch_context_impl.hpp index e9695725..d14aed40 100644 --- a/include/internal/catch_context_impl.hpp +++ b/include/internal/catch_context_impl.hpp @@ -18,8 +18,8 @@ namespace Catch { class Context : public IMutableContext { Context() : m_config( NULL ) {} - Context( const Context& ); - void operator=( const Context& ); + Context( Context const& ); + void operator=( Context const& ); public: // IContext virtual IResultCapture& getResultCapture() { @@ -28,7 +28,7 @@ namespace Catch { virtual IRunner& getRunner() { return *m_runner; } - virtual size_t getGeneratorIndex( const std::string& fileInfo, size_t totalSize ) { + virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) { return getGeneratorsForCurrentTest() .getGeneratorInfo( fileInfo, totalSize ) .getCurrentIndex(); @@ -95,7 +95,7 @@ namespace Catch { return getCurrentMutableContext(); } - Stream createStream( const std::string& streamName ) { + Stream createStream( std::string const& streamName ) { if( streamName == "stdout" ) return Stream( std::cout.rdbuf(), false ); if( streamName == "stderr" ) return Stream( std::cerr.rdbuf(), false ); if( streamName == "debug" ) return Stream( new StreamBufImpl, true ); diff --git a/include/internal/catch_debugger.hpp b/include/internal/catch_debugger.hpp index 42769898..89e15d69 100644 --- a/include/internal/catch_debugger.hpp +++ b/include/internal/catch_debugger.hpp @@ -103,11 +103,11 @@ #ifdef CATCH_PLATFORM_WINDOWS extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA( const char* ); -inline void writeToDebugConsole( const std::string& text ) { +inline void writeToDebugConsole( std::string const& text ) { ::OutputDebugStringA( text.c_str() ); } #else -inline void writeToDebugConsole( const std::string& text ) { +inline void writeToDebugConsole( std::string const& text ) { // !TBD: Need a version for Mac/ XCode and other IDEs std::cout << text; } diff --git a/include/internal/catch_evaluate.hpp b/include/internal/catch_evaluate.hpp index db1be5ee..3592e2a7 100644 --- a/include/internal/catch_evaluate.hpp +++ b/include/internal/catch_evaluate.hpp @@ -34,7 +34,7 @@ namespace Internal { template<> struct OperatorTraits{ static const char* getName(){ return ">="; } }; template - inline T& opCast(const T& t) { return const_cast(t); } + inline T& opCast(T const& t) { return const_cast(t); } // nullptr_t support based on pull request #154 from Konstantin Baumann #ifdef CATCH_CONFIG_CPP11_NULLPTR @@ -49,43 +49,43 @@ namespace Internal { template struct Evaluator { - static bool evaluate( const T1& lhs, const T2& rhs) { + static bool evaluate( T1 const& lhs, T2 const& rhs) { return opCast( lhs ) == opCast( rhs ); } }; template struct Evaluator { - static bool evaluate( const T1& lhs, const T2& rhs ) { + static bool evaluate( T1 const& lhs, T2 const& rhs ) { return opCast( lhs ) != opCast( rhs ); } }; template struct Evaluator { - static bool evaluate( const T1& lhs, const T2& rhs ) { + static bool evaluate( T1 const& lhs, T2 const& rhs ) { return opCast( lhs ) < opCast( rhs ); } }; template struct Evaluator { - static bool evaluate( const T1& lhs, const T2& rhs ) { + static bool evaluate( T1 const& lhs, T2 const& rhs ) { return opCast( lhs ) > opCast( rhs ); } }; template struct Evaluator { - static bool evaluate( const T1& lhs, const T2& rhs ) { + static bool evaluate( T1 const& lhs, T2 const& rhs ) { return opCast( lhs ) >= opCast( rhs ); } }; template struct Evaluator { - static bool evaluate( const T1& lhs, const T2& rhs ) { + static bool evaluate( T1 const& lhs, T2 const& rhs ) { return opCast( lhs ) <= opCast( rhs ); } }; template - bool applyEvaluator( const T1& lhs, const T2& rhs ) { + bool applyEvaluator( T1 const& lhs, T2 const& rhs ) { return Evaluator::evaluate( lhs, rhs ); } @@ -94,7 +94,7 @@ namespace Internal { // "base" overload template - bool compare( const T1& lhs, const T2& rhs ) { + bool compare( T1 const& lhs, T2 const& rhs ) { return Evaluator::evaluate( lhs, rhs ); } diff --git a/include/internal/catch_expression_decomposer.hpp b/include/internal/catch_expression_decomposer.hpp index 1d8ca73d..9d8fd352 100644 --- a/include/internal/catch_expression_decomposer.hpp +++ b/include/internal/catch_expression_decomposer.hpp @@ -17,8 +17,8 @@ class ExpressionDecomposer { public: template - ExpressionLhs operator->* ( const T & operand ) { - return ExpressionLhs( operand ); + ExpressionLhs operator->* ( T const& operand ) { + return ExpressionLhs( operand ); } ExpressionLhs operator->* ( bool value ) { diff --git a/include/internal/catch_expression_lhs.hpp b/include/internal/catch_expression_lhs.hpp index 2cc7397d..21cc593a 100644 --- a/include/internal/catch_expression_lhs.hpp +++ b/include/internal/catch_expression_lhs.hpp @@ -19,38 +19,38 @@ struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison; // in an ExpressionResultBuilder object template class ExpressionLhs { - void operator = ( const ExpressionLhs& ); + void operator = ( ExpressionLhs const& ); public: ExpressionLhs( T lhs ) : m_lhs( lhs ) {} template - ExpressionResultBuilder& operator == ( const RhsT& rhs ) { + ExpressionResultBuilder& operator == ( RhsT const& rhs ) { return captureExpression( rhs ); } template - ExpressionResultBuilder& operator != ( const RhsT& rhs ) { + ExpressionResultBuilder& operator != ( RhsT const& rhs ) { return captureExpression( rhs ); } template - ExpressionResultBuilder& operator < ( const RhsT& rhs ) { + ExpressionResultBuilder& operator < ( RhsT const& rhs ) { return captureExpression( rhs ); } template - ExpressionResultBuilder& operator > ( const RhsT& rhs ) { + ExpressionResultBuilder& operator > ( RhsT const& rhs ) { return captureExpression( rhs ); } template - ExpressionResultBuilder& operator <= ( const RhsT& rhs ) { + ExpressionResultBuilder& operator <= ( RhsT const& rhs ) { return captureExpression( rhs ); } template - ExpressionResultBuilder& operator >= ( const RhsT& rhs ) { + ExpressionResultBuilder& operator >= ( RhsT const& rhs ) { return captureExpression( rhs ); } @@ -72,14 +72,14 @@ public: // Only simple binary expressions are allowed on the LHS. // If more complex compositions are required then place the sub expression in parentheses - template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator + ( const RhsT& ); - template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( const RhsT& ); - template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator / ( const RhsT& ); - template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator * ( const RhsT& ); + template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator + ( RhsT const& ); + template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( RhsT const& ); + template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator / ( RhsT const& ); + template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator * ( RhsT const& ); private: template - ExpressionResultBuilder& captureExpression( const RhsT& rhs ) { + ExpressionResultBuilder& captureExpression( RhsT const& rhs ) { return m_result .setResultType( Internal::compare( m_lhs, rhs ) ) .setLhs( Catch::toString( m_lhs ) ) diff --git a/include/internal/catch_expressionresult_builder.h b/include/internal/catch_expressionresult_builder.h index eb9109f9..5bf41379 100644 --- a/include/internal/catch_expressionresult_builder.h +++ b/include/internal/catch_expressionresult_builder.h @@ -22,26 +22,26 @@ class ExpressionResultBuilder { public: ExpressionResultBuilder( ResultWas::OfType resultType = ResultWas::Unknown ); - ExpressionResultBuilder( const ExpressionResultBuilder& other ); - ExpressionResultBuilder& operator=(const ExpressionResultBuilder& other ); + ExpressionResultBuilder( ExpressionResultBuilder const& other ); + ExpressionResultBuilder& operator=(ExpressionResultBuilder const& other ); ExpressionResultBuilder& setResultType( ResultWas::OfType result ); ExpressionResultBuilder& setResultType( bool result ); - ExpressionResultBuilder& setLhs( const std::string& lhs ); - ExpressionResultBuilder& setRhs( const std::string& rhs ); - ExpressionResultBuilder& setOp( const std::string& op ); + ExpressionResultBuilder& setLhs( std::string const& lhs ); + ExpressionResultBuilder& setRhs( std::string const& rhs ); + ExpressionResultBuilder& setOp( std::string const& op ); ExpressionResultBuilder& endExpression( ResultDisposition::Flags resultDisposition ); template - ExpressionResultBuilder& operator << ( const T& value ) { + ExpressionResultBuilder& operator << ( T const& value ) { m_stream << value; return *this; } - std::string reconstructExpression( const AssertionInfo& info ) const; + std::string reconstructExpression( AssertionInfo const& info ) const; - AssertionResult buildResult( const AssertionInfo& info ) const; + AssertionResult buildResult( AssertionInfo const& info ) const; private: AssertionResultData m_data; diff --git a/include/internal/catch_expressionresult_builder.hpp b/include/internal/catch_expressionresult_builder.hpp index c1484fb7..ec4774b2 100644 --- a/include/internal/catch_expressionresult_builder.hpp +++ b/include/internal/catch_expressionresult_builder.hpp @@ -17,13 +17,13 @@ namespace Catch { ExpressionResultBuilder::ExpressionResultBuilder( ResultWas::OfType resultType ) { m_data.resultType = resultType; } - ExpressionResultBuilder::ExpressionResultBuilder( const ExpressionResultBuilder& other ) + ExpressionResultBuilder::ExpressionResultBuilder( ExpressionResultBuilder const& other ) : m_data( other.m_data ), m_exprComponents( other.m_exprComponents ) { m_stream << other.m_stream.str(); } - ExpressionResultBuilder& ExpressionResultBuilder::operator=(const ExpressionResultBuilder& other ) { + ExpressionResultBuilder& ExpressionResultBuilder::operator=(ExpressionResultBuilder const& other ) { m_data = other.m_data; m_exprComponents = other.m_exprComponents; m_stream.str(""); @@ -42,19 +42,19 @@ namespace Catch { m_exprComponents.shouldNegate = shouldNegate( resultDisposition ); return *this; } - ExpressionResultBuilder& ExpressionResultBuilder::setLhs( const std::string& lhs ) { + ExpressionResultBuilder& ExpressionResultBuilder::setLhs( std::string const& lhs ) { m_exprComponents.lhs = lhs; return *this; } - ExpressionResultBuilder& ExpressionResultBuilder::setRhs( const std::string& rhs ) { + ExpressionResultBuilder& ExpressionResultBuilder::setRhs( std::string const& rhs ) { m_exprComponents.rhs = rhs; return *this; } - ExpressionResultBuilder& ExpressionResultBuilder::setOp( const std::string& op ) { + ExpressionResultBuilder& ExpressionResultBuilder::setOp( std::string const& op ) { m_exprComponents.op = op; return *this; } - AssertionResult ExpressionResultBuilder::buildResult( const AssertionInfo& info ) const + AssertionResult ExpressionResultBuilder::buildResult( AssertionInfo const& info ) const { assert( m_data.resultType != ResultWas::Unknown ); @@ -76,7 +76,7 @@ namespace Catch { } return AssertionResult( info, data ); } - std::string ExpressionResultBuilder::reconstructExpression( const AssertionInfo& info ) const { + std::string ExpressionResultBuilder::reconstructExpression( AssertionInfo const& info ) const { if( m_exprComponents.op == "" ) return m_exprComponents.lhs.empty() ? info.capturedExpression : m_exprComponents.op + m_exprComponents.lhs; else if( m_exprComponents.op == "matches" ) diff --git a/include/internal/catch_generators_impl.hpp b/include/internal/catch_generators_impl.hpp index 23304f91..75af7395 100644 --- a/include/internal/catch_generators_impl.hpp +++ b/include/internal/catch_generators_impl.hpp @@ -50,7 +50,7 @@ namespace Catch { deleteAll( m_generatorsInOrder ); } - IGeneratorInfo& getGeneratorInfo( const std::string& fileInfo, std::size_t size ) { + IGeneratorInfo& getGeneratorInfo( std::string const& fileInfo, std::size_t size ) { std::map::const_iterator it = m_generatorsByName.find( fileInfo ); if( it == m_generatorsByName.end() ) { IGeneratorInfo* info = new GeneratorInfo( size ); diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h index c6c327a6..8cc68cc7 100644 --- a/include/internal/catch_interfaces_capture.h +++ b/include/internal/catch_interfaces_capture.h @@ -36,7 +36,7 @@ namespace Catch { virtual bool shouldDebugBreak() const = 0; - virtual void acceptMessage( const MessageBuilder& messageBuilder ) = 0; + virtual void acceptMessage( MessageBuilder const& messageBuilder ) = 0; virtual ResultAction::Value acceptExpression( ExpressionResultBuilder const& assertionResult, AssertionInfo const& assertionInfo ) = 0; virtual std::string getCurrentTestName() const = 0; diff --git a/include/internal/catch_interfaces_generators.h b/include/internal/catch_interfaces_generators.h index 8907adb6..03b01d9a 100644 --- a/include/internal/catch_interfaces_generators.h +++ b/include/internal/catch_interfaces_generators.h @@ -21,7 +21,7 @@ namespace Catch { struct IGeneratorsForTest { virtual ~IGeneratorsForTest(); - virtual IGeneratorInfo& getGeneratorInfo( const std::string& fileInfo, std::size_t size ) = 0; + virtual IGeneratorInfo& getGeneratorInfo( std::string const& fileInfo, std::size_t size ) = 0; virtual bool moveNext() = 0; }; diff --git a/include/internal/catch_interfaces_registry_hub.h b/include/internal/catch_interfaces_registry_hub.h index 7d932bde..7fae3abd 100644 --- a/include/internal/catch_interfaces_registry_hub.h +++ b/include/internal/catch_interfaces_registry_hub.h @@ -23,15 +23,15 @@ namespace Catch { struct IRegistryHub { virtual ~IRegistryHub(); - virtual const IReporterRegistry& getReporterRegistry() const = 0; - virtual const ITestCaseRegistry& getTestCaseRegistry() const = 0; + virtual IReporterRegistry const& getReporterRegistry() const = 0; + virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0; }; struct IMutableRegistryHub { virtual ~IMutableRegistryHub(); - virtual void registerReporter( const std::string& name, IReporterFactory* factory ) = 0; - virtual void registerTest( const TestCase& testInfo ) = 0; + virtual void registerReporter( std::string const& name, IReporterFactory* factory ) = 0; + virtual void registerTest( TestCase const& testInfo ) = 0; virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; }; diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 3fa228b3..751135b8 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -303,11 +303,11 @@ namespace Catch virtual void StartTestCase( TestCaseInfo const& testInfo ) = 0; virtual void EndTestCase( TestCaseInfo const& testInfo, Totals const& totals, std::string const& stdOut, std::string const& stdErr ) = 0; virtual void StartSection( std::string const& sectionName, std::string const& description ) = 0; - virtual void EndSection( std::string const& sectionName, const Counts& assertions ) = 0; + virtual void EndSection( std::string const& sectionName, Counts const& assertions ) = 0; virtual void NoAssertionsInSection( std::string const& sectionName ) = 0; virtual void NoAssertionsInTestCase( std::string const& testName ) = 0; virtual void Aborted() = 0; - virtual void Result( const AssertionResult& result ) = 0; + virtual void Result( AssertionResult const& result ) = 0; }; @@ -322,7 +322,7 @@ namespace Catch virtual ~IReporterRegistry(); virtual IStreamingReporter* create( std::string const& name, ReporterConfig const& config ) const = 0; - virtual const FactoryMap& getFactories() const = 0; + virtual FactoryMap const& getFactories() const = 0; }; inline std::string trim( std::string const& str ) { diff --git a/include/internal/catch_interfaces_testcase.h b/include/internal/catch_interfaces_testcase.h index 3f0c7078..90d12009 100644 --- a/include/internal/catch_interfaces_testcase.h +++ b/include/internal/catch_interfaces_testcase.h @@ -26,8 +26,8 @@ namespace Catch { struct ITestCaseRegistry { virtual ~ITestCaseRegistry(); - virtual const std::vector& getAllTests() const = 0; - virtual std::vector getMatchingTestCases( const std::string& rawTestSpec ) const = 0; + virtual std::vector const& getAllTests() const = 0; + virtual std::vector getMatchingTestCases( std::string const& rawTestSpec ) const = 0; }; } diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp index b1504f4d..aa47b132 100644 --- a/include/internal/catch_list.hpp +++ b/include/internal/catch_list.hpp @@ -16,7 +16,7 @@ #include namespace Catch { - inline bool matchesFilters( const std::vector& filters, const TestCase& testCase ) { + inline bool matchesFilters( std::vector const& filters, TestCase const& testCase ) { std::vector::const_iterator it = filters.begin(); std::vector::const_iterator itEnd = filters.end(); for(; it != itEnd; ++it ) @@ -25,7 +25,7 @@ namespace Catch { return true; } - inline void listTests( const ConfigData& config ) { + inline void listTests( ConfigData const& config ) { if( config.filters.empty() ) std::cout << "All available test cases:\n"; else @@ -100,7 +100,7 @@ namespace Catch { std::cout << pluralise( matchedTests, "matching test case" ) << std::endl; } - inline void listTags( const ConfigData& config ) { + inline void listTags( ConfigData const& config ) { if( config.filters.empty() ) std::cout << "All available tags:\n"; else @@ -152,7 +152,7 @@ namespace Catch { std::cout << pluralise( tagCounts.size(), "tag" ) << std::endl; } - inline void listReporters( const ConfigData& /*config*/ ) { + inline void listReporters( ConfigData const& /*config*/ ) { std::cout << "Available reports:\n"; IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); IReporterRegistry::FactoryMap::const_iterator it = factories.begin(), itEnd = factories.end(); @@ -163,7 +163,7 @@ namespace Catch { std::cout << std::endl; } - inline void list( const ConfigData& config ) { + inline void list( ConfigData const& config ) { if( config.listSpec & List::Tests ) listTests( config ); if( config.listSpec & List::Tags ) diff --git a/include/internal/catch_matchers.hpp b/include/internal/catch_matchers.hpp index 667224db..55d592a3 100644 --- a/include/internal/catch_matchers.hpp +++ b/include/internal/catch_matchers.hpp @@ -27,7 +27,7 @@ namespace Matchers { struct MatcherImpl : Matcher { virtual Ptr > clone() const { - return Ptr >( new DerivedT( static_cast( *this ) ) ); + return Ptr >( new DerivedT( static_cast( *this ) ) ); } }; @@ -38,13 +38,13 @@ namespace Matchers { public: AllOf() {} - AllOf( const AllOf& other ) : m_matchers( other.m_matchers ) {} + AllOf( AllOf const& other ) : m_matchers( other.m_matchers ) {} - AllOf& add( const Matcher& matcher ) { + AllOf& add( Matcher const& matcher ) { m_matchers.push_back( matcher.clone() ); return *this; } - virtual bool match( const ExpressionT& expr ) const + virtual bool match( ExpressionT const& expr ) const { for( std::size_t i = 0; i < m_matchers.size(); ++i ) if( !m_matchers[i]->match( expr ) ) @@ -72,13 +72,13 @@ namespace Matchers { public: AnyOf() {} - AnyOf( const AnyOf& other ) : m_matchers( other.m_matchers ) {} + AnyOf( AnyOf const& other ) : m_matchers( other.m_matchers ) {} - AnyOf& add( const Matcher& matcher ) { + AnyOf& add( Matcher const& matcher ) { m_matchers.push_back( matcher.clone() ); return *this; } - virtual bool match( const ExpressionT& expr ) const + virtual bool match( ExpressionT const& expr ) const { for( std::size_t i = 0; i < m_matchers.size(); ++i ) if( m_matchers[i]->match( expr ) ) @@ -105,16 +105,16 @@ namespace Matchers { namespace StdString { - inline std::string makeString( const std::string& str ) { return str; } + inline std::string makeString( std::string const& str ) { return str; } inline std::string makeString( const char* str ) { return str ? std::string( str ) : std::string(); } struct Equals : MatcherImpl { - Equals( const std::string& str ) : m_str( str ){} - Equals( const Equals& other ) : m_str( other.m_str ){} + Equals( std::string const& str ) : m_str( str ){} + Equals( Equals const& other ) : m_str( other.m_str ){} virtual ~Equals(); - virtual bool match( const std::string& expr ) const { + virtual bool match( std::string const& expr ) const { return m_str == expr; } virtual std::string toString() const { @@ -125,12 +125,12 @@ namespace Matchers { }; struct Contains : MatcherImpl { - Contains( const std::string& substr ) : m_substr( substr ){} - Contains( const Contains& other ) : m_substr( other.m_substr ){} + Contains( std::string const& substr ) : m_substr( substr ){} + Contains( Contains const& other ) : m_substr( other.m_substr ){} virtual ~Contains(); - virtual bool match( const std::string& expr ) const { + virtual bool match( std::string const& expr ) const { return expr.find( m_substr ) != std::string::npos; } virtual std::string toString() const { @@ -141,12 +141,12 @@ namespace Matchers { }; struct StartsWith : MatcherImpl { - StartsWith( const std::string& substr ) : m_substr( substr ){} - StartsWith( const StartsWith& other ) : m_substr( other.m_substr ){} + StartsWith( std::string const& substr ) : m_substr( substr ){} + StartsWith( StartsWith const& other ) : m_substr( other.m_substr ){} virtual ~StartsWith(); - virtual bool match( const std::string& expr ) const { + virtual bool match( std::string const& expr ) const { return expr.find( m_substr ) == 0; } virtual std::string toString() const { @@ -157,12 +157,12 @@ namespace Matchers { }; struct EndsWith : MatcherImpl { - EndsWith( const std::string& substr ) : m_substr( substr ){} - EndsWith( const EndsWith& other ) : m_substr( other.m_substr ){} + EndsWith( std::string const& substr ) : m_substr( substr ){} + EndsWith( EndsWith const& other ) : m_substr( other.m_substr ){} virtual ~EndsWith(); - virtual bool match( const std::string& expr ) const { + virtual bool match( std::string const& expr ) const { return expr.find( m_substr ) == expr.size() - m_substr.size(); } virtual std::string toString() const { @@ -177,47 +177,47 @@ namespace Matchers { // The following functions create the actual matcher objects. // This allows the types to be inferred template - inline Impl::Generic::AllOf AllOf( const Impl::Matcher& m1, - const Impl::Matcher& m2 ) { + inline Impl::Generic::AllOf AllOf( Impl::Matcher const& m1, + Impl::Matcher const& m2 ) { return Impl::Generic::AllOf().add( m1 ).add( m2 ); } template - inline Impl::Generic::AllOf AllOf( const Impl::Matcher& m1, - const Impl::Matcher& m2, - const Impl::Matcher& m3 ) { + inline Impl::Generic::AllOf AllOf( Impl::Matcher const& m1, + Impl::Matcher const& m2, + Impl::Matcher const& m3 ) { return Impl::Generic::AllOf().add( m1 ).add( m2 ).add( m3 ); } template - inline Impl::Generic::AnyOf AnyOf( const Impl::Matcher& m1, - const Impl::Matcher& m2 ) { + inline Impl::Generic::AnyOf AnyOf( Impl::Matcher const& m1, + Impl::Matcher const& m2 ) { return Impl::Generic::AnyOf().add( m1 ).add( m2 ); } template - inline Impl::Generic::AnyOf AnyOf( const Impl::Matcher& m1, - const Impl::Matcher& m2, - const Impl::Matcher& m3 ) { + inline Impl::Generic::AnyOf AnyOf( Impl::Matcher const& m1, + Impl::Matcher const& m2, + Impl::Matcher const& m3 ) { return Impl::Generic::AnyOf().add( m1 ).add( m2 ).add( m3 ); } - inline Impl::StdString::Equals Equals( const std::string& str ) { + inline Impl::StdString::Equals Equals( std::string const& str ) { return Impl::StdString::Equals( str ); } inline Impl::StdString::Equals Equals( const char* str ) { return Impl::StdString::Equals( Impl::StdString::makeString( str ) ); } - inline Impl::StdString::Contains Contains( const std::string& substr ) { + inline Impl::StdString::Contains Contains( std::string const& substr ) { return Impl::StdString::Contains( substr ); } inline Impl::StdString::Contains Contains( const char* substr ) { return Impl::StdString::Contains( Impl::StdString::makeString( substr ) ); } - inline Impl::StdString::StartsWith StartsWith( const std::string& substr ) { + inline Impl::StdString::StartsWith StartsWith( std::string const& substr ) { return Impl::StdString::StartsWith( substr ); } inline Impl::StdString::StartsWith StartsWith( const char* substr ) { return Impl::StdString::StartsWith( Impl::StdString::makeString( substr ) ); } - inline Impl::StdString::EndsWith EndsWith( const std::string& substr ) { + inline Impl::StdString::EndsWith EndsWith( std::string const& substr ) { return Impl::StdString::EndsWith( substr ); } inline Impl::StdString::EndsWith EndsWith( const char* substr ) { diff --git a/include/internal/catch_notimplemented_exception.h b/include/internal/catch_notimplemented_exception.h index 5aa25e0d..e543bdaf 100644 --- a/include/internal/catch_notimplemented_exception.h +++ b/include/internal/catch_notimplemented_exception.h @@ -16,7 +16,7 @@ namespace Catch { class NotImplementedException : public std::exception { public: - NotImplementedException( const SourceLineInfo& lineInfo ); + NotImplementedException( SourceLineInfo const& lineInfo ); virtual ~NotImplementedException() throw() {} diff --git a/include/internal/catch_notimplemented_exception.hpp b/include/internal/catch_notimplemented_exception.hpp index 36368e8c..7cbe8175 100644 --- a/include/internal/catch_notimplemented_exception.hpp +++ b/include/internal/catch_notimplemented_exception.hpp @@ -13,7 +13,7 @@ namespace Catch { - NotImplementedException::NotImplementedException( const SourceLineInfo& lineInfo ) + NotImplementedException::NotImplementedException( SourceLineInfo const& lineInfo ) : m_lineInfo( lineInfo ) { std::ostringstream oss; oss << lineInfo << ": function "; diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp index a25dd8cd..640b4cc2 100644 --- a/include/internal/catch_objc.hpp +++ b/include/internal/catch_objc.hpp @@ -56,13 +56,13 @@ namespace Catch { namespace Detail{ - inline bool startsWith( const std::string& str, const std::string& sub ) { + inline bool startsWith( std::string const& str, std::string const& sub ) { return str.length() > sub.length() && str.substr( 0, sub.length() ) == sub; } inline std::string getAnnotation( Class cls, - const std::string& annotationName, - const std::string& testCaseName ) { + std::string const& annotationName, + std::string const& testCaseName ) { NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()]; SEL sel = NSSelectorFromString( selStr ); arcSafeRelease( selStr ); diff --git a/include/internal/catch_option.hpp b/include/internal/catch_option.hpp index 0b01a4dc..9d6dec15 100644 --- a/include/internal/catch_option.hpp +++ b/include/internal/catch_option.hpp @@ -41,7 +41,7 @@ namespace Catch { nullableValue = NULL; } T& operator*() { return *nullableValue; } - const T& operator*() const { return *nullableValue; } + T const& operator*() const { return *nullableValue; } T* operator->() { return nullableValue; } const T* operator->() const { return nullableValue; } diff --git a/include/internal/catch_registry_hub.hpp b/include/internal/catch_registry_hub.hpp index 05d602e1..14038aff 100644 --- a/include/internal/catch_registry_hub.hpp +++ b/include/internal/catch_registry_hub.hpp @@ -20,16 +20,16 @@ namespace Catch { class RegistryHub : public IRegistryHub, public IMutableRegistryHub { - RegistryHub( const RegistryHub& ); - void operator=( const RegistryHub& ); + RegistryHub( RegistryHub const& ); + void operator=( RegistryHub const& ); public: // IRegistryHub RegistryHub() { } - virtual const IReporterRegistry& getReporterRegistry() const { + virtual IReporterRegistry const& getReporterRegistry() const { return m_reporterRegistry; } - virtual const ITestCaseRegistry& getTestCaseRegistry() const { + virtual ITestCaseRegistry const& getTestCaseRegistry() const { return m_testCaseRegistry; } virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() { @@ -37,10 +37,10 @@ namespace Catch { } public: // IMutableRegistryHub - virtual void registerReporter( const std::string& name, IReporterFactory* factory ) { + virtual void registerReporter( std::string const& name, IReporterFactory* factory ) { m_reporterRegistry.registerReporter( name, factory ); } - virtual void registerTest( const TestCase& testInfo ) { + virtual void registerTest( TestCase const& testInfo ) { m_testCaseRegistry.registerTest( testInfo ); } virtual void registerTranslator( const IExceptionTranslator* translator ) { diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp index 93e19667..f2c482b2 100644 --- a/include/internal/catch_reporter_registrars.hpp +++ b/include/internal/catch_reporter_registrars.hpp @@ -18,7 +18,7 @@ namespace Catch { class ReporterFactory : public IReporterFactory { - virtual IStreamingReporter* create( const ReporterConfig& config ) const { + virtual IStreamingReporter* create( ReporterConfig const& config ) const { return new LegacyReporterAdapter( new T( config ), config ); } @@ -29,7 +29,7 @@ namespace Catch { public: - LegacyReporterRegistrar( const std::string& name ) { + LegacyReporterRegistrar( std::string const& name ) { getMutableRegistryHub().registerReporter( name, new ReporterFactory() ); } }; @@ -50,7 +50,7 @@ namespace Catch { // In fact, ideally, please contact me anyway to let me know you've hit this - as I have // no idea who is actually using custom reporters at all (possibly no-one!). // The new interface is designed to minimise exposure to interface changes in the future. - virtual IStreamingReporter* create( const ReporterConfig& config ) const { + virtual IStreamingReporter* create( ReporterConfig const& config ) const { return new T( config ); } @@ -61,7 +61,7 @@ namespace Catch { public: - ReporterRegistrar( const std::string& name ) { + ReporterRegistrar( std::string const& name ) { getMutableRegistryHub().registerReporter( name, new ReporterFactory() ); } }; diff --git a/include/internal/catch_reporter_registry.hpp b/include/internal/catch_reporter_registry.hpp index 78219805..8298758c 100644 --- a/include/internal/catch_reporter_registry.hpp +++ b/include/internal/catch_reporter_registry.hpp @@ -22,18 +22,18 @@ namespace Catch { deleteAllValues( m_factories ); } - virtual IStreamingReporter* create( const std::string& name, const ReporterConfig& config ) const { + virtual IStreamingReporter* create( std::string const& name, ReporterConfig const& config ) const { FactoryMap::const_iterator it = m_factories.find( name ); if( it == m_factories.end() ) return NULL; return it->second->create( config ); } - void registerReporter( const std::string& name, IReporterFactory* factory ) { + void registerReporter( std::string const& name, IReporterFactory* factory ) { m_factories.insert( std::make_pair( name, factory ) ); } - const FactoryMap& getFactories() const { + FactoryMap const& getFactories() const { return m_factories; } diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index 2dcf92ae..18a3e03b 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -51,12 +51,12 @@ namespace Catch { class Runner : public IResultCapture, public IRunner { - Runner( const Runner& ); - void operator =( const Runner& ); + Runner( Runner const& ); + void operator =( Runner const& ); public: - explicit Runner( const Config& config, const Ptr& reporter ) + explicit Runner( Config const& config, Ptr const& reporter ) : m_runInfo( config.data().name ), m_context( getCurrentMutableContext() ), m_runningTest( NULL ), @@ -87,7 +87,7 @@ namespace Catch { m_reporter->testGroupEnded( TestGroupStats( GroupInfo( testSpec, groupIndex, groupsCount ), totals, aborting() ) ); } - Totals runMatching( const std::string& testSpec, std::size_t groupIndex, std::size_t groupsCount ) { + Totals runMatching( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ) { std::vector matchingTests = getRegistryHub().getTestCaseRegistry().getMatchingTestCases( testSpec ); @@ -104,7 +104,7 @@ namespace Catch { return totals; } - Totals runTest( const TestCase& testCase ) { + Totals runTest( TestCase const& testCase ) { Totals prevTotals = m_totals; std::string redirectedCout; @@ -149,22 +149,22 @@ namespace Catch { return deltaTotals; } - const Config& config() const { + Config const& config() const { return m_config; } private: // IResultCapture - virtual void acceptMessage( const MessageBuilder& messageBuilder ) { + virtual void acceptMessage( MessageBuilder const& messageBuilder ) { m_messages.push_back( messageBuilder.build() ); } - virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult, const AssertionInfo& assertionInfo ) { + virtual ResultAction::Value acceptExpression( ExpressionResultBuilder const& assertionResult, AssertionInfo const& assertionInfo ) { m_lastAssertionInfo = assertionInfo; return actOnCurrentResult( assertionResult.buildResult( assertionInfo ) ); } - virtual void assertionEnded( const AssertionResult& result ) { + virtual void assertionEnded( AssertionResult const& result ) { if( result.getResultType() == ResultWas::Ok ) { m_totals.assertions.passed++; } @@ -252,7 +252,7 @@ namespace Catch { private: - ResultAction::Value actOnCurrentResult( const AssertionResult& result ) { + ResultAction::Value actOnCurrentResult( AssertionResult const& result ) { m_lastResult = result; assertionEnded( m_lastResult ); @@ -315,7 +315,7 @@ namespace Catch { RunningTest* m_runningTest; AssertionResult m_lastResult; - const Config& m_config; + Config const& m_config; Totals m_totals; Ptr m_reporter; std::vector m_messages; diff --git a/include/internal/catch_running_test.hpp b/include/internal/catch_running_test.hpp index 8787f8e8..c5ad8a6c 100644 --- a/include/internal/catch_running_test.hpp +++ b/include/internal/catch_running_test.hpp @@ -24,7 +24,7 @@ namespace Catch { }; public: - explicit RunningTest( const TestCase& info ) + explicit RunningTest( TestCase const& info ) : m_info( info ), m_runStatus( RanAtLeastOneSection ), m_rootSection( info.getTestCaseInfo().name ), @@ -64,7 +64,7 @@ namespace Catch { } } - bool addSection( const std::string& name ) { + bool addSection( std::string const& name ) { if( m_runStatus == NothingRun ) m_runStatus = EncounteredASection; @@ -78,7 +78,7 @@ namespace Catch { return false; } - void endSection( const std::string&, bool stealth ) { + void endSection( std::string const&, bool stealth ) { if( m_currentSection->ran() ) { if( !stealth ) m_runStatus = RanAtLeastOneSection; @@ -92,7 +92,7 @@ namespace Catch { m_currentSection = m_currentSection->getParent(); } - const TestCase& getTestCase() const { + TestCase const& getTestCase() const { return m_info; } @@ -105,7 +105,7 @@ namespace Catch { RunningTest( RunningTest const& ); void operator=( RunningTest const& ); - const TestCase& m_info; + TestCase const& m_info; RunStatus m_runStatus; RunningSection m_rootSection; RunningSection* m_currentSection; diff --git a/include/internal/catch_section.hpp b/include/internal/catch_section.hpp index 67bced6b..fd195364 100644 --- a/include/internal/catch_section.hpp +++ b/include/internal/catch_section.hpp @@ -18,9 +18,9 @@ namespace Catch { class Section { public: - Section( const SourceLineInfo& lineInfo, - const std::string& name, - const std::string& description = "" ) + Section( SourceLineInfo const& lineInfo, + std::string const& name, + std::string const& description = "" ) : m_info( name, description, lineInfo ), m_sectionIncluded( getCurrentContext().getResultCapture().sectionStarted( m_info, m_assertions ) ) {} diff --git a/include/internal/catch_section_info.hpp b/include/internal/catch_section_info.hpp index 7a326dfd..1ea24ee2 100644 --- a/include/internal/catch_section_info.hpp +++ b/include/internal/catch_section_info.hpp @@ -28,13 +28,13 @@ namespace Catch { TestedLeaf }; - RunningSection( RunningSection* parent, const std::string& name ) + RunningSection( RunningSection* parent, std::string const& name ) : m_state( Unknown ), m_parent( parent ), m_name( name ) {} - RunningSection( const std::string& name ) + RunningSection( std::string const& name ) : m_state( Root ), m_parent( NULL ), m_name( name ) @@ -77,7 +77,7 @@ namespace Catch { return m_parent; } - RunningSection* findOrAddSubSection( const std::string& name, bool& changed ) { + RunningSection* findOrAddSubSection( std::string const& name, bool& changed ) { for( SubSections::const_iterator it = m_subSections.begin(); it != m_subSections.end(); ++it) diff --git a/include/internal/catch_stream.hpp b/include/internal/catch_stream.hpp index b3135751..5abde5ad 100644 --- a/include/internal/catch_stream.hpp +++ b/include/internal/catch_stream.hpp @@ -57,7 +57,7 @@ namespace Catch { struct OutputDebugWriter { - void operator()( const std::string &str ) { + void operator()( std::string const&str ) { writeToDebugConsole( str ); } }; diff --git a/include/internal/catch_tags.hpp b/include/internal/catch_tags.hpp index 74d6ee4e..7b210989 100644 --- a/include/internal/catch_tags.hpp +++ b/include/internal/catch_tags.hpp @@ -24,7 +24,7 @@ namespace Catch { public: virtual ~TagParser(); - void parse( const std::string& str ) { + void parse( std::string const& str ) { std::size_t pos = 0; while( pos < str.size() ) { char c = str[pos]; @@ -48,7 +48,7 @@ namespace Catch { } protected: - virtual void acceptTag( const std::string& tag ) = 0; + virtual void acceptTag( std::string const& tag ) = 0; virtual void acceptChar( char c ) = 0; virtual void endParse() {} @@ -69,14 +69,14 @@ namespace Catch { } private: - virtual void acceptTag( const std::string& tag ) { + virtual void acceptTag( std::string const& tag ) { m_tags.insert( toLower( tag ) ); } virtual void acceptChar( char c ) { m_remainder += c; } - TagExtracter& operator=(const TagExtracter&); + TagExtracter& operator=(TagExtracter const&); std::set& m_tags; std::string m_remainder; @@ -88,7 +88,7 @@ namespace Catch { : m_isNegated( false ) {} - Tag( const std::string& name, bool isNegated ) + Tag( std::string const& name, bool isNegated ) : m_name( name ), m_isNegated( isNegated ) {} @@ -112,7 +112,7 @@ namespace Catch { class TagSet { typedef std::map TagMap; public: - void add( const Tag& tag ) { + void add( Tag const& tag ) { m_tags.insert( std::make_pair( toLower( tag.getName() ), tag ) ); } @@ -120,7 +120,7 @@ namespace Catch { return m_tags.empty(); } - bool matches( const std::set& tags ) const { + bool matches( std::set const& tags ) const { TagMap::const_iterator it = m_tags.begin(); TagMap::const_iterator itEnd = m_tags.end(); for(; it != itEnd; ++it ) { @@ -137,7 +137,7 @@ namespace Catch { class TagExpression { public: - bool matches( const std::set& tags ) const { + bool matches( std::set const& tags ) const { std::vector::const_iterator it = m_tagSets.begin(); std::vector::const_iterator itEnd = m_tagSets.end(); for(; it != itEnd; ++it ) @@ -162,7 +162,7 @@ namespace Catch { ~TagExpressionParser(); private: - virtual void acceptTag( const std::string& tag ) { + virtual void acceptTag( std::string const& tag ) { m_currentTagSet.add( Tag( tag, m_isNegated ) ); m_isNegated = false; } @@ -181,7 +181,7 @@ namespace Catch { m_exp.m_tagSets.push_back( m_currentTagSet ); } - TagExpressionParser& operator=(const TagExpressionParser&); + TagExpressionParser& operator=(TagExpressionParser const&); bool m_isNegated; TagSet m_currentTagSet; diff --git a/include/internal/catch_test_case_info.h b/include/internal/catch_test_case_info.h index ba804b19..72d73f01 100644 --- a/include/internal/catch_test_case_info.h +++ b/include/internal/catch_test_case_info.h @@ -24,14 +24,14 @@ namespace Catch { struct ITestCase; struct TestCaseInfo { - TestCaseInfo( const std::string& _name, - const std::string& _className, - const std::string& _description, - const std::set& _tags, + TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::set const& _tags, bool _isHidden, - const SourceLineInfo& _lineInfo ); + SourceLineInfo const& _lineInfo ); - TestCaseInfo( const TestCaseInfo& other ); + TestCaseInfo( TestCaseInfo const& other ); std::string name; std::string className; @@ -45,34 +45,34 @@ namespace Catch { class TestCase : protected TestCaseInfo { public: - TestCase( ITestCase* testCase, const TestCaseInfo& info ); - TestCase( const TestCase& other ); + TestCase( ITestCase* testCase, TestCaseInfo const& info ); + TestCase( TestCase const& other ); - TestCase withName( const std::string& _newName ) const; + TestCase withName( std::string const& _newName ) const; void invoke() const; - const TestCaseInfo& getTestCaseInfo() const; + TestCaseInfo const& getTestCaseInfo() const; bool isHidden() const; - bool hasTag( const std::string& tag ) const; - bool matchesTags( const std::string& tagPattern ) const; - const std::set& getTags() const; + bool hasTag( std::string const& tag ) const; + bool matchesTags( std::string const& tagPattern ) const; + std::set const& getTags() const; void swap( TestCase& other ); - bool operator == ( const TestCase& other ) const; - bool operator < ( const TestCase& other ) const; - TestCase& operator = ( const TestCase& other ); + bool operator == ( TestCase const& other ) const; + bool operator < ( TestCase const& other ) const; + TestCase& operator = ( TestCase const& other ); private: Ptr test; }; TestCase makeTestCase( ITestCase* testCase, - const std::string& className, - const std::string& name, - const std::string& description, - const SourceLineInfo& lineInfo ); + std::string const& className, + std::string const& name, + std::string const& description, + SourceLineInfo const& lineInfo ); } #ifdef __clang__ diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp index a5412b6f..d3a2719b 100644 --- a/include/internal/catch_test_case_info.hpp +++ b/include/internal/catch_test_case_info.hpp @@ -16,10 +16,10 @@ namespace Catch { TestCase makeTestCase( ITestCase* _testCase, - const std::string& _className, - const std::string& _name, - const std::string& _descOrTags, - const SourceLineInfo& _lineInfo ) + std::string const& _className, + std::string const& _name, + std::string const& _descOrTags, + SourceLineInfo const& _lineInfo ) { std::string desc = _descOrTags; bool isHidden( startsWith( _name, "./" ) ); @@ -32,12 +32,12 @@ namespace Catch { return TestCase( _testCase, info ); } - TestCaseInfo::TestCaseInfo( const std::string& _name, - const std::string& _className, - const std::string& _description, - const std::set& _tags, + TestCaseInfo::TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::set const& _tags, bool _isHidden, - const SourceLineInfo& _lineInfo ) + SourceLineInfo const& _lineInfo ) : name( _name ), className( _className ), description( _description ), @@ -51,7 +51,7 @@ namespace Catch { tagsAsString = oss.str(); } - TestCaseInfo::TestCaseInfo( const TestCaseInfo& other ) + TestCaseInfo::TestCaseInfo( TestCaseInfo const& other ) : name( other.name ), className( other.className ), description( other.description ), @@ -61,14 +61,14 @@ namespace Catch { isHidden( other.isHidden ) {} - TestCase::TestCase( ITestCase* testCase, const TestCaseInfo& info ) : TestCaseInfo( info ), test( testCase ) {} + TestCase::TestCase( ITestCase* testCase, TestCaseInfo const& info ) : TestCaseInfo( info ), test( testCase ) {} - TestCase::TestCase( const TestCase& other ) + TestCase::TestCase( TestCase const& other ) : TestCaseInfo( other ), test( other.test ) {} - TestCase TestCase::withName( const std::string& _newName ) const { + TestCase TestCase::withName( std::string const& _newName ) const { TestCase other( *this ); other.name = _newName; return other; @@ -82,15 +82,15 @@ namespace Catch { return TestCaseInfo::isHidden; } - bool TestCase::hasTag( const std::string& tag ) const { + bool TestCase::hasTag( std::string const& tag ) const { return tags.find( toLower( tag ) ) != tags.end(); } - bool TestCase::matchesTags( const std::string& tagPattern ) const { + bool TestCase::matchesTags( std::string const& tagPattern ) const { TagExpression exp; TagExpressionParser( exp ).parse( tagPattern ); return exp.matches( tags ); } - const std::set& TestCase::getTags() const { + std::set const& TestCase::getTags() const { return tags; } @@ -102,22 +102,22 @@ namespace Catch { std::swap( lineInfo, other.lineInfo ); } - bool TestCase::operator == ( const TestCase& other ) const { + bool TestCase::operator == ( TestCase const& other ) const { return test.get() == other.test.get() && name == other.name && className == other.className; } - bool TestCase::operator < ( const TestCase& other ) const { + bool TestCase::operator < ( TestCase const& other ) const { return name < other.name; } - TestCase& TestCase::operator = ( const TestCase& other ) { + TestCase& TestCase::operator = ( TestCase const& other ) { TestCase temp( other ); swap( temp ); return *this; } - const TestCaseInfo& TestCase::getTestCaseInfo() const + TestCaseInfo const& TestCase::getTestCaseInfo() const { return *this; } diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index ffccb284..0f09369d 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -25,7 +25,7 @@ namespace Catch { TestRegistry() : m_unnamedCount( 0 ) {} virtual ~TestRegistry(); - virtual void registerTest( const TestCase& testCase ) { + virtual void registerTest( TestCase const& testCase ) { std::string name = testCase.getTestCaseInfo().name; if( name == "" ) { std::ostringstream oss; @@ -40,7 +40,7 @@ namespace Catch { m_nonHiddenFunctions.push_back( testCase ); } else { - const TestCase& prev = *m_functions.find( testCase ); + TestCase const& prev = *m_functions.find( testCase ); std::cerr << "error: TEST_CASE( \"" << name << "\" ) already defined.\n" << "\tFirst seen at " << SourceLineInfo( prev.getTestCaseInfo().lineInfo ) << "\n" << "\tRedefined at " << SourceLineInfo( testCase.getTestCaseInfo().lineInfo ) << std::endl; @@ -48,23 +48,23 @@ namespace Catch { } } - virtual const std::vector& getAllTests() const { + virtual std::vector const& getAllTests() const { return m_functionsInOrder; } - virtual const std::vector& getAllNonHiddenTests() const { + virtual std::vector const& getAllNonHiddenTests() const { return m_nonHiddenFunctions; } // !TBD deprecated - virtual std::vector getMatchingTestCases( const std::string& rawTestSpec ) const { + virtual std::vector getMatchingTestCases( std::string const& rawTestSpec ) const { std::vector matchingTests; getMatchingTestCases( rawTestSpec, matchingTests ); return matchingTests; } // !TBD deprecated - virtual void getMatchingTestCases( const std::string& rawTestSpec, std::vector& matchingTestsOut ) const { + virtual void getMatchingTestCases( std::string const& rawTestSpec, std::vector& matchingTestsOut ) const { TestCaseFilter filter( rawTestSpec ); std::vector::const_iterator it = m_functionsInOrder.begin(); @@ -75,7 +75,7 @@ namespace Catch { } } } - virtual void getMatchingTestCases( const TestCaseFilters& filters, std::vector& matchingTestsOut ) const { + virtual void getMatchingTestCases( TestCaseFilters const& filters, std::vector& matchingTestsOut ) const { std::vector::const_iterator it = m_functionsInOrder.begin(); std::vector::const_iterator itEnd = m_functionsInOrder.end(); // !TBD: replace with algorithm @@ -109,7 +109,7 @@ namespace Catch { TestFunction m_fun; }; - inline std::string extractClassName( const std::string& classOrQualifiedMethodName ) { + inline std::string extractClassName( std::string const& classOrQualifiedMethodName ) { std::string className = classOrQualifiedMethodName; if( className[0] == '&' ) { diff --git a/include/internal/catch_test_registry.hpp b/include/internal/catch_test_registry.hpp index ff0e3e87..65fe760f 100644 --- a/include/internal/catch_test_registry.hpp +++ b/include/internal/catch_test_registry.hpp @@ -67,8 +67,8 @@ struct AutoReg { ~AutoReg(); private: - AutoReg( const AutoReg& ); - void operator= ( const AutoReg& ); + AutoReg( AutoReg const& ); + void operator= ( AutoReg const& ); }; } // end namespace Catch diff --git a/include/internal/catch_test_spec.h b/include/internal/catch_test_spec.h index 66839705..36dc55c4 100644 --- a/include/internal/catch_test_spec.h +++ b/include/internal/catch_test_spec.h @@ -32,7 +32,7 @@ namespace Catch { }; public: - TestCaseFilter( const std::string& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour ) + TestCaseFilter( std::string const& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour ) : m_stringToMatch( toLower( testSpec ) ), m_filterType( matchBehaviour ), m_wildcardPosition( NoWildcard ) @@ -65,7 +65,7 @@ namespace Catch { return m_filterType; } - bool shouldInclude( const TestCase& testCase ) const { + bool shouldInclude( TestCase const& testCase ) const { return isMatch( testCase ) == (m_filterType == IfFilterMatches::IncludeTests); } private: @@ -75,7 +75,7 @@ namespace Catch { #pragma clang diagnostic ignored "-Wunreachable-code" #endif - bool isMatch( const TestCase& testCase ) const { + bool isMatch( TestCase const& testCase ) const { std::string name = testCase.getTestCaseInfo().name; toLowerInPlace( name ); @@ -103,27 +103,27 @@ namespace Catch { class TestCaseFilters { public: - TestCaseFilters( const std::string& name ) : m_name( name ) {} + TestCaseFilters( std::string const& name ) : m_name( name ) {} std::string getName() const { return m_name; } - void addFilter( const TestCaseFilter& filter ) { + void addFilter( TestCaseFilter const& filter ) { if( filter.getFilterType() == IfFilterMatches::ExcludeTests ) m_exclusionFilters.push_back( filter ); else m_inclusionFilters.push_back( filter ); } - void addTags( const std::string& tagPattern ) { + void addTags( std::string const& tagPattern ) { TagExpression exp; TagExpressionParser( exp ).parse( tagPattern ); m_tagExpressions.push_back( exp ); } - bool shouldInclude( const TestCase& testCase ) const { + bool shouldInclude( TestCase const& testCase ) const { if( !m_tagExpressions.empty() ) { std::vector::const_iterator it = m_tagExpressions.begin(); std::vector::const_iterator itEnd = m_tagExpressions.end(); diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index 5d3bf39a..fef7ad3a 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -56,7 +56,7 @@ namespace Detail { template struct IsStreamInsertable { static std::ostream &s; - static T const &t; + static T const&t; enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) }; }; @@ -112,7 +112,7 @@ struct StringMaker > { namespace Detail { template - inline std::string makeString( const T& value ) { + inline std::string makeString( T const& value ) { return StringMaker::convert( value ); } } // end namespace Detail @@ -125,17 +125,17 @@ namespace Detail { /// Overload (not specialise) this template for custom typs that you don't want /// to provide an ostream overload for. template -std::string toString( const T& value ) { +std::string toString( T const& value ) { return StringMaker::convert( value ); } // Built in overloads -inline std::string toString( const std::string& value ) { +inline std::string toString( std::string const& value ) { return "\"" + value + "\""; } -inline std::string toString( const std::wstring& value ) { +inline std::string toString( std::wstring const& value ) { std::ostringstream oss; oss << "\""; for(size_t i = 0; i < value.size(); ++i ) diff --git a/include/internal/catch_totals.hpp b/include/internal/catch_totals.hpp index 03832a2e..2d10f7f9 100644 --- a/include/internal/catch_totals.hpp +++ b/include/internal/catch_totals.hpp @@ -15,13 +15,13 @@ namespace Catch { struct Counts { Counts() : passed( 0 ), failed( 0 ) {} - Counts operator - ( const Counts& other ) const { + Counts operator - ( Counts const& other ) const { Counts diff; diff.passed = passed - other.passed; diff.failed = failed - other.failed; return diff; } - Counts& operator += ( const Counts& other ) { + Counts& operator += ( Counts const& other ) { passed += other.passed; failed += other.failed; return *this; @@ -37,14 +37,14 @@ namespace Catch { struct Totals { - Totals operator - ( const Totals& other ) const { + Totals operator - ( Totals const& other ) const { Totals diff; diff.assertions = assertions - other.assertions; diff.testCases = testCases - other.testCases; return diff; } - Totals delta( const Totals& prevTotals ) const { + Totals delta( Totals const& prevTotals ) const { Totals diff = *this - prevTotals; if( diff.assertions.failed > 0 ) ++diff.testCases.failed; @@ -53,7 +53,7 @@ namespace Catch { return diff; } - Totals& operator += ( const Totals& other ) { + Totals& operator += ( Totals const& other ) { assertions += other.assertions; testCases += other.testCases; return *this; diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp index 98e827f4..5e43b88e 100644 --- a/include/internal/catch_xmlwriter.hpp +++ b/include/internal/catch_xmlwriter.hpp @@ -24,7 +24,7 @@ namespace Catch { : m_writer( writer ) {} - ScopedElement( const ScopedElement& other ) + ScopedElement( ScopedElement const& other ) : m_writer( other.m_writer ){ other.m_writer = NULL; } @@ -34,13 +34,13 @@ namespace Catch { m_writer->endElement(); } - ScopedElement& writeText( const std::string& text, bool indent = true ) { + ScopedElement& writeText( std::string const& text, bool indent = true ) { m_writer->writeText( text, indent ); return *this; } template - ScopedElement& writeAttribute( const std::string& name, const T& attribute ) { + ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { m_writer->writeAttribute( name, attribute ); return *this; } @@ -66,7 +66,7 @@ namespace Catch { endElement(); } - XmlWriter& operator = ( const XmlWriter& other ) { + XmlWriter& operator = ( XmlWriter const& other ) { XmlWriter temp( other ); swap( temp ); return *this; @@ -80,7 +80,7 @@ namespace Catch { std::swap( m_os, other.m_os ); } - XmlWriter& startElement( const std::string& name ) { + XmlWriter& startElement( std::string const& name ) { ensureTagClosed(); newlineIfNecessary(); stream() << m_indent << "<" << name; @@ -90,7 +90,7 @@ namespace Catch { return *this; } - ScopedElement scopedElement( const std::string& name ) { + ScopedElement scopedElement( std::string const& name ) { ScopedElement scoped( this ); startElement( name ); return scoped; @@ -110,7 +110,7 @@ namespace Catch { return *this; } - XmlWriter& writeAttribute( const std::string& name, const std::string& attribute ) { + XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ) { if( !name.empty() && !attribute.empty() ) { stream() << " " << name << "=\""; writeEncodedText( attribute ); @@ -119,19 +119,19 @@ namespace Catch { return *this; } - XmlWriter& writeAttribute( const std::string& name, bool attribute ) { + XmlWriter& writeAttribute( std::string const& name, bool attribute ) { stream() << " " << name << "=\"" << ( attribute ? "true" : "false" ) << "\""; return *this; } template - XmlWriter& writeAttribute( const std::string& name, const T& attribute ) { + XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { if( !name.empty() ) stream() << " " << name << "=\"" << attribute << "\""; return *this; } - XmlWriter& writeText( const std::string& text, bool indent = true ) { + XmlWriter& writeText( std::string const& text, bool indent = true ) { if( !text.empty() ){ bool tagWasOpen = m_tagIsOpen; ensureTagClosed(); @@ -143,7 +143,7 @@ namespace Catch { return *this; } - XmlWriter& writeComment( const std::string& text ) { + XmlWriter& writeComment( std::string const& text ) { ensureTagClosed(); stream() << m_indent << ""; m_needsNewline = true; @@ -176,7 +176,7 @@ namespace Catch { } } - void writeEncodedText( const std::string& text ) { + void writeEncodedText( std::string const& text ) { static const char* charsToEncode = "<&\""; std::string mtext = text; std::string::size_type pos = mtext.find_first_of( charsToEncode );