Renamed MutableResultInfo to ResultInfoBuilder

This commit is contained in:
Phil Nash 2012-05-08 19:32:18 +01:00
parent b5d367206b
commit e83f839741
4 changed files with 31 additions and 31 deletions

View File

@ -34,7 +34,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
Expression Expression
( (
MutableResultInfo& result, ResultInfoBuilder& result,
T lhs T lhs
) )
: m_result( result ), : m_result( result ),
@ -44,7 +44,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator == ResultInfoBuilder& operator ==
( (
const RhsT& rhs const RhsT& rhs
) )
@ -54,7 +54,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator != ResultInfoBuilder& operator !=
( (
const RhsT& rhs const RhsT& rhs
) )
@ -64,7 +64,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator < ResultInfoBuilder& operator <
( (
const RhsT& rhs const RhsT& rhs
) )
@ -74,7 +74,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator > ResultInfoBuilder& operator >
( (
const RhsT& rhs const RhsT& rhs
) )
@ -84,7 +84,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator <= ResultInfoBuilder& operator <=
( (
const RhsT& rhs const RhsT& rhs
) )
@ -94,7 +94,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator >= ResultInfoBuilder& operator >=
( (
const RhsT& rhs const RhsT& rhs
) )
@ -103,7 +103,7 @@ public:
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
MutableResultInfo& operator == ResultInfoBuilder& operator ==
( (
bool rhs bool rhs
) )
@ -112,7 +112,7 @@ public:
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
MutableResultInfo& operator != ResultInfoBuilder& operator !=
( (
bool rhs bool rhs
) )
@ -121,7 +121,7 @@ public:
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
operator MutableResultInfo& operator ResultInfoBuilder&
() ()
{ {
return m_result.captureBoolExpression( m_lhs ); return m_result.captureBoolExpression( m_lhs );
@ -142,7 +142,7 @@ public:
); );
private: private:
MutableResultInfo& m_result; ResultInfoBuilder& m_result;
T m_lhs; T m_lhs;
}; };
@ -154,7 +154,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
PtrExpression PtrExpression
( (
MutableResultInfo& result, ResultInfoBuilder& result,
const LhsT* lhs const LhsT* lhs
) )
: m_result( &result ), : m_result( &result ),
@ -163,7 +163,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator == ResultInfoBuilder& operator ==
( (
const RhsT* rhs const RhsT* rhs
) )
@ -173,7 +173,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// This catches NULL // This catches NULL
MutableResultInfo& operator == ResultInfoBuilder& operator ==
( (
LhsT* rhs LhsT* rhs
) )
@ -183,7 +183,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template<typename RhsT> template<typename RhsT>
MutableResultInfo& operator != ResultInfoBuilder& operator !=
( (
const RhsT* rhs const RhsT* rhs
) )
@ -193,7 +193,7 @@ public:
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// This catches NULL // This catches NULL
MutableResultInfo& operator != ResultInfoBuilder& operator !=
( (
LhsT* rhs LhsT* rhs
) )
@ -202,7 +202,7 @@ public:
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
operator MutableResultInfo& operator ResultInfoBuilder&
() ()
{ {
return m_result->captureBoolExpression( m_lhs ); return m_result->captureBoolExpression( m_lhs );
@ -210,7 +210,7 @@ public:
private: private:
MutableResultInfo* m_result; ResultInfoBuilder* m_result;
const LhsT* m_lhs; const LhsT* m_lhs;
}; };
@ -348,7 +348,7 @@ public:
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
operator MutableResultInfo& operator ResultInfoBuilder&
() ()
{ {
m_result.setMessage( m_messageStream.str() ); m_result.setMessage( m_messageStream.str() );
@ -356,7 +356,7 @@ public:
} }
private: private:
MutableResultInfo m_result; ResultInfoBuilder m_result;
std::ostringstream m_messageStream; std::ostringstream m_messageStream;
}; };

View File

@ -20,7 +20,7 @@ namespace Catch
{ {
class TestCaseInfo; class TestCaseInfo;
class ScopedInfo; class ScopedInfo;
class MutableResultInfo; class ResultInfoBuilder;
class ResultInfo; class ResultInfo;
struct IResultCapture struct IResultCapture
@ -58,7 +58,7 @@ namespace Catch
( ResultWas::OfType result ( ResultWas::OfType result
) = 0; ) = 0;
virtual ResultAction::Value acceptExpression virtual ResultAction::Value acceptExpression
( const MutableResultInfo& resultInfo ( const ResultInfoBuilder& resultInfo
) = 0; ) = 0;
virtual void acceptMessage virtual void acceptMessage
( const std::string& msg ( const std::string& msg

View File

@ -19,13 +19,13 @@ namespace Catch
struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison; struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison;
class MutableResultInfo : public ResultInfo class ResultInfoBuilder : public ResultInfo
{ {
public: public:
MutableResultInfo() {} ResultInfoBuilder() {}
MutableResultInfo( const char* expr, ResultInfoBuilder( const char* expr,
bool isNot, bool isNot,
const SourceLineInfo& lineInfo, const SourceLineInfo& lineInfo,
const char* macroName, const char* macroName,
@ -81,7 +81,7 @@ private:
template<typename T> friend class PtrExpression; template<typename T> friend class PtrExpression;
MutableResultInfo& captureBoolExpression( bool result ) { ResultInfoBuilder& captureBoolExpression( bool result ) {
m_lhs = Catch::toString( result ); m_lhs = Catch::toString( result );
m_op = m_isNot ? "!" : ""; m_op = m_isNot ? "!" : "";
setResultType( result ? ResultWas::Ok : ResultWas::ExpressionFailed ); setResultType( result ? ResultWas::Ok : ResultWas::ExpressionFailed );
@ -89,7 +89,7 @@ private:
} }
template<Internal::Operator Op, typename T1, typename T2> template<Internal::Operator Op, typename T1, typename T2>
MutableResultInfo& captureExpression( const T1& lhs, const T2& rhs ) { ResultInfoBuilder& captureExpression( const T1& lhs, const T2& rhs ) {
setResultType( Internal::compare<Op>( lhs, rhs ) ? ResultWas::Ok : ResultWas::ExpressionFailed ); setResultType( Internal::compare<Op>( lhs, rhs ) ? ResultWas::Ok : ResultWas::ExpressionFailed );
m_lhs = Catch::toString( lhs ); m_lhs = Catch::toString( lhs );
m_rhs = Catch::toString( rhs ); m_rhs = Catch::toString( rhs );
@ -98,7 +98,7 @@ private:
} }
template<Internal::Operator Op, typename T> template<Internal::Operator Op, typename T>
MutableResultInfo& captureExpression( const T* lhs, int rhs ) { ResultInfoBuilder& captureExpression( const T* lhs, int rhs ) {
return captureExpression<Op>( lhs, reinterpret_cast<const T*>( rhs ) ); return captureExpression<Op>( lhs, reinterpret_cast<const T*>( rhs ) );
} }
}; };

View File

@ -198,7 +198,7 @@ namespace Catch
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
virtual ResultAction::Value acceptExpression virtual ResultAction::Value acceptExpression
( (
const MutableResultInfo& resultInfo const ResultInfoBuilder& resultInfo
) )
{ {
m_currentResult = resultInfo; m_currentResult = resultInfo;
@ -328,7 +328,7 @@ namespace Catch
testEnded( m_currentResult ); testEnded( m_currentResult );
m_lastResult = m_currentResult; m_lastResult = m_currentResult;
m_currentResult = MutableResultInfo(); m_currentResult = ResultInfoBuilder();
if( m_lastResult.ok() ) if( m_lastResult.ok() )
return ResultAction::None; return ResultAction::None;
else if( shouldDebugBreak() ) else if( shouldDebugBreak() )
@ -373,7 +373,7 @@ namespace Catch
private: private:
RunningTest* m_runningTest; RunningTest* m_runningTest;
MutableResultInfo m_currentResult; ResultInfoBuilder m_currentResult;
ResultInfo m_lastResult; ResultInfo m_lastResult;
const Config& m_config; const Config& m_config;