80 CHECK (start.next ==
nullptr);
82 CHECK (start.data_.timing.quality == 0);
88 Time now = RealClock::now();
89 start.activate (now, detector.executionCtx);
92 CHECK (detector.verifyInvocation(
"CTX-work").
arg(now, 0));
113 CHECK (
Time(0,11) == post.data_.timeWindow.life);
114 CHECK (
Time(0,22) == post.data_.timeWindow.dead);
115 CHECK ( & chain == post.
next);
119 post.activate (tt, detector.executionCtx);
121 CHECK (detector.verifyInvocation(
"CTX-post").
arg(
"11.000",
"22.000",
"Act(POST",
"≺test::CTX≻"));
137 Time nomTime = lib::test::randTime();
141 Activity invoke{detector.buildMockJobFunctor(
"job"), nomTime, feed};
143 Time realTime = RealClock::now();
144 CHECK (activity::PASS == invoke.activate (realTime, detector.executionCtx));
146 CHECK (detector.verifyInvocation (
"job").
arg(nomTime, x1));
169 notify.activate (tt, detector.executionCtx);
170 CHECK (detector.verifyInvocation(
"CTX-post").
arg(
"11.111",
Time::NEVER,
"Act(TICK",
"≺test::CTX≻"));
177 notify.data_.notification.target = &gate;
178 notify.data_.notification.timing = ts;
180 notify.activate (tt, detector.executionCtx);
181 CHECK (detector.verifySeqIncrement(1)
182 .beforeInvocation(
"CTX-post").
arg(
"33.333",
"55.555",
"Act(GATE",
"≺test::CTX≻"));
200 Activity& wiring = detector.buildGateWatcher (gate);
203 CHECK (activity::PASS == wiring.
activate (tt, detector.executionCtx));
204 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE"));
220 Activity& wiring = detector.buildGateWatcher (gate);
226 CHECK (activity::PASS == wiring.
activate (t1, detector.executionCtx));
227 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.330 ⧐ Act(GATE").
seq(0));
230 CHECK (activity::SKIP == wiring.
activate (t2, detector.executionCtx));
231 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE").
seq(1));
234 CHECK (activity::SKIP == wiring.
activate (t3, detector.executionCtx));
235 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.335 ⧐ Act(GATE").
seq(2));
255 Activity& wiring = detector.buildGateWatcher (gate);
258 CHECK (activity::SKIP == wiring.
activate (tt, detector.executionCtx));
259 CHECK (23 == gate.data_.condition.rest);
261 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE"));
281 Activity& entrance = detector.buildGateWatcher (gate);
284 CHECK (activity::SKIP == entrance.
dispatch (tt, detector.executionCtx));
285 CHECK (22 == gate.data_.condition.rest);
287 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 --notify-↯> Act(GATE"));
312 CHECK (gate.data_.condition.isHold());
313 CHECK (gate.data_.condition.rest == 1);
314 CHECK (gate.data_.condition.dead == td);
317 Activity& entrance = detector.buildGateWatcher (gate);
320 CHECK (activity::SKIP == entrance.
activate (tt, detector.executionCtx));
321 CHECK (1 == gate.data_.condition.rest);
322 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE"));
326 CHECK (activity::PASS == entrance.
dispatch(tt, detector.executionCtx));
327 CHECK (0 == gate.data_.condition.rest);
329 CHECK (detector.verifyInvocation(
"tap-GATE").
seq(0).
arg(
"33.333 ⧐ Act(GATE")
330 .beforeInvocation(
"tap-GATE").
seq(1).
arg(
"33.333 --notify-↯> Act(GATE"));
331 CHECK (gate.data_.condition.dead == Time::MIN);
336 CHECK (activity::SKIP == entrance.
activate (ttt, detector.executionCtx));
337 CHECK (detector.verifyInvocation(
"tap-GATE").
seq(2).
arg(
"44.444 ⧐ Act(GATE"));
338 CHECK (detector.ensureNoInvocation(
"CTX-post").
seq(2)
339 .afterInvocation(
"tap-GATE").
seq(2));
340 CHECK (gate.data_.condition.dead == Time::MIN);
344 CHECK (activity::SKIP == entrance.
dispatch (ttt, detector.executionCtx));
346 CHECK (gate.data_.condition.dead == Time::MIN);
347 CHECK (gate.data_.condition.rest == 0);
349 CHECK (detector.verifySeqIncrement(3)
350 .beforeInvocation(
"tap-GATE").
seq(3).
arg(
"44.444 --notify-↯> Act(GATE"));
375 auto term = activityLang.buildCalculationJob (detector.buildMockJob(), start,dead);
381 CHECK (watch(bFlow).cntElm() == 7);
382 CHECK (watch(bFlow).cntEpochs() == 1);
383 CHECK (watch(bFlow).find(*act) > dead);
384 CHECK (watch(bFlow).find(*act) < dead+
Time(500,0));
388 CHECK (start == act->data_.timeWindow.life);
389 CHECK (dead == act->data_.timeWindow.dead);
400 CHECK (activity::PASS == act->activate (now, detector.executionCtx));
401 CHECK (detector.verifyInvocation(
"mockJob"));
428 detector.executionCtx.getSchedTime = [&]{
return tt; };
430 detector.watchGate (post.next,
"Gate");
433 CHECK (detector.verifyInvocation(
"Gate") .
arg(
"1.011 ⧐ Act(GATE")
434 .beforeInvocation(
"after-Gate").
arg(
"1.011 ⧐ Act(TICK")
435 .beforeInvocation(
"CTX-tick") .
arg(
"1.011"));
438 gate.data_.condition.incDependencies();
440 CHECK (detector.verifyInvocation(
"Gate").
seq(1).
arg(
"1.011 ⧐ Act(GATE"));
441 CHECK (detector.ensureNoInvocation(
"after-Gate").
seq(1)
442 .afterInvocation(
"Gate").
seq(1));
443 CHECK (detector.ensureNoInvocation(
"CTX-tick").
seq(1)
444 .afterInvocation(
"Gate").
seq(1));
449 CHECK (0 == gate.data_.condition.rest);
450 CHECK (detector.verifyInvocation(
"Gate") .
seq(2).
arg(
"1.011 --notify-↯> Act(GATE")
451 .beforeInvocation(
"after-Gate").
seq(2).
arg(
"1.011 ⧐ Act(TICK")
452 .beforeInvocation(
"CTX-tick") .
seq(2).
arg(
"1.011"));
471 Job testJob{detector.buildMockJob(
"testJob", nominal, 12345)};
474 detector.executionCtx.getSchedTime = [&]{
482 Activity& anchor = activityLang.buildCalculationJob (testJob, start,dead)
486 detector.watchGate (anchor.
next,
"theGate");
490 CHECK (detector.verifyInvocation(
"theGate").
arg(
"5.105 ⧐ Act(GATE")
491 .beforeInvocation(
"after-theGate").
arg(
"⧐ Act(WORKSTART")
492 .beforeInvocation(
"CTX-work").
arg(
"5.155",
"")
493 .beforeInvocation(
"testJob") .
arg(
"7.007",12345)
494 .beforeInvocation(
"CTX-done").
arg(
"5.355",
""));
514 Job testJob{detector.buildMockJob(
"testJob", nominal, 12345)};
523 auto term = activityLang.buildCalculationJob (testJob, start,dead)
524 .expectNotification (trigger)
525 .requireDirectActivation();
539 detector.watchGate (anchor.
next->
next,
"theGate");
544 detector.executionCtx.post.implementedAs(
552 CHECK (detector.verifyInvocation(
"CTX-post").
seq(0).
arg(
"01.000",
"10.000",
"trigger",
"≺test::CTX≻")
553 .beforeInvocation(
"trigger") .
seq(0).
arg(
"5.555 --notify-↯> Act(GATE")
554 .
arg(
"<2, until 0:00:10.000"));
555 CHECK (detector.ensureNoInvocation(
"testJob")
556 .afterInvocation(
"trigger"));
561 CHECK (detector.verifyInvocation(
"CTX-post").
seq(1).
arg(
"01.000",
"10.000",
"deBlock",
"≺test::CTX≻")
562 .beforeInvocation(
"deBlock") .
seq(1).
arg(
"5.555 --notify-↯> Act(GATE")
563 .
arg(
"<1, until 0:00:10.000")
564 .beforeInvocation(
"after-theGate") .
arg(
"5.555 ⧐ Act(WORKSTART")
565 .beforeInvocation(
"CTX-work").
seq(1).
arg(
"5.555",
"")
566 .beforeInvocation(
"testJob") .
seq(1).
arg(
"7.007",12345)
567 .beforeInvocation(
"CTX-done").
seq(1).
arg(
"5.555",
"")
568 .beforeInvocation(
"theGate") .
seq(1).
arg(
"5.555 ⧐ Act(GATE")
569 .
arg(
"<0, until -85401592:56:01.825"));
570 CHECK (detector.ensureNoInvocation(
"testJob")
571 .afterInvocation(
"CTX-done").
seq(1));
575 CHECK (detector.verifyInvocation(
"CTX-post").
seq(2).
arg(
"01.000",
Time::NEVER,
"trigger",
"≺test::CTX≻")
576 .beforeInvocation(
"trigger") .
seq(2).
arg(
"5.555 --notify-↯> Act(GATE")
577 .
arg(
"<0, until -85401592:56:01.825"));
578 CHECK (detector.ensureNoInvocation(
"testJob")
579 .afterInvocation(
"trigger").
seq(2));
599 Job loadJob{detector.buildMockJob(
"loadJob", nominal, 12345)};
600 Job calcJob{detector.buildMockJob(
"calcJob")};
605 auto followup = activityLang.buildCalculationJob (calcJob, start,dead);
606 auto loadTerm = activityLang.buildAsyncLoadJob (loadJob, start,dead)
607 .appendNotificationTo (followup);
610 Activity& notify = loadTerm.callback();
621 CHECK (notify.
next->
next ==
nullptr);
623 CHECK (notify.
next->data_.notification.target == followup.post().
next);
627 detector.executionCtx.post.implementedAs(
636 CHECK (detector.verifyInvocation(
"CTX-work").
seq(0).
arg(
"5.555",
"")
637 .beforeInvocation(
"loadJob") .
seq(0).
arg(
"7.007", 12345));
638 CHECK (detector.ensureNoInvocation(
"CTX-done").
seq(0)
639 .afterInvocation(
"loadJob").
seq(0));
645 CHECK (detector.verifyInvocation(
"CTX-done").
seq(1).
arg(
"5.555",
"")
646 .beforeInvocation(
"CTX-post").
seq(1).
arg(
"01.00",
"10.00",
"GATE",
"≺test::CTX≻")
647 .beforeInvocation(
"CTX-work").
seq(1).
arg(
"5.555",
"")
648 .beforeInvocation(
"calcJob") .
seq(1)
649 .beforeInvocation(
"CTX-done").
seq(1).
arg(
"5.555",
""));
669 Job testJob{detector.buildMockJob(
"metaJob", nominal, 12345)};
675 Activity& anchor = activityLang.buildMetaJob (testJob, start,dead)
689 CHECK (detector.verifyInvocation(
"tap-INVOKE").
arg(
"5.555 ⧐ Act(INVOKE")
690 .beforeInvocation(
"metaJob") .
arg(
"7.007",12345));
a mutable time value, behaving like a plain number, allowing copy and re-accessing ...
signal start of some processing and transition grooming mode ⟼ *work mode
Record to describe an Activity, to happen within the Scheduler's control flow.
void verifyActivity_Gate_block()
void verifyActivity_Gate_notify()
Activity & insertActivationTap(Activity *&wiring, string id="")
build ActivationProbe to record each activation before passing it to the subject
correspondingly signal end of some processing
void verifyActivity_Post()
supply additional payload data for a preceding Activity
int rani(uint bound=_iBOUND())
void verifyActivity_Gate_dead()
activity::Proc activate(Time now, EXE &executionCtx)
Core Operation: Activate and perform this Activity.
Lumiera's internal time value datatype.
void verifyActivity_Notify()
post a message providing a chain of further time-bound Activities
Abstract Base Class for all testcases.
Term builder and execution framework to perform chains of scheduler Activities.
ActivityMatch & seq(uint seqNr)
qualifier: additionally require the indicated sequence number
Diagnostic context to record and evaluate activations within the Scheduler.
Simplistic test class runner.
void seedRand()
draw a new random seed from a common nucleus, and re-seed the default-Gen.
A language framework to define and interconnect scheduler activity verbs.
void verifyActivity_Gate_opened()
void scenario_Notification()
boost::rational< int64_t > FSecs
rational representation of fractional seconds
A collection of frequently used helper functions to support unit testing.
activity::Proc dispatch(Time now, EXE &executionCtx)
Entrance point for an activation, which has been dispatched indirectly through the dispatch and/or pr...
uint incrementSeq()
increment the internal invocation sequence number
probe window + count-down; activate next Activity, else re-schedule
Activity * next
Activities are organised into chains to represent relations based on verbs.
Diagnostic setup to instrument and observe Activity activations.
internal engine »heart beat« for internal maintenance hook(s)
void verifyActivity_Invoke()
dispatch a JobFunctor into a worker thread
push a message to another Activity
void scenario_RenderJob()
static const Time NEVER
border condition marker value. NEVER >= any time value
static activity::Proc dispatchChain(Activity *chain, EXE &executionCtx)
Execution Framework: dispatch performance of a chain of Activities.
Individual frame rendering task, forwarding to a closure.
a family of time value like entities and their relationships.
Front-end for simplified access to the current wall clock time.
void verifyActivity_Gate_pass()
ActivityMatch & arg(ARGS const &...args)
qualifier: additionally match the function arguments
Vault-Layer implementation namespace root.