?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. #include "ThrowingTestReporter.h"
  2. #include "RequiredCheckException.h"
  3.  
  4. #ifdef UNITTEST_NO_EXCEPTIONS
  5. #include "ReportAssertImpl.h"
  6. #endif
  7.  
  8. namespace UnitTest {
  9.  
  10.    ThrowingTestReporter::ThrowingTestReporter(TestReporter* decoratedReporter)
  11.       : m_decoratedReporter(decoratedReporter)
  12.    {}
  13.  
  14.    //virtual
  15.    ThrowingTestReporter::~ThrowingTestReporter()
  16.    {}
  17.  
  18.    //virtual
  19.    void ThrowingTestReporter::ReportTestStart(TestDetails const& test)
  20.    {
  21.       if(m_decoratedReporter)
  22.       {
  23.          m_decoratedReporter->ReportTestStart(test);
  24.       }
  25.    }
  26.  
  27.    //virtual
  28.    void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure)
  29.    {
  30.       if(m_decoratedReporter)
  31.       {
  32.          m_decoratedReporter->ReportFailure(test, failure);
  33.       }
  34.      
  35.       #ifndef UNITTEST_NO_EXCEPTIONS
  36.          throw RequiredCheckException();
  37.       #else
  38.          static const int stopTest = 1;
  39.          UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), stopTest);
  40.       #endif
  41.    }
  42.  
  43.    //virtual
  44.    void ThrowingTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed)
  45.    {
  46.       if(m_decoratedReporter)
  47.       {
  48.          m_decoratedReporter->ReportTestFinish(test, secondsElapsed);
  49.       }
  50.    }
  51.  
  52.    //virtual
  53.    void ThrowingTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed)
  54.    {
  55.       if(m_decoratedReporter)
  56.       {
  57.          m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed);
  58.       }
  59.    }
  60.  
  61. }
  62.