1 #include "testUtils.h"
\r
4 using namespace core;
\r
6 // Test the functionality of the Irrlicht timer
\r
11 IrrlichtDevice* device = createDevice(video::EDT_NULL);
\r
15 logTestString("Testing virtual timer.\n");
\r
17 ITimer* timer = device->getTimer();
\r
19 // must be running at start
\r
20 success &= !timer->isStopped();
\r
22 // starting more often should not stop the timer
\r
24 success &= !timer->isStopped();
\r
26 // one stop should not stop the timer because it's started twice now
\r
28 success &= !timer->isStopped();
\r
30 // another stop should really stop it
\r
32 success &= timer->isStopped();
\r
34 // third stop - timer should still be stopped
\r
36 success &= timer->isStopped();
\r
38 // should not start yet
\r
40 success &= timer->isStopped();
\r
44 success &= !timer->isStopped();
\r
46 logTestString("Testing virtual timer done. %s\n", success?"Success":"Failure");
\r
48 logTestString("Testing real timer.\n");
\r
49 const u32 startVirtual = timer->getTime();
\r
50 const u32 startReal = timer->getRealTime();
\r
52 if (startReal != timer->getRealTime())
\r
53 logTestString("Warning: Real timer did not progress. Maybe the time slices are too coarse to see.\n");
\r
54 if (startVirtual != timer->getTime())
\r
55 logTestString("Warning: Virtual timer did not progress. Maybe the time slices are too coarse to see.\n");
\r
57 irr::ITimer::RealTimeDate date = timer->getRealTimeAndDate();
\r
58 logTestString("Real time and date. %d.%d.%d at %d:%d:%d\n", date.Day, date.Month, date.Year, date.Hour, date.Minute, date.Second);
\r
59 logTestString("This is day %d of the year and weekday %d. The current time zone has daylight saving %s\n", date.Yearday, date.Weekday, date.IsDST?"enabled":"disabled");
\r
61 device->closeDevice();
\r