Changeset 477 for library/tests/unittest-cpp/TimeConstraint.cpp
- Timestamp:
- 08/05/09 14:40:03 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/unittest-cpp/TimeConstraint.cpp
r418 r477 7 7 8 8 9 TimeConstraint::TimeConstraint(int ms, TestDetails const& details) 10 : m_details(details) 11 , m_maxMs(ms) 12 { 13 m_timer.Start(); 9 TimeConstraint::TimeConstraint ( int ms, TestDetails const& details ) 10 : m_details ( details ) 11 , m_maxMs ( ms ) { 12 m_timer.Start(); 14 13 } 15 14 16 TimeConstraint::~TimeConstraint() 17 { 18 double const totalTimeInMs = m_timer.GetTimeInMs(); 19 if (totalTimeInMs > m_maxMs) 20 { 21 MemoryOutStream stream; 22 stream << "Time constraint failed. Expected to run test under " << m_maxMs << 23 "ms but took " << totalTimeInMs << "ms."; 15 TimeConstraint::~TimeConstraint() { 16 double const totalTimeInMs = m_timer.GetTimeInMs(); 17 if ( totalTimeInMs > m_maxMs ) { 18 MemoryOutStream stream; 19 stream << "Time constraint failed. Expected to run test under " << m_maxMs << 20 "ms but took " << totalTimeInMs << "ms."; 24 21 25 UnitTest::CurrentTest::Results()->OnTestFailure (m_details, stream.GetText());26 22 UnitTest::CurrentTest::Results()->OnTestFailure ( m_details, stream.GetText() ); 23 } 27 24 } 28 25