root/library/tests/unittest-cpp/TimeConstraint.cpp @ 477

Revision 477, 0.6 kB (checked in by mido, 15 years ago)

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

RevLine 
[418]1#include "TimeConstraint.h"
2#include "TestResults.h"
3#include "MemoryOutStream.h"
4#include "CurrentTest.h"
5
6namespace UnitTest {
7
8
[477]9TimeConstraint::TimeConstraint ( int ms, TestDetails const& details )
10                : m_details ( details )
11                , m_maxMs ( ms ) {
12        m_timer.Start();
[418]13}
14
[477]15TimeConstraint::~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.";
[418]21
[477]22                UnitTest::CurrentTest::Results()->OnTestFailure ( m_details, stream.GetText() );
23        }
[418]24}
25
26}
Note: See TracBrowser for help on using the browser.