87 CHECK (start.next ==
nullptr);
89 CHECK (start.data_.timing.quality == 0);
95 Time now = RealClock::now();
96 start.activate (now, detector.executionCtx);
99 CHECK (detector.verifyInvocation(
"CTX-work").
arg(now, 0));
120 CHECK (
Time(0,11) == post.data_.timeWindow.life);
121 CHECK (
Time(0,22) == post.data_.timeWindow.dead);
122 CHECK ( & chain == post.
next);
126 post.activate (tt, detector.executionCtx);
128 CHECK (detector.verifyInvocation(
"CTX-post").
arg(
"11.000",
"22.000",
"Act(POST",
"≺test::CTX≻"));
143 uint64_t x1=rand(), x2=rand();
144 Time nomTime = lib::test::randTime();
148 Activity invoke{detector.buildMockJobFunctor(
"job"), nomTime, feed};
150 Time realTime = RealClock::now();
151 CHECK (activity::PASS == invoke.activate (realTime, detector.executionCtx));
153 CHECK (detector.verifyInvocation (
"job").
arg(nomTime, x1));
176 notify.activate (tt, detector.executionCtx);
177 CHECK (detector.verifyInvocation(
"CTX-post").
arg(
"11.111",
Time::NEVER,
"Act(TICK",
"≺test::CTX≻"));
184 notify.data_.notification.target = &gate;
185 notify.data_.notification.timing = ts;
187 notify.activate (tt, detector.executionCtx);
188 CHECK (detector.verifySeqIncrement(1)
189 .beforeInvocation(
"CTX-post").
arg(
"33.333",
"55.555",
"Act(GATE",
"≺test::CTX≻"));
207 Activity& wiring = detector.buildGateWatcher (gate);
210 CHECK (activity::PASS == wiring.
activate (tt, detector.executionCtx));
211 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE"));
227 Activity& wiring = detector.buildGateWatcher (gate);
233 CHECK (activity::PASS == wiring.
activate (t1, detector.executionCtx));
234 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.330 ⧐ Act(GATE").
seq(0));
237 CHECK (activity::SKIP == wiring.
activate (t2, detector.executionCtx));
238 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE").
seq(1));
241 CHECK (activity::SKIP == wiring.
activate (t3, detector.executionCtx));
242 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.335 ⧐ Act(GATE").
seq(2));
262 Activity& wiring = detector.buildGateWatcher (gate);
265 CHECK (activity::SKIP == wiring.
activate (tt, detector.executionCtx));
266 CHECK (23 == gate.data_.condition.rest);
268 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE"));
288 Activity& entrance = detector.buildGateWatcher (gate);
291 CHECK (activity::SKIP == entrance.
dispatch (tt, detector.executionCtx));
292 CHECK (22 == gate.data_.condition.rest);
294 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 --notify-↯> Act(GATE"));
319 CHECK (gate.data_.condition.isHold());
320 CHECK (gate.data_.condition.rest == 1);
321 CHECK (gate.data_.condition.dead == td);
324 Activity& entrance = detector.buildGateWatcher (gate);
327 CHECK (activity::SKIP == entrance.
activate (tt, detector.executionCtx));
328 CHECK (1 == gate.data_.condition.rest);
329 CHECK (detector.verifyInvocation(
"tap-GATE").
arg(
"33.333 ⧐ Act(GATE"));
333 CHECK (activity::PASS == entrance.
dispatch(tt, detector.executionCtx));
334 CHECK (0 == gate.data_.condition.rest);
336 CHECK (detector.verifyInvocation(
"tap-GATE").
seq(0).
arg(
"33.333 ⧐ Act(GATE")
337 .beforeInvocation(
"tap-GATE").
seq(1).
arg(
"33.333 --notify-↯> Act(GATE"));
338 CHECK (gate.data_.condition.dead == Time::MIN);
343 CHECK (activity::SKIP == entrance.
activate (ttt, detector.executionCtx));
344 CHECK (detector.verifyInvocation(
"tap-GATE").
seq(2).
arg(
"44.444 ⧐ Act(GATE"));
345 CHECK (detector.ensureNoInvocation(
"CTX-post").
seq(2)
346 .afterInvocation(
"tap-GATE").
seq(2));
347 CHECK (gate.data_.condition.dead == Time::MIN);
351 CHECK (activity::SKIP == entrance.
dispatch (ttt, detector.executionCtx));
353 CHECK (gate.data_.condition.dead == Time::MIN);
354 CHECK (gate.data_.condition.rest == 0);
356 CHECK (detector.verifySeqIncrement(3)
357 .beforeInvocation(
"tap-GATE").
seq(3).
arg(
"44.444 --notify-↯> Act(GATE"));
382 auto term = activityLang.buildCalculationJob (detector.buildMockJob(), start,dead);
388 CHECK (watch(bFlow).cntElm() == 7);
389 CHECK (watch(bFlow).cntEpochs() == 1);
390 CHECK (watch(bFlow).find(*act) > dead);
391 CHECK (watch(bFlow).find(*act) < dead+
Time(500,0));
395 CHECK (start == act->data_.timeWindow.life);
396 CHECK (dead == act->data_.timeWindow.dead);
407 CHECK (activity::PASS == act->activate (now, detector.executionCtx));
408 CHECK (detector.verifyInvocation(
"mockJob"));
435 detector.executionCtx.getSchedTime = [&]{
return tt; };
437 detector.watchGate (post.next,
"Gate");
440 CHECK (detector.verifyInvocation(
"Gate") .
arg(
"1.011 ⧐ Act(GATE")
441 .beforeInvocation(
"after-Gate").
arg(
"1.011 ⧐ Act(TICK")
442 .beforeInvocation(
"CTX-tick") .
arg(
"1.011"));
445 gate.data_.condition.incDependencies();
447 CHECK (detector.verifyInvocation(
"Gate").
seq(1).
arg(
"1.011 ⧐ Act(GATE"));
448 CHECK (detector.ensureNoInvocation(
"after-Gate").
seq(1)
449 .afterInvocation(
"Gate").
seq(1));
450 CHECK (detector.ensureNoInvocation(
"CTX-tick").
seq(1)
451 .afterInvocation(
"Gate").
seq(1));
456 CHECK (0 == gate.data_.condition.rest);
457 CHECK (detector.verifyInvocation(
"Gate") .
seq(2).
arg(
"1.011 --notify-↯> Act(GATE")
458 .beforeInvocation(
"after-Gate").
seq(2).
arg(
"1.011 ⧐ Act(TICK")
459 .beforeInvocation(
"CTX-tick") .
seq(2).
arg(
"1.011"));
478 Job testJob{detector.buildMockJob(
"testJob", nominal, 12345)};
481 detector.executionCtx.getSchedTime = [&]{
489 Activity& anchor = activityLang.buildCalculationJob (testJob, start,dead)
493 detector.watchGate (anchor.
next,
"theGate");
497 CHECK (detector.verifyInvocation(
"theGate").
arg(
"5.105 ⧐ Act(GATE")
498 .beforeInvocation(
"after-theGate").
arg(
"⧐ Act(WORKSTART")
499 .beforeInvocation(
"CTX-work").
arg(
"5.155",
"")
500 .beforeInvocation(
"testJob") .
arg(
"7.007",12345)
501 .beforeInvocation(
"CTX-done").
arg(
"5.355",
""));
521 Job testJob{detector.buildMockJob(
"testJob", nominal, 12345)};
530 auto term = activityLang.buildCalculationJob (testJob, start,dead)
531 .expectNotification (trigger)
532 .requireDirectActivation();
546 detector.watchGate (anchor.
next->
next,
"theGate");
551 detector.executionCtx.post.implementedAs(
559 CHECK (detector.verifyInvocation(
"CTX-post").
seq(0).
arg(
"01.000",
"10.000",
"trigger",
"≺test::CTX≻")
560 .beforeInvocation(
"trigger") .
seq(0).
arg(
"5.555 --notify-↯> Act(GATE")
561 .
arg(
"<2, until 0:00:10.000"));
562 CHECK (detector.ensureNoInvocation(
"testJob")
563 .afterInvocation(
"trigger"));
568 CHECK (detector.verifyInvocation(
"CTX-post").
seq(1).
arg(
"01.000",
"10.000",
"deBlock",
"≺test::CTX≻")
569 .beforeInvocation(
"deBlock") .
seq(1).
arg(
"5.555 --notify-↯> Act(GATE")
570 .
arg(
"<1, until 0:00:10.000")
571 .beforeInvocation(
"after-theGate") .
arg(
"5.555 ⧐ Act(WORKSTART")
572 .beforeInvocation(
"CTX-work").
seq(1).
arg(
"5.555",
"")
573 .beforeInvocation(
"testJob") .
seq(1).
arg(
"7.007",12345)
574 .beforeInvocation(
"CTX-done").
seq(1).
arg(
"5.555",
"")
575 .beforeInvocation(
"theGate") .
seq(1).
arg(
"5.555 ⧐ Act(GATE")
576 .
arg(
"<0, until -85401592:56:01.825"));
577 CHECK (detector.ensureNoInvocation(
"testJob")
578 .afterInvocation(
"CTX-done").
seq(1));
582 CHECK (detector.verifyInvocation(
"CTX-post").
seq(2).
arg(
"01.000",
Time::NEVER,
"trigger",
"≺test::CTX≻")
583 .beforeInvocation(
"trigger") .
seq(2).
arg(
"5.555 --notify-↯> Act(GATE")
584 .
arg(
"<0, until -85401592:56:01.825"));
585 CHECK (detector.ensureNoInvocation(
"testJob")
586 .afterInvocation(
"trigger").
seq(2));
606 Job loadJob{detector.buildMockJob(
"loadJob", nominal, 12345)};
607 Job calcJob{detector.buildMockJob(
"calcJob")};
612 auto followup = activityLang.buildCalculationJob (calcJob, start,dead);
613 auto loadTerm = activityLang.buildAsyncLoadJob (loadJob, start,dead)
614 .appendNotificationTo (followup);
617 Activity& notify = loadTerm.callback();
628 CHECK (notify.
next->
next ==
nullptr);
630 CHECK (notify.
next->data_.notification.target == followup.post().
next);
634 detector.executionCtx.post.implementedAs(
643 CHECK (detector.verifyInvocation(
"CTX-work").
seq(0).
arg(
"5.555",
"")
644 .beforeInvocation(
"loadJob") .
seq(0).
arg(
"7.007", 12345));
645 CHECK (detector.ensureNoInvocation(
"CTX-done").
seq(0)
646 .afterInvocation(
"loadJob").
seq(0));
652 CHECK (detector.verifyInvocation(
"CTX-done").
seq(1).
arg(
"5.555",
"")
653 .beforeInvocation(
"CTX-post").
seq(1).
arg(
"01.00",
"10.00",
"GATE",
"≺test::CTX≻")
654 .beforeInvocation(
"CTX-work").
seq(1).
arg(
"5.555",
"")
655 .beforeInvocation(
"calcJob") .
seq(1)
656 .beforeInvocation(
"CTX-done").
seq(1).
arg(
"5.555",
""));
676 Job testJob{detector.buildMockJob(
"metaJob", nominal, 12345)};
682 Activity& anchor = activityLang.buildMetaJob (testJob, start,dead)
696 CHECK (detector.verifyInvocation(
"tap-INVOKE").
arg(
"5.555 ⧐ Act(INVOKE")
697 .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
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.
Simple test class runner.
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.