Changeset 477 for library/tests/unittest-cpp/TestRunner.h
- Timestamp:
- 08/05/09 14:40:03 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/unittest-cpp/TestRunner.h
r418 r477 14 14 int RunAllTests(); 15 15 16 struct True 17 { 18 bool operator()(const Test* const) const 19 { 20 return true; 16 struct True { 17 bool operator() ( const Test* const ) const { 18 return true; 21 19 } 22 20 }; 23 21 24 class TestRunner 25 { 22 class TestRunner { 26 23 public: 27 explicit TestRunner (TestReporter& reporter);24 explicit TestRunner ( TestReporter& reporter ); 28 25 ~TestRunner(); 29 26 30 27 template <class Predicate> 31 int RunTestsIf(TestList const& list, char const* suiteName, 32 const Predicate& predicate, int maxTestTimeInMs) const 33 { 34 Test* curTest = list.GetHead(); 28 int RunTestsIf ( TestList const& list, char const* suiteName, 29 const Predicate& predicate, int maxTestTimeInMs ) const { 30 Test* curTest = list.GetHead(); 35 31 36 while (curTest != 0) 37 { 38 if (IsTestInSuite(curTest, suiteName) && predicate(curTest)) 39 RunTest(m_result, curTest, maxTestTimeInMs); 32 while ( curTest != 0 ) { 33 if ( IsTestInSuite ( curTest, suiteName ) && predicate ( curTest ) ) 34 RunTest ( m_result, curTest, maxTestTimeInMs ); 40 35 41 36 curTest = curTest->next; 42 37 } 43 38 44 45 } 39 return Finish(); 40 } 46 41 47 42 private: … … 51 46 52 47 int Finish() const; 53 bool IsTestInSuite (const Test* const curTest, char const* suiteName) const;54 void RunTest (TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const;48 bool IsTestInSuite ( const Test* const curTest, char const* suiteName ) const; 49 void RunTest ( TestResults* const result, Test* const curTest, int const maxTestTimeInMs ) const; 55 50 }; 56 51