Exemplo n.º 1
0
    void MockReporter::Result( const AssertionResult& assertionResult ) {
        if( assertionResult.getResultType() == ResultWas::Ok )
            return;

        m_log << assertionResult.getSourceInfo() << " ";
        
        switch( assertionResult.getResultType() ) {          
            case ResultWas::Info:
                m_log << "Info";
                break;
            case ResultWas::Warning:
                m_log << "Warning";
                break;
            case ResultWas::ExplicitFailure:
                m_log << "ExplicitFailure";
                break;
            case ResultWas::ExpressionFailed:
                m_log << "ExpressionFailed";
                break;
            case ResultWas::Unknown:
                m_log << "Unknown";
                break;
            case ResultWas::ThrewException:
                m_log << "ThrewException";
                break;
            case ResultWas::DidntThrowException:
                m_log << "DidntThrowException";
                break;

            // We shouldn't ever see these
            case ResultWas::Ok:
                m_log << "Ok";
                break;
            case ResultWas::FailureBit:
                m_log << "FailureBit";
                break;
            case ResultWas::Exception:
                m_log << "Exception";
                break;
        }
        
        if( assertionResult.hasExpression() )
            m_log << assertionResult.getExpression();
        
        if( assertionResult.hasMessage() )
            m_log << "'" << assertionResult.getMessage() << "'";
        
        if( assertionResult.hasExpandedExpression() )
            m_log << assertionResult.getExpandedExpression();        
    }    
Exemplo n.º 2
0
        virtual void assertionEnded( AssertionResult const& result ) {
            if( result.getResultType() == ResultWas::Ok ) {
                m_totals.assertions.passed++;
            }
            else if( !result.isOk() ) {
                m_totals.assertions.failed++;
            }

            if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) )
                m_messages.clear();

            // Reset working state
            m_lastAssertionInfo = AssertionInfo( "", m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition );
        }
Exemplo n.º 3
0
        virtual void assertionEnded( AssertionResult const& result ) {
            if( result.getResultType() == ResultWas::Ok ) {
                m_totals.assertions.passed++;
            }
            else if( !result.isOk() ) {
                if( m_activeTestCase->getTestCaseInfo().okToFail() )
                    m_totals.assertions.failedButOk++;
                else
                    m_totals.assertions.failed++;
            }

            // We have no use for the return value (whether messages should be cleared), because messages were made scoped
            // and should be let to clear themselves out.
            static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));

            // Reset working state
            m_lastAssertionInfo = AssertionInfo( "", m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition );
            m_lastResult = result;
        }
Exemplo n.º 4
0
    void RunContext::assertionEnded(AssertionResult const & result) {
        if (result.getResultType() == ResultWas::Ok) {
            m_totals.assertions.passed++;
            m_lastAssertionPassed = true;
        } else if (!result.isOk()) {
            m_lastAssertionPassed = false;
            if( m_activeTestCase->getTestCaseInfo().okToFail() )
                m_totals.assertions.failedButOk++;
            else
                m_totals.assertions.failed++;
        }
        else {
            m_lastAssertionPassed = true;
        }

        // We have no use for the return value (whether messages should be cleared), because messages were made scoped
        // and should be let to clear themselves out.
        static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));

        // Reset working state
        resetAssertionInfo();
        m_lastResult = result;
    }