?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. #include "TestResults.h"
  2. #include "TestReporter.h"
  3.  
  4. #include "TestDetails.h"
  5.  
  6. namespace UnitTest {
  7.  
  8.    TestResults::TestResults(TestReporter* testReporter)
  9.       : m_testReporter(testReporter)
  10.       , m_totalTestCount(0)
  11.       , m_failedTestCount(0)
  12.       , m_failureCount(0)
  13.       , m_currentTestFailed(false)
  14.    {}
  15.  
  16.    void TestResults::OnTestStart(TestDetails const& test)
  17.    {
  18.       ++m_totalTestCount;
  19.       m_currentTestFailed = false;
  20.       if (m_testReporter)
  21.          m_testReporter->ReportTestStart(test);
  22.    }
  23.  
  24.    void TestResults::OnTestFailure(TestDetails const& test, char const* failure)
  25.    {
  26.       ++m_failureCount;
  27.       if (!m_currentTestFailed)
  28.       {
  29.          ++m_failedTestCount;
  30.          m_currentTestFailed = true;
  31.       }
  32.  
  33.       if (m_testReporter)
  34.          m_testReporter->ReportFailure(test, failure);
  35.    }
  36.  
  37.    void TestResults::OnTestFinish(TestDetails const& test, float secondsElapsed)
  38.    {
  39.       if (m_testReporter)
  40.          m_testReporter->ReportTestFinish(test, secondsElapsed);
  41.    }
  42.  
  43.    int TestResults::GetTotalTestCount() const
  44.    {
  45.       return m_totalTestCount;
  46.    }
  47.  
  48.    int TestResults::GetFailedTestCount() const
  49.    {
  50.       return m_failedTestCount;
  51.    }
  52.  
  53.    int TestResults::GetFailureCount() const
  54.    {
  55.       return m_failureCount;
  56.    }
  57.  
  58.  
  59. }
  60.