Tests out the delay mechanism with a verdict provider (as a function) which is always false
Delay delay = new Delay(&alwaysFalseFunc, dur!("seconds")(1), dur!("seconds")(1)); try { delay.go(); assert(false); } catch(DelayTimeoutException e) { assert(true); }
Tests out the delay mechanism with a verdict provider (as a function) which is always true
bool alwaysTrue() { return true; } Delay delay = new Delay(&alwaysTrue, dur!("seconds")(1), dur!("seconds")(1)); try { delay.go(); assert(true); } catch(DelayTimeoutException e) { assert(false); }
Tests out the delay mechanism with a verdict provider (as a delegate) which is only true on the second call
int cnt = 0; bool happensLater() { cnt++; if(cnt == 2) { return true; } else { return false; } } Delay delay = new Delay(&happensLater, dur!("seconds")(1), dur!("seconds")(1)); try { delay.go(); assert(true); } catch(DelayTimeoutException e) { assert(false); }