Newer
Older
Russell Taylor
committed
#ifndef TIMERTEST_H_
#define TIMERTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
Russell Taylor
committed
class TimerTest : public CxxTest::TestSuite
{
public:
void testTimer()
{
// Instantiating the object starts the timer
Mantid::Kernel::Timer timer;
#if defined _WIN64
TS_ASSERT_LESS_THAN( 0.18, timer.elapsed() );
#elif defined _WIN32
// 32-bit windows doesn't seem to have brilliant resolution
// as the Sleep(200) can quite often cause the elapsed
// time to be less than 0.19 seconds!
Sleep(200);
TS_ASSERT_LESS_THAN( 0.18, timer.elapsed() );
TS_ASSERT_LESS_THAN( 0.18, timer.elapsed() );
TS_ASSERT_LESS_THAN( 0.08, timer.elapsed() );
TS_ASSERT_LESS_THAN( 0.08, timer.elapsed() );
Russell Taylor
committed
}
};
#endif /*TIMERTEST_H_*/