some portability fixes (thanks to Sam Saariste)

This commit is contained in:
Phil Nash 2010-11-11 20:56:38 +00:00
parent 7d71e9b431
commit 9e4708371e
6 changed files with 16 additions and 23 deletions

View File

@ -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 // This only captures part of the expression, but issues a warning about the rest
EXPECT( a == 2 || b == 2 ); 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);
}

View File

@ -14,7 +14,7 @@
#include "catch_resultinfo.hpp" #include "catch_resultinfo.hpp"
#include <sstream> #include <sstream>
#include "math.h" #include <cmath>
namespace Catch namespace Catch
{ {
@ -41,7 +41,7 @@ public:
MutableResultInfo() 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 ) : ResultInfo( ( isNot ? "!" : "" ) + expr, ResultWas::Unknown, isNot, filename, line, macroName )
{ {
} }
@ -84,7 +84,7 @@ private:
class ResultBuilder class ResultBuilder
{ {
public: 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 ) : m_result( expr, isNot, filename, line, macroName )
{} {}

View File

@ -44,7 +44,7 @@ namespace Catch
: m_mode( modeNone ), : m_mode( modeNone ),
m_config( config ) m_config( config )
{ {
for(size_t i=1; i < argc; ++i ) for( int i=1; i < argc; ++i )
{ {
if( argv[i][0] == '-' ) if( argv[i][0] == '-' )
{ {

View File

@ -15,6 +15,7 @@
#include "catch_commandline.hpp" #include "catch_commandline.hpp"
#include <limits> #include <limits>
namespace Catch namespace Catch
{ {
inline int List( const RunnerConfig& config ) inline int List( const RunnerConfig& config )

View File

@ -44,7 +44,7 @@ namespace Catch
m_expressionIncomplete( false ) 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_expr( expr ),
m_result( result ), m_result( result ),
m_isNot( isNot ), m_isNot( isNot ),
@ -95,7 +95,7 @@ namespace Catch
return m_filename; return m_filename;
} }
size_t getLine() const std::size_t getLine() const
{ {
return m_line; return m_line;
} }
@ -119,7 +119,7 @@ namespace Catch
protected: protected:
std::string m_macroName; std::string m_macroName;
std::string m_filename; 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_expr, m_lhs, m_rhs, m_op;
std::string m_message; std::string m_message;
ResultWas::OfType m_result; ResultWas::OfType m_result;

View File

@ -63,19 +63,19 @@ namespace Catch
void runAll() void runAll()
{ {
std::vector<TestCaseInfo> allTests = TestRegistry::instance().getAllTests(); std::vector<TestCaseInfo> 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] ); runTest( allTests[i] );
} }
} }
size_t runMatching( const std::string& rawTestSpec ) std::size_t runMatching( const std::string& rawTestSpec )
{ {
TestSpec testSpec( rawTestSpec ); TestSpec testSpec( rawTestSpec );
std::vector<TestCaseInfo> allTests = TestRegistry::instance().getAllTests(); std::vector<TestCaseInfo> allTests = TestRegistry::instance().getAllTests();
size_t testsRun = 0; std::size_t testsRun = 0;
for( size_t i=0; i < allTests.size(); ++i ) for( std::size_t i=0; i < allTests.size(); ++i )
{ {
if( testSpec.matches( allTests[i].getName() ) ) if( testSpec.matches( allTests[i].getName() ) )
{ {
@ -114,11 +114,11 @@ namespace Catch
ResultsCapture::setListener( prevListener ); ResultsCapture::setListener( prevListener );
} }
size_t getSuccessCount() const std::size_t getSuccessCount() const
{ {
return m_successes; return m_successes;
} }
size_t getFailures() const std:: size_t getFailures() const
{ {
return m_failures; return m_failures;
} }
@ -136,8 +136,8 @@ namespace Catch
} }
private: private:
size_t m_successes; std::size_t m_successes;
size_t m_failures; std::size_t m_failures;
ITestReporter* m_reporter; ITestReporter* m_reporter;
}; };
} }