mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Some layout reformatting. I think everything is in my preferred style now
This commit is contained in:
		@@ -57,7 +57,11 @@ namespace Detail
 | 
				
			|||||||
    template<typename T, bool streamable>
 | 
					    template<typename T, bool streamable>
 | 
				
			||||||
    struct StringMaker
 | 
					    struct StringMaker
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        static std::string apply( const T& value )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        static std::string apply
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const T& value
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            std::ostringstream oss;
 | 
					            std::ostringstream oss;
 | 
				
			||||||
            oss << value;
 | 
					            oss << value;
 | 
				
			||||||
@@ -69,7 +73,11 @@ namespace Detail
 | 
				
			|||||||
    template<typename T>
 | 
					    template<typename T>
 | 
				
			||||||
    struct StringMaker<T, false>
 | 
					    struct StringMaker<T, false>
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        static std::string apply( const T& )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        static std::string apply
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const T&
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return "{?}";
 | 
					            return "{?}";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -77,28 +85,52 @@ namespace Detail
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}// end namespace Detail
 | 
					}// end namespace Detail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
template<typename T>
 | 
					template<typename T>
 | 
				
			||||||
std::string toString( const T& value )
 | 
					std::string toString
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					    const T& value
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return Detail::StringMaker<T, Detail::IsStreamable<T>::value>::apply( value );
 | 
					    return Detail::StringMaker<T, Detail::IsStreamable<T>::value>::apply( value );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
// Shortcut overloads
 | 
					// Shortcut overloads
 | 
				
			||||||
inline std::string toString( const std::string& value )
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					inline std::string toString
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					    const std::string& value
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return value;
 | 
					    return value;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
inline std::string toString( const char* value )
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					inline std::string toString
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					    const char* value
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return value;
 | 
					    return value;
 | 
				
			||||||
}    
 | 
					}    
 | 
				
			||||||
inline std::string toString( int value )
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					inline std::string toString
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					    int value
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::ostringstream oss;
 | 
					    std::ostringstream oss;
 | 
				
			||||||
    oss << value;
 | 
					    oss << value;
 | 
				
			||||||
    return oss.str();
 | 
					    return oss.str();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
inline std::string toString( const double value )
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					inline std::string toString
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					    const double value 
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::ostringstream oss;
 | 
					    std::ostringstream oss;
 | 
				
			||||||
    oss << value;
 | 
					    oss << value;
 | 
				
			||||||
@@ -116,14 +148,29 @@ class MutableResultInfo : public ResultInfo
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    MutableResultInfo()
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    MutableResultInfo
 | 
				
			||||||
 | 
					    ()
 | 
				
			||||||
    {}
 | 
					    {}
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    MutableResultInfo( const char* expr, bool isNot, const char* filename, std::size_t line, const char* macroName )
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    MutableResultInfo
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const char* expr, 
 | 
				
			||||||
 | 
					        bool isNot, 
 | 
				
			||||||
 | 
					        const char* filename, 
 | 
				
			||||||
 | 
					        std::size_t line, 
 | 
				
			||||||
 | 
					        const char* macroName 
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    : ResultInfo( expr, ResultWas::Unknown, isNot, filename, line, macroName )
 | 
					    : ResultInfo( expr, ResultWas::Unknown, isNot, filename, line, macroName )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    void setResultType( ResultWas::OfType result )
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    void setResultType
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        ResultWas::OfType result
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Flip bool results if isNot is set
 | 
					        // Flip bool results if isNot is set
 | 
				
			||||||
        if( m_isNot && result == ResultWas::Ok )
 | 
					        if( m_isNot && result == ResultWas::Ok )
 | 
				
			||||||
@@ -133,13 +180,22 @@ public:
 | 
				
			|||||||
        else
 | 
					        else
 | 
				
			||||||
            m_result = result;        
 | 
					            m_result = result;        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    void setMessage( const std::string& message )
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    void setMessage
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const std::string& message
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_message = message;
 | 
					        m_message = message;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename RhsT>
 | 
					    template<typename RhsT>
 | 
				
			||||||
    MutableResultInfo& operator ||( const RhsT& )
 | 
					    MutableResultInfo& operator ||
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const RhsT&
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_expressionIncomplete = true;
 | 
					        m_expressionIncomplete = true;
 | 
				
			||||||
        return *this;
 | 
					        return *this;
 | 
				
			||||||
@@ -147,11 +203,22 @@ public:
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    friend class ResultBuilder;
 | 
					    friend class ResultBuilder;
 | 
				
			||||||
    void setLhs( const std::string& lhs )
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    void setLhs
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const std::string& lhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_lhs = lhs;
 | 
					        m_lhs = lhs;
 | 
				
			||||||
    }    
 | 
					    }    
 | 
				
			||||||
    MutableResultInfo& setRhs( const std::string& op, const std::string& rhs )
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    MutableResultInfo& setRhs
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const std::string& op, 
 | 
				
			||||||
 | 
					        const std::string& rhs 
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_op = op;
 | 
					        m_op = op;
 | 
				
			||||||
        m_rhs = rhs;
 | 
					        m_rhs = rhs;
 | 
				
			||||||
@@ -162,49 +229,93 @@ private:
 | 
				
			|||||||
class ResultBuilder
 | 
					class ResultBuilder
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    ResultBuilder( const char* expr, bool isNot, const char* filename, std::size_t line, const char* macroName )
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    ResultBuilder
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const char* expr, 
 | 
				
			||||||
 | 
					        bool isNot, 
 | 
				
			||||||
 | 
					        const char* filename, 
 | 
				
			||||||
 | 
					        std::size_t line, 
 | 
				
			||||||
 | 
					        const char* macroName
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    : m_result( expr, isNot, filename, line, macroName )
 | 
					    : m_result( expr, isNot, filename, line, macroName )
 | 
				
			||||||
    {}
 | 
					    {}
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename T>
 | 
					    template<typename T>
 | 
				
			||||||
    ResultBuilder& operator->*(const T & operand)
 | 
					    ResultBuilder& operator->*
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const T & operand
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_result.setLhs( toString( operand ) );
 | 
					        m_result.setLhs( toString( operand ) );
 | 
				
			||||||
        return *this;
 | 
					        return *this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename RhsT>
 | 
					    template<typename RhsT>
 | 
				
			||||||
    MutableResultInfo& operator == ( const RhsT& rhs )
 | 
					    MutableResultInfo& operator == 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const RhsT& rhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_result.setRhs( "==", toString( rhs ) );
 | 
					        return m_result.setRhs( "==", toString( rhs ) );
 | 
				
			||||||
    }    
 | 
					    }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename RhsT>
 | 
					    template<typename RhsT>
 | 
				
			||||||
    MutableResultInfo& operator != ( const RhsT& rhs )
 | 
					    MutableResultInfo& operator != 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const RhsT& rhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_result.setRhs( "!=", toString( rhs ) );
 | 
					        return m_result.setRhs( "!=", toString( rhs ) );
 | 
				
			||||||
    }    
 | 
					    }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename RhsT>
 | 
					    template<typename RhsT>
 | 
				
			||||||
    MutableResultInfo& operator < ( const RhsT& rhs )
 | 
					    MutableResultInfo& operator < 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const RhsT& rhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_result.setRhs( "<", toString( rhs ) );
 | 
					        return m_result.setRhs( "<", toString( rhs ) );
 | 
				
			||||||
    }    
 | 
					    }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename RhsT>
 | 
					    template<typename RhsT>
 | 
				
			||||||
    MutableResultInfo& operator > ( const RhsT& rhs )
 | 
					    MutableResultInfo& operator > 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const RhsT& rhs 
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_result.setRhs( ">", toString( rhs ) );
 | 
					        return m_result.setRhs( ">", toString( rhs ) );
 | 
				
			||||||
    }    
 | 
					    }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename RhsT>
 | 
					    template<typename RhsT>
 | 
				
			||||||
    MutableResultInfo& operator <= ( const RhsT& rhs )
 | 
					    MutableResultInfo& operator <= 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const RhsT& rhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_result.setRhs( "<=", toString( rhs ) );
 | 
					        return m_result.setRhs( "<=", toString( rhs ) );
 | 
				
			||||||
    }    
 | 
					    }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename RhsT>
 | 
					    template<typename RhsT>
 | 
				
			||||||
    MutableResultInfo& operator >= ( const RhsT& rhs )
 | 
					    MutableResultInfo& operator >= 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const RhsT& rhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_result.setRhs( ">=", toString( rhs ) );
 | 
					        return m_result.setRhs( ">=", toString( rhs ) );
 | 
				
			||||||
    }    
 | 
					    }    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    operator MutableResultInfo&()
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    operator MutableResultInfo&
 | 
				
			||||||
 | 
					    ()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_result;
 | 
					        return m_result;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -217,23 +328,34 @@ private:
 | 
				
			|||||||
class ScopedInfo
 | 
					class ScopedInfo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    ScopedInfo()
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    ScopedInfo
 | 
				
			||||||
 | 
					    ()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Hub::getResultCapture().pushScopedInfo( this );
 | 
					        Hub::getResultCapture().pushScopedInfo( this );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ~ScopedInfo()
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    ~ScopedInfo
 | 
				
			||||||
 | 
					    ()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Hub::getResultCapture().popScopedInfo( this );
 | 
					        Hub::getResultCapture().popScopedInfo( this );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ScopedInfo& operator << ( const char* str )
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    ScopedInfo& operator << 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const char* str
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        m_oss << str;
 | 
					        m_oss << str;
 | 
				
			||||||
        return *this; 
 | 
					        return *this; 
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    std::string getInfo() const
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    std::string getInfo
 | 
				
			||||||
 | 
					    ()
 | 
				
			||||||
 | 
					    const
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return m_oss.str();
 | 
					        return m_oss.str();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -255,13 +377,23 @@ inline double catch_max( double x, double y )
 | 
				
			|||||||
class Approx
 | 
					class Approx
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    // !TBD more generic
 | 
					    // !TBD more generic
 | 
				
			||||||
    Approx( double d )
 | 
					    Approx
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        double d
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    : m_d( d )
 | 
					    : m_d( d )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename T>
 | 
					    template<typename T>
 | 
				
			||||||
    friend bool operator == ( const T& lhs, const Approx& rhs )
 | 
					    friend bool operator == 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const T& lhs, 
 | 
				
			||||||
 | 
					        const Approx& rhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // !TBD Use proper tolerance
 | 
					        // !TBD Use proper tolerance
 | 
				
			||||||
        // From: http://realtimecollisiondetection.net/blog/?p=89
 | 
					        // From: http://realtimecollisiondetection.net/blog/?p=89
 | 
				
			||||||
@@ -269,8 +401,13 @@ public:
 | 
				
			|||||||
        return fabs( lhs - rhs.m_d ) <= catch_max( CATCH_absTol, CATCH_relTol * catch_max( fabs(lhs), fabs(rhs.m_d) ) );
 | 
					        return fabs( lhs - rhs.m_d ) <= catch_max( CATCH_absTol, CATCH_relTol * catch_max( fabs(lhs), fabs(rhs.m_d) ) );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename T>
 | 
					    template<typename T>
 | 
				
			||||||
    friend bool operator != ( const T& lhs, const Approx& rhs )
 | 
					    friend bool operator != 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const T& lhs, 
 | 
				
			||||||
 | 
					        const Approx& rhs
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return ! operator==( lhs, rhs );
 | 
					        return ! operator==( lhs, rhs );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -278,22 +415,31 @@ public:
 | 
				
			|||||||
    double m_d;
 | 
					    double m_d;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
inline std::string toString<Approx>( const Approx& value )
 | 
					inline std::string toString<Approx>
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					    const Approx& value
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::ostringstream oss;
 | 
					    std::ostringstream oss;
 | 
				
			||||||
    oss << "Approx( " << value.m_d << ")";
 | 
					    oss << "Approx( " << value.m_d << ")";
 | 
				
			||||||
    return oss.str();
 | 
					    return oss.str();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
// This is just here to avoid compiler warnings with macro constants
 | 
					// This is just here to avoid compiler warnings with macro constants
 | 
				
			||||||
inline bool isTrue( bool value )
 | 
					inline bool isTrue
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					    bool value
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return value;
 | 
					    return value;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
} // end namespace Catch
 | 
					} // end namespace Catch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_ACCEPT_RESULT( result, stopOnFailure ) \
 | 
					#define INTERNAL_CATCH_ACCEPT_RESULT( result, stopOnFailure ) \
 | 
				
			||||||
    if( Catch::ResultAction::Value action = Catch::Hub::getResultCapture().acceptResult( result )  ) \
 | 
					    if( Catch::ResultAction::Value action = Catch::Hub::getResultCapture().acceptResult( result )  ) \
 | 
				
			||||||
    { \
 | 
					    { \
 | 
				
			||||||
@@ -301,12 +447,14 @@ inline bool isTrue( bool value )
 | 
				
			|||||||
        if( Catch::isTrue( stopOnFailure ) ) throw Catch::TestFailureException(); \
 | 
					        if( Catch::isTrue( stopOnFailure ) ) throw Catch::TestFailureException(); \
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_TEST( expr, isNot, stopOnFailure, macroName ) \
 | 
					#define INTERNAL_CATCH_TEST( expr, isNot, stopOnFailure, macroName ) \
 | 
				
			||||||
    { \
 | 
					    { \
 | 
				
			||||||
        Catch::Hub::getResultCapture().acceptExpression( Catch::ResultBuilder( #expr, isNot, __FILE__, __LINE__, macroName )->*expr ); \
 | 
					        Catch::Hub::getResultCapture().acceptExpression( Catch::ResultBuilder( #expr, isNot, __FILE__, __LINE__, macroName )->*expr ); \
 | 
				
			||||||
        INTERNAL_CATCH_ACCEPT_RESULT( expr, stopOnFailure ) \
 | 
					        INTERNAL_CATCH_ACCEPT_RESULT( expr, stopOnFailure ) \
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
 | 
					#define INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
 | 
				
			||||||
    Catch::Hub::getResultCapture().acceptExpression( Catch::ResultBuilder( #expr, false, __FILE__, __LINE__, macroName ) ); \
 | 
					    Catch::Hub::getResultCapture().acceptExpression( Catch::ResultBuilder( #expr, false, __FILE__, __LINE__, macroName ) ); \
 | 
				
			||||||
    try \
 | 
					    try \
 | 
				
			||||||
@@ -319,6 +467,7 @@ inline bool isTrue( bool value )
 | 
				
			|||||||
        INTERNAL_CATCH_ACCEPT_RESULT( !(nothrow), stopOnFailure ) \
 | 
					        INTERNAL_CATCH_ACCEPT_RESULT( !(nothrow), stopOnFailure ) \
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
 | 
					#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
 | 
				
			||||||
INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
 | 
					INTERNAL_CATCH_THROWS( expr, exceptionType, nothrow, stopOnFailure, macroName ) \
 | 
				
			||||||
catch( ... ) \
 | 
					catch( ... ) \
 | 
				
			||||||
@@ -326,6 +475,7 @@ catch( ... ) \
 | 
				
			|||||||
    INTERNAL_CATCH_ACCEPT_RESULT( false, stopOnFailure ) \
 | 
					    INTERNAL_CATCH_ACCEPT_RESULT( false, stopOnFailure ) \
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \
 | 
					#define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \
 | 
				
			||||||
    { \
 | 
					    { \
 | 
				
			||||||
        std::ostringstream INTERNAL_CATCH_UNIQUE_NAME( strm ); \
 | 
					        std::ostringstream INTERNAL_CATCH_UNIQUE_NAME( strm ); \
 | 
				
			||||||
@@ -335,6 +485,7 @@ catch( ... ) \
 | 
				
			|||||||
        INTERNAL_CATCH_ACCEPT_RESULT( resultType, stopOnFailure ) \
 | 
					        INTERNAL_CATCH_ACCEPT_RESULT( resultType, stopOnFailure ) \
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_SCOPED_INFO( log ) Catch::ScopedInfo INTERNAL_CATCH_UNIQUE_NAME( info ); INTERNAL_CATCH_UNIQUE_NAME( info ) << log
 | 
					#define INTERNAL_CATCH_SCOPED_INFO( log ) Catch::ScopedInfo INTERNAL_CATCH_UNIQUE_NAME( info ); INTERNAL_CATCH_UNIQUE_NAME( info ) << log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
 | 
					#endif // TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,13 @@ namespace Catch
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        ArgParser( int argc, char * const argv[], Config& config )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        ArgParser
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            int argc, 
 | 
				
			||||||
 | 
					            char * const argv[], 
 | 
				
			||||||
 | 
					            Config& config
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        :   m_mode( modeNone ),
 | 
					        :   m_mode( modeNone ),
 | 
				
			||||||
            m_config( config )
 | 
					            m_config( config )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -82,7 +88,9 @@ namespace Catch
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
        std::string argsAsString()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        std::string argsAsString
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            std::ostringstream oss;
 | 
					            std::ostringstream oss;
 | 
				
			||||||
            std::vector<std::string>::const_iterator it = m_args.begin();
 | 
					            std::vector<std::string>::const_iterator it = m_args.begin();
 | 
				
			||||||
@@ -96,7 +104,12 @@ namespace Catch
 | 
				
			|||||||
            return oss.str();
 | 
					            return oss.str();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        void changeMode( const std::string& cmd, Mode mode )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        void changeMode
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& cmd, 
 | 
				
			||||||
 | 
					            Mode mode
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            m_command = cmd;
 | 
					            m_command = cmd;
 | 
				
			||||||
            switch( m_mode )
 | 
					            switch( m_mode )
 | 
				
			||||||
@@ -179,7 +192,11 @@ namespace Catch
 | 
				
			|||||||
            m_mode = mode;
 | 
					            m_mode = mode;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        void setErrorMode( const std::string& errorMessage )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        void setErrorMode
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& errorMessage
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            m_mode = modeError;
 | 
					            m_mode = modeError;
 | 
				
			||||||
            m_command = "";
 | 
					            m_command = "";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Catch
 | 
					namespace Catch
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    inline int List( const Config& config )
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    inline int List
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const Config& config
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if( config.listWhat() & Config::List::Reports )
 | 
					        if( config.listWhat() & Config::List::Reports )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,7 @@ namespace Catch
 | 
				
			|||||||
    }; 
 | 
					    }; 
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
 | 
					#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
 | 
				
			||||||
    Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
 | 
					    Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,26 +21,32 @@ namespace Catch
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        SelfTestReporter()
 | 
					        SelfTestReporter
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        :   m_succeeded( 0 ),
 | 
					        :   m_succeeded( 0 ),
 | 
				
			||||||
            m_failed( 0 )
 | 
					            m_failed( 0 )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        static std::string getDescription()
 | 
					        static std::string getDescription
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return "Captures results for self test purposes";
 | 
					            return "Captures results for self test purposes";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        size_t getSucceeded() const
 | 
					        size_t getSucceeded
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
 | 
					        const
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return m_succeeded;
 | 
					            return m_succeeded;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        size_t getFailed() const
 | 
					        size_t getFailed
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
 | 
					        const
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return m_failed;
 | 
					            return m_failed;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -55,16 +61,23 @@ namespace Catch
 | 
				
			|||||||
    private: // IReporter
 | 
					    private: // IReporter
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        virtual void StartTesting(){}
 | 
					        virtual void StartTesting
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
 | 
					        {}
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        virtual void EndTesting( std::size_t succeeded, std::size_t failed )
 | 
					        virtual void EndTesting
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            std::size_t succeeded, 
 | 
				
			||||||
 | 
					            std::size_t failed
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            m_succeeded = succeeded;
 | 
					            m_succeeded = succeeded;
 | 
				
			||||||
            m_failed = failed;
 | 
					            m_failed = failed;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        // Deliberately unimplemented:
 | 
				
			||||||
        virtual void StartGroup( const std::string& ){}
 | 
					        virtual void StartGroup( const std::string& ){}
 | 
				
			||||||
        virtual void EndGroup( const std::string&, std::size_t, std::size_t ){}
 | 
					        virtual void EndGroup( const std::string&, std::size_t, std::size_t ){}
 | 
				
			||||||
        virtual void StartTestCase( const TestCaseInfo& ){}
 | 
					        virtual void StartTestCase( const TestCaseInfo& ){}
 | 
				
			||||||
@@ -83,7 +96,8 @@ namespace Catch
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        SelfTestConfig()
 | 
					        SelfTestConfig
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        : m_reporter( new SelfTestReporter() )
 | 
					        : m_reporter( new SelfTestReporter() )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // reporter will be deleted by the base config class
 | 
					            // reporter will be deleted by the base config class
 | 
				
			||||||
@@ -92,7 +106,8 @@ namespace Catch
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        SelfTestReporter& getReporter()
 | 
					        SelfTestReporter& getReporter
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return *m_reporter;
 | 
					            return *m_reporter;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -107,7 +122,8 @@ namespace Catch
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        EmbeddedRunner()
 | 
					        EmbeddedRunner
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
@@ -125,7 +141,8 @@ namespace Catch
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ///////////////////////////////////////////////////////////////////////////
 | 
					        ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        SelfTestReporter& getReporter()
 | 
					        SelfTestReporter& getReporter
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return m_config.getReporter();
 | 
					            return m_config.getReporter();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,17 +25,26 @@ namespace Catch
 | 
				
			|||||||
        WriterF m_writer;
 | 
					        WriterF m_writer;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        StreamBufImpl()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        StreamBufImpl
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            setp( data, data + sizeof(data) );
 | 
					            setp( data, data + sizeof(data) );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        ~StreamBufImpl() 
 | 
					
 | 
				
			||||||
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        ~StreamBufImpl
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            sync();
 | 
					            sync();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
        int	overflow( int c )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        int	overflow
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            int c
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            sync();
 | 
					            sync();
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
@@ -49,7 +58,9 @@ namespace Catch
 | 
				
			|||||||
            return 0;
 | 
					            return 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        int	sync()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        int	sync
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if( pbase() != pptr() )
 | 
					            if( pbase() != pptr() )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -60,9 +71,16 @@ namespace Catch
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct OutputDebugWriter
 | 
					    struct OutputDebugWriter
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        void operator()( const std::string &str )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        void operator()
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string &str
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            writeToDebugConsole( str );
 | 
					            writeToDebugConsole( str );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,28 +21,48 @@ namespace Catch
 | 
				
			|||||||
template<typename C>
 | 
					template<typename C>
 | 
				
			||||||
struct MethodTestCase : ITestCase
 | 
					struct MethodTestCase : ITestCase
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    MethodTestCase( void (C::*method)() )
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    MethodTestCase
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        void (C::*method)() 
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    : m_method( method )
 | 
					    : m_method( method )
 | 
				
			||||||
    {}
 | 
					    {}
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    virtual void invoke() const
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    virtual void invoke
 | 
				
			||||||
 | 
					    ()
 | 
				
			||||||
 | 
					    const
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        C obj;
 | 
					        C obj;
 | 
				
			||||||
        (obj.*m_method)();
 | 
					        (obj.*m_method)();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    virtual ITestCase* clone() const
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    virtual ITestCase* clone
 | 
				
			||||||
 | 
					    ()
 | 
				
			||||||
 | 
					    const
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return new MethodTestCase<C>( m_method );
 | 
					        return new MethodTestCase<C>( m_method );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    virtual bool operator == ( const ITestCase& other ) const
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    virtual bool operator == 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const ITestCase& other
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    const
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
 | 
					        const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
 | 
				
			||||||
        return mtOther && m_method == mtOther->m_method;
 | 
					        return mtOther && m_method == mtOther->m_method;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    virtual bool operator < ( const ITestCase& other ) const
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    virtual bool operator < 
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        const ITestCase& other
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    const
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
 | 
					        const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
 | 
				
			||||||
        return mtOther && &m_method < &mtOther->m_method;
 | 
					        return mtOther && &m_method < &mtOther->m_method;
 | 
				
			||||||
@@ -56,21 +76,41 @@ typedef void(*TestFunction)();
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
struct AutoReg
 | 
					struct AutoReg
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    AutoReg( TestFunction function, const char* name, const char* description );
 | 
					    AutoReg
 | 
				
			||||||
 | 
					        (   TestFunction function, 
 | 
				
			||||||
 | 
					            const char* name, 
 | 
				
			||||||
 | 
					            const char* description 
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
    template<typename C>
 | 
					    template<typename C>
 | 
				
			||||||
    AutoReg( void (C::*method)(), const char* name, const char* description )
 | 
					    AutoReg
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        void (C::*method)(), 
 | 
				
			||||||
 | 
					        const char* name, 
 | 
				
			||||||
 | 
					        const char* description
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        registerTestCase( new MethodTestCase<C>( method ), name, description );
 | 
					        registerTestCase( new MethodTestCase<C>( method ), name, description );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    void registerTestCase( ITestCase* testCase, const char* name, const char* description );
 | 
					    ///////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					    void registerTestCase
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        ITestCase* testCase, 
 | 
				
			||||||
 | 
					        const char* name, 
 | 
				
			||||||
 | 
					        const char* description
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    ~AutoReg();
 | 
					    ~AutoReg
 | 
				
			||||||
 | 
					        ();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    AutoReg( const AutoReg& );
 | 
					    AutoReg
 | 
				
			||||||
    void operator=( const AutoReg& );
 | 
					        ( const AutoReg& );
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    void operator=
 | 
				
			||||||
 | 
					        ( const AutoReg& );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename T, size_t>
 | 
					template<typename T, size_t>
 | 
				
			||||||
@@ -78,19 +118,23 @@ struct FixtureWrapper{};
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
} // end namespace Catch
 | 
					} // end namespace Catch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
 | 
					#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
 | 
				
			||||||
    static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )(); \
 | 
					    static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )(); \
 | 
				
			||||||
    namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction ), Name, Desc ); }\
 | 
					    namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction ), Name, Desc ); }\
 | 
				
			||||||
    static void INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction )()
 | 
					    static void INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction )()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_TESTCASE_NORETURN( Name, Desc ) \
 | 
					#define INTERNAL_CATCH_TESTCASE_NORETURN( Name, Desc ) \
 | 
				
			||||||
    static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )() ATTRIBUTE_NORETURN; \
 | 
					    static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )() ATTRIBUTE_NORETURN; \
 | 
				
			||||||
    namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction ), Name, Desc ); }\
 | 
					    namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction ), Name, Desc ); }\
 | 
				
			||||||
    static void INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction )()
 | 
					    static void INTERNAL_CATCH_UNIQUE_NAME(  catch_internal_TestFunction )()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
 | 
					#define CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
 | 
				
			||||||
    namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, Name, Desc ); }
 | 
					    namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, Name, Desc ); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define TEST_CASE_METHOD( ClassName, TestName, Desc )\
 | 
					#define TEST_CASE_METHOD( ClassName, TestName, Desc )\
 | 
				
			||||||
    namespace Catch{ template<> struct FixtureWrapper<ClassName, __LINE__> : ClassName \
 | 
					    namespace Catch{ template<> struct FixtureWrapper<ClassName, __LINE__> : ClassName \
 | 
				
			||||||
    { \
 | 
					    { \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,30 +24,50 @@ namespace Catch
 | 
				
			|||||||
        class ScopedElement
 | 
					        class ScopedElement
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        public:
 | 
					        public:
 | 
				
			||||||
            ScopedElement( XmlWriter* writer )
 | 
					            ///////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					            ScopedElement
 | 
				
			||||||
 | 
					            (
 | 
				
			||||||
 | 
					                XmlWriter* writer
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
            :   m_writer( writer )
 | 
					            :   m_writer( writer )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            ScopedElement( const ScopedElement& other )
 | 
					            ///////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					            ScopedElement
 | 
				
			||||||
 | 
					            (
 | 
				
			||||||
 | 
					                const ScopedElement& other
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
            :   m_writer( other.m_writer )
 | 
					            :   m_writer( other.m_writer )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                other.m_writer = NULL;
 | 
					                other.m_writer = NULL;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            ~ScopedElement()
 | 
					            ///////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					            ~ScopedElement
 | 
				
			||||||
 | 
					            ()
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if( m_writer )
 | 
					                if( m_writer )
 | 
				
			||||||
                    m_writer->endElement();
 | 
					                    m_writer->endElement();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ScopedElement& writeText( const std::string& text )
 | 
					            ///////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					            ScopedElement& writeText
 | 
				
			||||||
 | 
					            (
 | 
				
			||||||
 | 
					                const std::string& text
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                m_writer->writeText( text );
 | 
					                m_writer->writeText( text );
 | 
				
			||||||
                return *this;
 | 
					                return *this;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            ///////////////////////////////////////////////////////////////////
 | 
				
			||||||
            template<typename T>
 | 
					            template<typename T>
 | 
				
			||||||
            ScopedElement& writeAttribute( const std::string& name, const T& attribute )
 | 
					            ScopedElement& writeAttribute
 | 
				
			||||||
 | 
					            (
 | 
				
			||||||
 | 
					                const std::string& name,
 | 
				
			||||||
 | 
					                const T& attribute
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                m_writer->writeAttribute( name, attribute );
 | 
					                m_writer->writeAttribute( name, attribute );
 | 
				
			||||||
                return *this;
 | 
					                return *this;
 | 
				
			||||||
@@ -57,21 +77,29 @@ namespace Catch
 | 
				
			|||||||
            mutable XmlWriter* m_writer;
 | 
					            mutable XmlWriter* m_writer;
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        XmlWriter()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        :   m_tagIsOpen( false ),
 | 
					        :   m_tagIsOpen( false ),
 | 
				
			||||||
            m_needsNewline( false ),
 | 
					            m_needsNewline( false ),
 | 
				
			||||||
            m_os( &std::cout )
 | 
					            m_os( &std::cout )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        XmlWriter( std::ostream& os)
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            std::ostream& os
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        :   m_tagIsOpen( false ),
 | 
					        :   m_tagIsOpen( false ),
 | 
				
			||||||
            m_needsNewline( false ),
 | 
					            m_needsNewline( false ),
 | 
				
			||||||
            m_os( &os )
 | 
					            m_os( &os )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        ~XmlWriter()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        ~XmlWriter
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            while( !m_tags.empty() )
 | 
					            while( !m_tags.empty() )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -79,14 +107,22 @@ namespace Catch
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        XmlWriter& operator = ( const XmlWriter& other )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& operator = 
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const XmlWriter& other
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            XmlWriter temp( other );
 | 
					            XmlWriter temp( other );
 | 
				
			||||||
            swap( temp );
 | 
					            swap( temp );
 | 
				
			||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        void swap( XmlWriter& other )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        void swap
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            XmlWriter& other
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            std::swap( m_tagIsOpen, other.m_tagIsOpen );
 | 
					            std::swap( m_tagIsOpen, other.m_tagIsOpen );
 | 
				
			||||||
            std::swap( m_needsNewline, other.m_needsNewline );
 | 
					            std::swap( m_needsNewline, other.m_needsNewline );
 | 
				
			||||||
@@ -95,7 +131,11 @@ namespace Catch
 | 
				
			|||||||
            std::swap( m_os, other.m_os );
 | 
					            std::swap( m_os, other.m_os );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        XmlWriter& startElement( const std::string& name )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& startElement
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& name
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ensureTagClosed();
 | 
					            ensureTagClosed();
 | 
				
			||||||
            newlineIfNecessary();
 | 
					            newlineIfNecessary();
 | 
				
			||||||
@@ -106,14 +146,20 @@ namespace Catch
 | 
				
			|||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ScopedElement scopedElement( const std::string& name )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        ScopedElement scopedElement
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& name
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ScopedElement scoped( this );
 | 
					            ScopedElement scoped( this );
 | 
				
			||||||
            startElement( name );
 | 
					            startElement( name );
 | 
				
			||||||
            return scoped;
 | 
					            return scoped;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        XmlWriter& endElement()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& endElement
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            newlineIfNecessary();
 | 
					            newlineIfNecessary();
 | 
				
			||||||
            m_indent = m_indent.substr( 0, m_indent.size()-2 );
 | 
					            m_indent = m_indent.substr( 0, m_indent.size()-2 );
 | 
				
			||||||
@@ -130,7 +176,12 @@ namespace Catch
 | 
				
			|||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        XmlWriter& writeAttribute( const std::string& name, const std::string& attribute )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& writeAttribute
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& name, 
 | 
				
			||||||
 | 
					            const std::string& attribute
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if( !name.empty() && !attribute.empty() )
 | 
					            if( !name.empty() && !attribute.empty() )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -140,14 +191,25 @@ namespace Catch
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        XmlWriter& writeAttribute( const std::string& name, bool attribute )
 | 
					
 | 
				
			||||||
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& writeAttribute
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& name, 
 | 
				
			||||||
 | 
					            bool attribute
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            stream() << " " << name << "=\"" << ( attribute ? "true" : "false" ) << "\"";
 | 
					            stream() << " " << name << "=\"" << ( attribute ? "true" : "false" ) << "\"";
 | 
				
			||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
        template<typename T>
 | 
					        template<typename T>
 | 
				
			||||||
        XmlWriter& writeAttribute( const std::string& name, const T& attribute )
 | 
					        XmlWriter& writeAttribute
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& name, 
 | 
				
			||||||
 | 
					            const T& attribute
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if( !name.empty() )
 | 
					            if( !name.empty() )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -156,7 +218,11 @@ namespace Catch
 | 
				
			|||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        XmlWriter& writeText( const std::string& text )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& writeText
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& text
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if( !text.empty() )
 | 
					            if( !text.empty() )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -170,7 +236,11 @@ namespace Catch
 | 
				
			|||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        XmlWriter& writeComment( const std::string& text )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& writeComment
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& text 
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ensureTagClosed();
 | 
					            ensureTagClosed();
 | 
				
			||||||
            stream() << m_indent << "<!--" << text << "-->";
 | 
					            stream() << m_indent << "<!--" << text << "-->";
 | 
				
			||||||
@@ -178,7 +248,9 @@ namespace Catch
 | 
				
			|||||||
            return *this;
 | 
					            return *this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        XmlWriter& writeBlankLine()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        XmlWriter& writeBlankLine
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ensureTagClosed();
 | 
					            ensureTagClosed();
 | 
				
			||||||
            stream() << "\n";
 | 
					            stream() << "\n";
 | 
				
			||||||
@@ -187,12 +259,16 @@ namespace Catch
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
    private:
 | 
					    private:
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        std::ostream& stream()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        std::ostream& stream
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return *m_os;
 | 
					            return *m_os;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        void ensureTagClosed()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        void ensureTagClosed
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if( m_tagIsOpen )
 | 
					            if( m_tagIsOpen )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -201,7 +277,9 @@ namespace Catch
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        void newlineIfNecessary()
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        void newlineIfNecessary
 | 
				
			||||||
 | 
					        ()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if( m_needsNewline )
 | 
					            if( m_needsNewline )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -210,7 +288,11 @@ namespace Catch
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        void writeEncodedText( const std::string& text )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        void writeEncodedText
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& text
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // !TBD finish this
 | 
					            // !TBD finish this
 | 
				
			||||||
            if( !findReplaceableString( text, "<", "<" ) &&
 | 
					            if( !findReplaceableString( text, "<", "<" ) &&
 | 
				
			||||||
@@ -221,7 +303,13 @@ namespace Catch
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        bool findReplaceableString( const std::string& text, const std::string& replaceWhat, const std::string& replaceWith )
 | 
					        ///////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					        bool findReplaceableString
 | 
				
			||||||
 | 
					        (
 | 
				
			||||||
 | 
					            const std::string& text, 
 | 
				
			||||||
 | 
					            const std::string& replaceWhat, 
 | 
				
			||||||
 | 
					            const std::string& replaceWith
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            std::string::size_type pos = text.find_first_of( replaceWhat );
 | 
					            std::string::size_type pos = text.find_first_of( replaceWhat );
 | 
				
			||||||
            if( pos != std::string::npos )
 | 
					            if( pos != std::string::npos )
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user