From 9e4708371e1c29e1a343a7bfeabd7fedcf0a67a6 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 11 Nov 2010 20:56:38 +0000 Subject: [PATCH] some portability fixes (thanks to Sam Saariste) --- Test/TrickyTests.cpp | 8 -------- internal/catch_capture.hpp | 6 +++--- internal/catch_commandline.hpp | 2 +- internal/catch_list.hpp | 1 + internal/catch_resultinfo.hpp | 6 +++--- internal/catch_runner_impl.hpp | 16 ++++++++-------- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/Test/TrickyTests.cpp b/Test/TrickyTests.cpp index b3cfc6f0..5e0b5efe 100644 --- a/Test/TrickyTests.cpp +++ b/Test/TrickyTests.cpp @@ -41,11 +41,3 @@ TEST_CASE( "succeeding/Tricky/complex lhs", "Where the LHS is not a simple value // This only captures part of the expression, but issues a warning about the rest EXPECT( a == 2 || b == 2 ); } - -TEST_CASE( "succeeding/Tricky/complex lhs/2", "Where the LHS is not a simple value" ) -{ - int a = 1; - - // This only captures part of the expression, but issues a warning about the rest -// EXPECT( a + 1 == 2); -} \ No newline at end of file diff --git a/internal/catch_capture.hpp b/internal/catch_capture.hpp index 6e95e3f4..f084dea4 100644 --- a/internal/catch_capture.hpp +++ b/internal/catch_capture.hpp @@ -14,7 +14,7 @@ #include "catch_resultinfo.hpp" #include -#include "math.h" +#include namespace Catch { @@ -41,7 +41,7 @@ public: MutableResultInfo() {} - MutableResultInfo( const std::string& expr, bool isNot, const std::string& filename, size_t line, const std::string& macroName ) + MutableResultInfo( const std::string& expr, bool isNot, const std::string& filename, std::size_t line, const std::string& macroName ) : ResultInfo( ( isNot ? "!" : "" ) + expr, ResultWas::Unknown, isNot, filename, line, macroName ) { } @@ -84,7 +84,7 @@ private: class ResultBuilder { public: - ResultBuilder( const char* expr, bool isNot, const std::string& filename, size_t line, const std::string& macroName ) + ResultBuilder( const char* expr, bool isNot, const std::string& filename, std::size_t line, const std::string& macroName ) : m_result( expr, isNot, filename, line, macroName ) {} diff --git a/internal/catch_commandline.hpp b/internal/catch_commandline.hpp index 28daa27e..b39046ad 100644 --- a/internal/catch_commandline.hpp +++ b/internal/catch_commandline.hpp @@ -44,7 +44,7 @@ namespace Catch : m_mode( modeNone ), m_config( config ) { - for(size_t i=1; i < argc; ++i ) + for( int i=1; i < argc; ++i ) { if( argv[i][0] == '-' ) { diff --git a/internal/catch_list.hpp b/internal/catch_list.hpp index fac602b0..a0c53715 100644 --- a/internal/catch_list.hpp +++ b/internal/catch_list.hpp @@ -15,6 +15,7 @@ #include "catch_commandline.hpp" #include + namespace Catch { inline int List( const RunnerConfig& config ) diff --git a/internal/catch_resultinfo.hpp b/internal/catch_resultinfo.hpp index 99ccc830..01d5abd1 100644 --- a/internal/catch_resultinfo.hpp +++ b/internal/catch_resultinfo.hpp @@ -44,7 +44,7 @@ namespace Catch m_expressionIncomplete( false ) {} - ResultInfo( const std::string& expr, ResultWas::OfType result, bool isNot, const std::string& filename, size_t line, const std::string& macroName ) + ResultInfo( const std::string& expr, ResultWas::OfType result, bool isNot, const std::string& filename, std::size_t line, const std::string& macroName ) : m_expr( expr ), m_result( result ), m_isNot( isNot ), @@ -95,7 +95,7 @@ namespace Catch return m_filename; } - size_t getLine() const + std::size_t getLine() const { return m_line; } @@ -119,7 +119,7 @@ namespace Catch protected: std::string m_macroName; std::string m_filename; - size_t m_line; + std::size_t m_line; std::string m_expr, m_lhs, m_rhs, m_op; std::string m_message; ResultWas::OfType m_result; diff --git a/internal/catch_runner_impl.hpp b/internal/catch_runner_impl.hpp index 14d84911..405dc355 100644 --- a/internal/catch_runner_impl.hpp +++ b/internal/catch_runner_impl.hpp @@ -63,19 +63,19 @@ namespace Catch void runAll() { std::vector allTests = TestRegistry::instance().getAllTests(); - for( size_t i=0; i < allTests.size(); ++i ) + for( std::size_t i=0; i < allTests.size(); ++i ) { runTest( allTests[i] ); } } - size_t runMatching( const std::string& rawTestSpec ) + std::size_t runMatching( const std::string& rawTestSpec ) { TestSpec testSpec( rawTestSpec ); std::vector allTests = TestRegistry::instance().getAllTests(); - size_t testsRun = 0; - for( size_t i=0; i < allTests.size(); ++i ) + std::size_t testsRun = 0; + for( std::size_t i=0; i < allTests.size(); ++i ) { if( testSpec.matches( allTests[i].getName() ) ) { @@ -114,11 +114,11 @@ namespace Catch ResultsCapture::setListener( prevListener ); } - size_t getSuccessCount() const + std::size_t getSuccessCount() const { return m_successes; } - size_t getFailures() const + std:: size_t getFailures() const { return m_failures; } @@ -136,8 +136,8 @@ namespace Catch } private: - size_t m_successes; - size_t m_failures; + std::size_t m_successes; + std::size_t m_failures; ITestReporter* m_reporter; }; }