Show
Ignore:
Timestamp:
08/05/09 14:40:03 (15 years ago)
Author:
mido
Message:

panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/unittest-cpp/TestRunner.cpp

    r418 r477  
    1111namespace UnitTest { 
    1212 
    13 int RunAllTests() 
    14 { 
     13int RunAllTests() { 
    1514        TestReporterStdout reporter; 
    16         TestRunner runner(reporter); 
    17         return runner.RunTestsIf(Test::GetTestList(), NULL, True(), 0); 
     15        TestRunner runner ( reporter ); 
     16        return runner.RunTestsIf ( Test::GetTestList(), NULL, True(), 0 ); 
    1817} 
    1918 
    2019 
    21 TestRunner::TestRunner(TestReporter& reporter) 
    22         : m_reporter(&reporter) 
    23         , m_result(new TestResults(&reporter)) 
    24         , m_timer(new Timer) 
    25 { 
     20TestRunner::TestRunner ( TestReporter& reporter ) 
     21                : m_reporter ( &reporter ) 
     22                , m_result ( new TestResults ( &reporter ) ) 
     23                , m_timer ( new Timer ) { 
    2624        m_timer->Start(); 
    2725} 
    2826 
    29 TestRunner::~TestRunner() 
    30 { 
     27TestRunner::~TestRunner() { 
    3128        delete m_result; 
    3229        delete m_timer; 
    3330} 
    3431 
    35 int TestRunner::Finish() const 
    36 { 
    37     float const secondsElapsed = static_cast<float>(m_timer->GetTimeInMs() / 1000.0); 
    38     m_reporter->ReportSummary(m_result->GetTotalTestCount(),  
    39                                                           m_result->GetFailedTestCount(),  
    40                                                           m_result->GetFailureCount(),  
    41                                                           secondsElapsed); 
    42      
     32int TestRunner::Finish() const { 
     33        float const secondsElapsed = static_cast<float> ( m_timer->GetTimeInMs() / 1000.0 ); 
     34        m_reporter->ReportSummary ( m_result->GetTotalTestCount(), 
     35                                    m_result->GetFailedTestCount(), 
     36                                    m_result->GetFailureCount(), 
     37                                    secondsElapsed ); 
     38 
    4339        return m_result->GetFailureCount(); 
    4440} 
    4541 
    46 bool TestRunner::IsTestInSuite(const Test* const curTest, char const* suiteName) const 
    47 { 
     42bool TestRunner::IsTestInSuite ( const Test* const curTest, char const* suiteName ) const { 
    4843        using namespace std; 
    49         return (suiteName == NULL) || !strcmp(curTest->m_details.suiteName, suiteName); 
     44        return ( suiteName == NULL ) || !strcmp ( curTest->m_details.suiteName, suiteName ); 
    5045} 
    5146 
    52 void TestRunner::RunTest(TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const 
    53 { 
     47void TestRunner::RunTest ( TestResults* const result, Test* const curTest, int const maxTestTimeInMs ) const { 
    5448        CurrentTest::Results() = result; 
    5549 
     
    5751        testTimer.Start(); 
    5852 
    59         result->OnTestStart(curTest->m_details); 
     53        result->OnTestStart ( curTest->m_details ); 
    6054 
    6155        curTest->Run(); 
    6256 
    6357        double const testTimeInMs = testTimer.GetTimeInMs(); 
    64         if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_timeConstraintExempt) 
    65         { 
    66             MemoryOutStream stream; 
    67             stream << "Global time constraint failed. Expected under " << maxTestTimeInMs << 
    68                     "ms but took " << testTimeInMs << "ms."; 
     58        if ( maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_timeConstraintExempt ) { 
     59                MemoryOutStream stream; 
     60                stream << "Global time constraint failed. Expected under " << maxTestTimeInMs << 
     61                "ms but took " << testTimeInMs << "ms."; 
    6962 
    70             result->OnTestFailure(curTest->m_details, stream.GetText()); 
     63                result->OnTestFailure ( curTest->m_details, stream.GetText() ); 
    7164        } 
    7265 
    73         result->OnTestFinish(curTest->m_details, static_cast<float>(testTimeInMs/1000.0)); 
     66        result->OnTestFinish ( curTest->m_details, static_cast<float> ( testTimeInMs / 1000.0 ) ); 
    7467} 
    7568