Improve timer test diagnostics.
This commit is contained in:
parent
06bcccd6ac
commit
6ad917493d
|
@ -29,16 +29,19 @@ void main()
|
||||||
eventDriver.timers.set(tm, 100.msecs, 100.msecs);
|
eventDriver.timers.set(tm, 100.msecs, 100.msecs);
|
||||||
|
|
||||||
void secondTier(TimerID timer) nothrow @safe {
|
void secondTier(TimerID timer) nothrow @safe {
|
||||||
scope (failure) assert(false);
|
try {
|
||||||
auto dur = Clock.currTime(UTC()) - s_startTime;
|
auto dur = Clock.currTime(UTC()) - s_startTime;
|
||||||
s_cnt++;
|
s_cnt++;
|
||||||
assert(dur > 100.msecs * s_cnt);
|
assert(dur > 100.msecs * s_cnt);
|
||||||
assert(dur < 100.msecs * s_cnt + 20.msecs);
|
assert(dur < 100.msecs * s_cnt + 20.msecs);
|
||||||
|
|
||||||
if (s_cnt == 3) {
|
if (s_cnt == 3) {
|
||||||
s_done = true;
|
s_done = true;
|
||||||
eventDriver.core.exit();
|
eventDriver.core.exit();
|
||||||
} else eventDriver.timers.wait(tm, &secondTier);
|
} else eventDriver.timers.wait(tm, &secondTier);
|
||||||
|
} catch (Exception e) {
|
||||||
|
assert(false, e.msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eventDriver.timers.wait(tm, &secondTier);
|
eventDriver.timers.wait(tm, &secondTier);
|
||||||
|
|
Loading…
Reference in a new issue