78 CHECK (55 == trap (1.23,
Time{FSecs{3,2}}));
80 CHECK (detector ==
"Rec(EventLogHeader| this = ActivityDetector(spectre) ), "
81 "Rec(call| fun = trap, this = ActivityDetector(spectre), Seq = 0 |{1.23, 0:00:01.500})"_expect);
97 uint rnd = rani(10000);
100 CHECK (1 == detector.
currSeq());
104 CHECK (2 == detector.
currSeq());
125 CHECK (detector ==
"Rec(EventLogHeader| this = ActivityDetector )"
126 ", Rec(event| ID = IncSeq |{1})"
127 ", Rec(event| ID = IncSeq |{2})"
128 ", Rec(call| fun = funny, this = ActivityDetector, Seq = 2 |{"+
util::toString(rnd)+
"})"
129 ", Rec(event| ID = IncSeq |{3})"
130 ", Rec(call| fun = funny, this = ActivityDetector, Seq = 3 |{"+
util::toString(rnd+1)+
"})"_expect);
143 uint rnd = rani(10000);
145 CHECK (0 == fun (rnd));
149 CHECK (42 == fun (rnd));
151 fun.implementedAs ([](
uint i){
return -i; });
153 CHECK (-
int(rnd) == fun (rnd));
174 Time nominal{FSecs{5,2}};
182 dummyJob.triggerJob();
189 dummyJob.triggerJob();
193 .afterSeqIncrement(1)
255 auto someID =
"trap-" + randStr(4);
267 CHECK (realTime == detector.
invokeTime (probe));
281 Activity feed{
size_t{12},
size_t{34}};
282 Activity feed2{
size_t{56},
size_t{78}};
284 string jobID =
"job-" + randStr(4);
293 CHECK (tap.
next == invoke.next);
322 Activity followUp{size_t(1), size_t(2)};
323 subject.
next = &followUp;
325 CHECK (isSameObject (*wiring, subject));
329 CHECK (not isSameObject (*wiring, subject));
332 CHECK (wiring->
next == subject.
next);
365 CHECK (gate.data_.condition.rest == 1);
371 CHECK (detector.
verifyInvocation(
"CTX-post").
arg(
"22.022",
"33.033",
"tap-GATE",
"≺test::CTX≻"));
376 notification.data_.notification.target->dispatch (ts, detector.
executionCtx);
378 CHECK (gate.data_.condition.rest == 0);
399 gate.
next = &followUp;
Diagnostic setup to instrument and observe Activity activations.
static const raw_time_64 SCALE
Number of micro ticks (µs) per second as basic time scale.
Lumiera's internal time value datatype.
Record to describe an Activity, to happen within the Scheduler's control flow.
bool is(Activity::Verb expectedVerb) const
activity::Proc activate(Time now, EXE &executionCtx)
Core Operation: Activate and perform this Activity.
Activity * next
Activities are organised into chains to represent relations based on verbs.
@ HOOK
invoke an extension point through the activity::Hook interface
@ TICK
internal engine »heart beat« for internal maintenance hook(s)
Individual frame rendering task, forwarding to a closure.
void verifyMockInvocation()
void verifyFakeExeContext()
void verifyFakeInvocation()
void watch_ActivationTap()
void watch_notification()
void watch_ActivationProbe()
void insert_ActivationTap()
void verifyMockJobFunctor()
Diagnostic context to record and evaluate activations within the Scheduler.
ActivityMatch verifySeqIncrement(uint seqNr)
bool wasInvoked(Activity const *hook)
auto buildDiagnosticFun(string id)
Generic testing helper: build a λ-mock, logging all invocations.
JobClosure & buildMockJobFunctor(string id)
ActivityMatch ensureNoInvocation(string fun)
Activity & buildActivationProbe(string id)
build a rigged HOOK-Activity to record each invocation
FakeExecutionCtx executionCtx
Activity & insertActivationTap(Activity *&wiring, string id="")
build ActivationProbe to record each activation before passing it to the subject
Time invokeTime(Activity const *hook)
Activity & watchGate(Activity *&wiring, string id="")
Activity & buildActivationTap(Activity const &subject, string id="")
build ActivationProbe to record each activation before passing it to the subject
ActivityMatch verifyInvocation(string fun)
uint incrementSeq()
increment the internal invocation sequence number
ActivityMatch & arg(ARGS const &...args)
qualifier: additionally match the function arguments
ActivityMatch & beforeInvocation(string match)
ActivityMatch & beforeSeqIncrement(uint seqNr)
special query to match an increment of the sequence number
ActivityMatch & seq(uint seqNr)
qualifier: additionally require the indicated sequence number
ActivityMatch & timeArg(Time const &time)
qualifier: additionally match the nominal time argument of JobFunctor invocation
struct InvocationInstanceID::@62 part
opaque ID attached to each individual job invocation.
lib::time::Time randTime()
create a random but not insane Time value between 1s ... 10min + 500ms
string randStr(size_t len)
create garbage string of given length
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Test runner and basic definitions for tests.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities.
std::string toString(TY const &val) noexcept
get some string representation of any object, reliably.
constexpr void _verify_usable_as_ExecutionContext()
Definition to emulate a Concept for the Execution Context.
@ PASS
pass on the activation down the chain
@ KICK
back pressure; get out of the way but be back soon
Vault-Layer implementation namespace root.
Front-end for simplified access to the current wall clock time.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
A collection of frequently used helper functions to support unit testing.
a family of time value like entities and their relationships.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...