diff --git a/Test/ConditionTests.cpp b/Test/ConditionTests.cpp index 3a92ebff..f7247f89 100644 --- a/Test/ConditionTests.cpp +++ b/Test/ConditionTests.cpp @@ -56,8 +56,8 @@ TEST_CASE( "./failing/conditions/equality", "Equality checks that should fail" ) CHECK( data.int_seven == 0 ); CHECK( data.float_nine_point_one == Approx( 9.11f ) ); CHECK( data.float_nine_point_one == Approx( 9.0f ) ); - CHECK( data.float_nine_point_one == 1 ); - CHECK( data.float_nine_point_one == 0 ); + CHECK( data.float_nine_point_one == Approx( 1 ) ); + CHECK( data.float_nine_point_one == Approx( 0 ) ); CHECK( data.double_pi == Approx( 3.1415 ) ); CHECK( data.str_hello == "goodbye" ); CHECK( data.str_hello == "hell" ); @@ -76,8 +76,8 @@ TEST_CASE( "./succeeding/conditions/inequality", "Inequality checks that should REQUIRE( data.int_seven != 8 ); REQUIRE( data.float_nine_point_one != Approx( 9.11f ) ); REQUIRE( data.float_nine_point_one != Approx( 9.0f ) ); - REQUIRE( data.float_nine_point_one != 1 ); - REQUIRE( data.float_nine_point_one != 0 ); + REQUIRE( data.float_nine_point_one != Approx( 1 ) ); + REQUIRE( data.float_nine_point_one != Approx( 0 ) ); REQUIRE( data.double_pi != Approx( 3.1415 ) ); REQUIRE( data.str_hello != "goodbye" ); REQUIRE( data.str_hello != "hell" ); diff --git a/catch_reporter_junit.hpp b/catch_reporter_junit.hpp index 871f844f..a232f783 100644 --- a/catch_reporter_junit.hpp +++ b/catch_reporter_junit.hpp @@ -23,46 +23,46 @@ namespace Catch { struct TestStats { - std::string element; - std::string resultType; - std::string message; - std::string content; + std::string m_element; + std::string m_resultType; + std::string m_message; + std::string m_content; }; struct TestCaseStats { TestCaseStats( const std::string& name = std::string() ) - : name( name ) + : m_name( name ) { } - double timeInSeconds; - std::string status; - std::string className; - std::string name; - std::vector testStats; + double m_timeInSeconds; + std::string m_status; + std::string m_className; + std::string m_name; + std::vector m_testStats; }; struct Stats { Stats( const std::string& name = std::string() ) - : testsCount( 0 ), - failuresCount( 0 ), - disabledCount( 0 ), - errorsCount( 0 ), - timeInSeconds( 0 ), - name( name ) + : m_testsCount( 0 ), + m_failuresCount( 0 ), + m_disabledCount( 0 ), + m_errorsCount( 0 ), + m_timeInSeconds( 0 ), + m_name( name ) { } - std::size_t testsCount; - std::size_t failuresCount; - std::size_t disabledCount; - std::size_t errorsCount; - double timeInSeconds; - std::string name; + std::size_t m_testsCount; + std::size_t m_failuresCount; + std::size_t m_disabledCount; + std::size_t m_errorsCount; + double m_timeInSeconds; + std::string m_name; - std::vector testCaseStats; + std::vector m_testCaseStats; }; public: @@ -98,7 +98,7 @@ namespace Catch /////////////////////////////////////////////////////////////////////////// virtual void EndGroup( const std::string&, std::size_t succeeded, std::size_t failed ) { - m_currentStats->testsCount = failed+succeeded; + m_currentStats->m_testsCount = failed+succeeded; m_currentStats = &m_testSuiteStats; } @@ -113,7 +113,7 @@ namespace Catch /////////////////////////////////////////////////////////////////////////// virtual void StartTestCase( const Catch::TestCaseInfo& testInfo ) { - m_currentStats->testCaseStats.push_back( TestCaseStats( testInfo.getName() ) ); + m_currentStats->m_testCaseStats.push_back( TestCaseStats( testInfo.getName() ) ); } @@ -122,7 +122,7 @@ namespace Catch { if( resultInfo.getResultType() != ResultWas::Ok || m_config.includeSuccessfulResults() ) { - TestCaseStats& testCaseStats = m_currentStats->testCaseStats.back(); + TestCaseStats& testCaseStats = m_currentStats->m_testCaseStats.back(); TestStats stats; std::ostringstream oss; if( !resultInfo.getMessage().empty() ) @@ -130,37 +130,37 @@ namespace Catch oss << resultInfo.getMessage() << " at "; } oss << resultInfo.getFilename() << ":" << resultInfo.getLine(); - stats.content = oss.str(); - stats.message = resultInfo.getExpandedExpression(); - stats.resultType = resultInfo.getTestMacroName(); + stats.m_content = oss.str(); + stats.m_message = resultInfo.getExpandedExpression(); + stats.m_resultType = resultInfo.getTestMacroName(); switch( resultInfo.getResultType() ) { case ResultWas::ThrewException: - stats.element = "error"; - m_currentStats->errorsCount++; + stats.m_element = "error"; + m_currentStats->m_errorsCount++; break; case ResultWas::Info: - stats.element = "info"; // !TBD ? + stats.m_element = "info"; // !TBD ? break; case ResultWas::Warning: - stats.element = "warning"; // !TBD ? + stats.m_element = "warning"; // !TBD ? break; case ResultWas::ExplicitFailure: - stats.element = "failure"; - m_currentStats->failuresCount++; + stats.m_element = "failure"; + m_currentStats->m_failuresCount++; break; case ResultWas::ExpressionFailed: - stats.element = "failure"; - m_currentStats->failuresCount++; + stats.m_element = "failure"; + m_currentStats->m_failuresCount++; break; case ResultWas::Ok: - stats.element = "success"; + stats.m_element = "success"; break; default: - stats.element = "unknown"; + stats.m_element = "unknown"; break; } - testCaseStats.testStats.push_back( stats ); + testCaseStats.m_testStats.push_back( stats ); } } @@ -190,10 +190,10 @@ namespace Catch for(; it != itEnd; ++it ) { XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); - xml.writeAttribute( "name", it->name ); - xml.writeAttribute( "errors", it->errorsCount ); - xml.writeAttribute( "failures", it->failuresCount ); - xml.writeAttribute( "tests", it->testsCount ); + xml.writeAttribute( "name", it->m_name ); + xml.writeAttribute( "errors", it->m_errorsCount ); + xml.writeAttribute( "failures", it->m_failuresCount ); + xml.writeAttribute( "tests", it->m_testsCount ); xml.writeAttribute( "hostname", "tbd" ); xml.writeAttribute( "time", "tbd" ); xml.writeAttribute( "timestamp", "tbd" ); @@ -209,16 +209,16 @@ namespace Catch /////////////////////////////////////////////////////////////////////////// void OutputTestCases( XmlWriter& xml, const Stats& stats ) { - std::vector::const_iterator it = stats.testCaseStats.begin(); - std::vector::const_iterator itEnd = stats.testCaseStats.end(); + std::vector::const_iterator it = stats.m_testCaseStats.begin(); + std::vector::const_iterator itEnd = stats.m_testCaseStats.end(); for(; it != itEnd; ++it ) { xml.writeBlankLine(); xml.writeComment( "Test case" ); XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); - xml.writeAttribute( "classname", it->className ); - xml.writeAttribute( "name", it->name ); + xml.writeAttribute( "classname", it->m_className ); + xml.writeAttribute( "name", it->m_name ); xml.writeAttribute( "time", "tbd" ); OutputTestResult( xml, *it ); @@ -229,18 +229,18 @@ namespace Catch /////////////////////////////////////////////////////////////////////////// void OutputTestResult( XmlWriter& xml, const TestCaseStats& stats ) { - std::vector::const_iterator it = stats.testStats.begin(); - std::vector::const_iterator itEnd = stats.testStats.end(); + std::vector::const_iterator it = stats.m_testStats.begin(); + std::vector::const_iterator itEnd = stats.m_testStats.end(); for(; it != itEnd; ++it ) { - if( it->element != "success" ) + if( it->m_element != "success" ) { - XmlWriter::ScopedElement e = xml.scopedElement( it->element ); + XmlWriter::ScopedElement e = xml.scopedElement( it->m_element ); - xml.writeAttribute( "message", it->message ); - xml.writeAttribute( "type", it->resultType ); - if( !it->content.empty() ) - xml.writeText( it->content ); + xml.writeAttribute( "message", it->m_message ); + xml.writeAttribute( "type", it->m_resultType ); + if( !it->m_content.empty() ) + xml.writeText( it->m_content ); } } } diff --git a/catch_runner.hpp b/catch_runner.hpp index 53e17f60..03e183c5 100644 --- a/catch_runner.hpp +++ b/catch_runner.hpp @@ -28,7 +28,7 @@ namespace Catch inline int Main( int argc, char * const argv[] ) { Config config; - ArgParser( argc, argv, config ); + ArgParser( argc, argv, config ); if( !config.getMessage().empty() ) { diff --git a/internal/catch_commandline.hpp b/internal/catch_commandline.hpp index cfa34095..2cf4ae39 100644 --- a/internal/catch_commandline.hpp +++ b/internal/catch_commandline.hpp @@ -125,13 +125,13 @@ namespace Catch if( m_args.size() >= 2 ) { if( m_args[1] == "xml" ) - listSpec = (Config::List::What)( listSpec | Config::List::AsXml ); + listSpec = static_cast( listSpec | Config::List::AsXml ); else if( m_args[1] == "text" ) - listSpec = (Config::List::What)( listSpec | Config::List::AsText ); + listSpec = static_cast( listSpec | Config::List::AsText ); else return setErrorMode( m_command + " expected [xml] or [text] but recieved: [" + m_args[1] + "]" ); } - m_config.setListSpec( (Config::List::What)( m_config.getListSpec() | listSpec ) ); + m_config.setListSpec( static_cast( m_config.getListSpec() | listSpec ) ); } break; case modeTest: diff --git a/internal/catch_config.hpp b/internal/catch_config.hpp index 5f2b4916..9752ba06 100644 --- a/internal/catch_config.hpp +++ b/internal/catch_config.hpp @@ -150,13 +150,13 @@ namespace Catch /////////////////////////////////////////////////////////////////////////// List::What listWhat() const { - return (List::What)( m_listSpec & List::WhatMask ); + return static_cast( m_listSpec & List::WhatMask ); } /////////////////////////////////////////////////////////////////////////// List::What listAs() const { - return (List::What)( m_listSpec & List::AsMask ); + return static_cast( m_listSpec & List::AsMask ); } /////////////////////////////////////////////////////////////////////////// @@ -166,9 +166,9 @@ namespace Catch } /////////////////////////////////////////////////////////////////////////// - void setShouldDebugBreak( bool shouldDebugBreak ) + void setShouldDebugBreak( bool shouldDebugBreakFlag ) { - m_shouldDebugBreak = shouldDebugBreak; + m_shouldDebugBreak = shouldDebugBreakFlag; } /////////////////////////////////////////////////////////////////////////// @@ -178,9 +178,9 @@ namespace Catch } /////////////////////////////////////////////////////////////////////////// - void setShowHelp( bool showHelp ) + void setShowHelp( bool showHelpFlag ) { - m_showHelp = showHelp; + m_showHelp = showHelpFlag; } /////////////////////////////////////////////////////////////////////////// diff --git a/internal/catch_debugger.hpp b/internal/catch_debugger.hpp index 0f84041a..b79ad530 100644 --- a/internal/catch_debugger.hpp +++ b/internal/catch_debugger.hpp @@ -67,7 +67,7 @@ // The following code snippet taken from: // http://cocoawithlove.com/2008/03/break-into-debugger.html #ifdef DEBUG - #if __ppc64__ || __ppc__ + #if defined(__ppc64__) || defined(__ppc__) #define DebugBreak() \ if( Catch::AmIBeingDebugged() ) \ { \ diff --git a/internal/catch_interfaces_reporter.h b/internal/catch_interfaces_reporter.h index 0b5dbe76..f6d4c9af 100644 --- a/internal/catch_interfaces_reporter.h +++ b/internal/catch_interfaces_reporter.h @@ -24,6 +24,10 @@ namespace Catch /////////////////////////////////////////////////////////////////////////// struct IReporterConfig { + virtual ~IReporterConfig + () + {} + virtual std::ostream& stream () const = 0; diff --git a/internal/catch_interfaces_runner.h b/internal/catch_interfaces_runner.h index c81a52b4..9252f9de 100644 --- a/internal/catch_interfaces_runner.h +++ b/internal/catch_interfaces_runner.h @@ -18,6 +18,10 @@ namespace Catch { struct IRunner { + virtual ~IRunner + () + {} + virtual void runAll () = 0; diff --git a/internal/catch_interfaces_testcase.h b/internal/catch_interfaces_testcase.h index 368274d1..69366c3d 100644 --- a/internal/catch_interfaces_testcase.h +++ b/internal/catch_interfaces_testcase.h @@ -42,8 +42,16 @@ namespace Catch struct ITestCaseRegistry { - virtual void registerTest( const TestCaseInfo& testInfo ) = 0; - virtual const std::vector& getAllTests() const = 0; + virtual ~ITestCaseRegistry + () + {} + + virtual void registerTest + ( const TestCaseInfo& testInfo + ) = 0; + + virtual const std::vector& getAllTests + () const = 0; }; } diff --git a/internal/catch_stream.hpp b/internal/catch_stream.hpp index 252ccb5d..414d9737 100644 --- a/internal/catch_stream.hpp +++ b/internal/catch_stream.hpp @@ -41,7 +41,7 @@ namespace Catch if( c != EOF ) { if( pbase() == epptr() ) - m_writer( std::string( 1, (char)c ) ); + m_writer( std::string( 1, static_cast( c ) ) ); else sputc( c ); } diff --git a/internal/catch_test_case_registry_impl.hpp b/internal/catch_test_case_registry_impl.hpp index 29ff81ca..12700308 100644 --- a/internal/catch_test_case_registry_impl.hpp +++ b/internal/catch_test_case_registry_impl.hpp @@ -75,7 +75,7 @@ namespace Catch ( TestFunction fun ) - : fun( fun ) + : m_fun( fun ) {} /////////////////////////////////////////////////////////////////////////// @@ -83,7 +83,7 @@ namespace Catch () const { - fun(); + m_fun(); } /////////////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ namespace Catch () const { - return new FreeFunctionTestCase( fun ); + return new FreeFunctionTestCase( m_fun ); } /////////////////////////////////////////////////////////////////////////// @@ -102,7 +102,7 @@ namespace Catch const { const FreeFunctionTestCase* ffOther = dynamic_cast ( &other ); - return ffOther && fun == ffOther->fun; + return ffOther && m_fun == ffOther->m_fun; } /////////////////////////////////////////////////////////////////////////// @@ -113,11 +113,11 @@ namespace Catch const { const FreeFunctionTestCase* ffOther = dynamic_cast ( &other ); - return ffOther && fun < ffOther->fun; + return ffOther && m_fun < ffOther->m_fun; } private: - TestFunction fun; + TestFunction m_fun; }; /////////////////////////////////////////////////////////////////////////// diff --git a/internal/catch_test_registry.hpp b/internal/catch_test_registry.hpp index dafe193e..47085da1 100644 --- a/internal/catch_test_registry.hpp +++ b/internal/catch_test_registry.hpp @@ -22,34 +22,34 @@ template struct MethodTestCase : ITestCase { MethodTestCase( void (C::*method)() ) - : method( method ) + : m_method( method ) {} virtual void invoke() const { C obj; - (obj.*method)(); + (obj.*m_method)(); } virtual ITestCase* clone() const { - return new MethodTestCase( method ); + return new MethodTestCase( m_method ); } virtual bool operator == ( const ITestCase& other ) const { const MethodTestCase* mtOther = dynamic_cast( &other ); - return mtOther && method == mtOther->method; + return mtOther && m_method == mtOther->m_method; } virtual bool operator < ( const ITestCase& other ) const { const MethodTestCase* mtOther = dynamic_cast( &other ); - return mtOther && &method < &mtOther->method; + return mtOther && &m_method < &mtOther->m_method; } private: - void (C::*method)(); + void (C::*m_method)(); }; typedef void(*TestFunction)();