24 #include "lib/util-tuple.hpp" 76 .attrib (
"start",
Time{0,10}
79 CHECK (3 == mockSegs.size());
88 CHECK (MockJob::was_invoked (job));
98 Time nominalTime = lib::test::randTime();
99 int additionalKey =
rani(5000);
100 MockJob mockJob{nominalTime, additionalKey};
101 CHECK (mockJob.getNominalTime() == nominalTime);
102 CHECK (not MockJob::was_invoked (mockJob));
104 mockJob.triggerJob();
105 CHECK (MockJob::was_invoked (mockJob));
106 CHECK (RealClock::wasRecently (MockJob::invocationTime (mockJob)));
107 CHECK (nominalTime == MockJob::invocationNominalTime (mockJob) );
108 CHECK (additionalKey == MockJob::invocationAdditionalKey(mockJob));
110 Time prevInvocation = MockJob::invocationTime (mockJob);
111 mockJob.triggerJob();
112 CHECK (prevInvocation < MockJob::invocationTime (mockJob));
113 CHECK (nominalTime == MockJob::invocationNominalTime (mockJob) );
114 CHECK (additionalKey == MockJob::invocationAdditionalKey(mockJob));
122 auto frameTime = lib::test::randTime();
127 CHECK (nopJob.parameter.nominalTime == frameTime);
129 CHECK (lumiera_invokey_eq (&nopJob.parameter.invoKey, &empty));
133 CHECK (not mockTicket.empty());
153 Time someTime = lib::test::randTime();
158 CHECK (1 == mockSeg.size());
159 JobTicket const& ticket = mockSeg[someTime].jobTicket(0);
165 CHECK (1 == mockSegs.size());
166 CHECK (Time::MIN == mockSegs[someTime].start());
167 CHECK (
Time::MAX == mockSegs[someTime].after());
168 JobTicket& ticket = mockSegs[someTime].jobTicket(0);
172 CHECK (someJob.parameter.nominalTime == someTime);
174 CHECK (not MockJob::was_invoked (someJob));
176 someJob.triggerJob();
177 CHECK (MockJob::was_invoked (someJob));
178 CHECK (RealClock::wasRecently (MockJob::invocationTime (someJob)));
179 CHECK (someTime == MockJob::invocationNominalTime (someJob));
184 int marker =
rani(1000);
188 .attrib (
"start",
Time{0,10}
191 CHECK (2 == mockSegs.size());
203 CHECK (marker == job.parameter.invoKey.part.a);
206 CHECK (MockJob::was_invoked (job));
207 CHECK (RealClock::wasRecently (MockJob::invocationTime (job)));
208 CHECK (marker == MockJob::invocationAdditionalKey (job));
211 job = seg1.jobTicket(0).createJobFor (someTime);
213 CHECK (lumiera_invokey_eq (&job.parameter.invoKey, &empty));
214 CHECK (seg1.jobTicket(0).empty());
215 CHECK (seg1.empty());
216 CHECK (not seg2.empty());
220 int marker =
rani(1000);
223 .attrib (
"start",
Time{0,10}
227 CHECK (3 == mockSegs.size());
228 auto const& [s1,s2,s3] = seqTuple<3> (mockSegs.eachSeg());
230 CHECK (not s2.empty());
232 CHECK (isSameObject (s2, mockSegs[
Time{0,10}]));
233 CHECK (Time::MIN == s1.start());
234 CHECK (
Time(0,10) == s1.after());
235 CHECK (
Time(0,10) == s2.start());
236 CHECK (
Time(0,20) == s2.after());
237 CHECK (
Time(0,20) == s3.start());
240 Job job = s2.jobTicket(0).createJobFor(someTime);
242 CHECK (marker == MockJob::invocationAdditionalKey (job));
248 .attrib (
"start",
Time{0,20}
253 .attrib (
"after", Time::ZERO
257 .attrib (
"start",
Time{FSecs{-5}}
261 CHECK (5 == mockSegs.size());
262 auto const& [s1,s2,s3,s4,s5] = seqTuple<5> (mockSegs.eachSeg());
263 CHECK (not s1.empty());
264 CHECK (not s2.empty());
266 CHECK (not s4.empty());
268 CHECK (Time::MIN == s1.start());
269 CHECK (-
Time(0,5) == s1.after());
270 CHECK (-
Time(0,5) == s2.start());
271 CHECK (
Time(0, 0) == s2.after());
272 CHECK (
Time(0, 0) == s3.start());
273 CHECK (
Time(0,10) == s3.after());
274 CHECK (
Time(0,10) == s4.start());
275 CHECK (
Time(0,20) == s4.after());
276 CHECK (
Time(0,20) == s5.start());
279 auto probeKey = [&](
Segment const& segment)
281 if (segment.empty())
return 0;
283 Job job = segment.jobTicket(0).createJobFor(someTime);
285 CHECK (MockJob::was_invoked (job));
286 CHECK (RealClock::wasRecently (MockJob::invocationTime (job)));
288 return MockJob::invocationAdditionalKey (job);
290 CHECK (2 == probeKey(s1));
291 CHECK (3 == probeKey(s2));
292 CHECK (0 == probeKey(s3));
293 CHECK (1 == probeKey(s4));
294 CHECK (0 == probeKey(s5));
308 Time someTime = lib::test::randTime();
317 CHECK (1 == mockSegs.size());
318 JobTicket& ticket = mockSegs[Time::ZERO].jobTicket(0);
320 CHECK (not isnil (prereq));
324 CHECK (isnil (prereq));
327 Job job2 = ticket.createJobFor (someTime);
331 CHECK (23 == MockJob::invocationAdditionalKey (job1));
332 CHECK (11 == MockJob::invocationAdditionalKey (job2));
363 return ticket.
createJobFor(someTime).parameter.invoKey.part.a;
367 CHECK (util::join(it,
"-") ==
"11-22-33-44-55"_expect);
390 CHECK (port0 != port1);
391 CHECK (sink0 != sink1);
392 CHECK (port0.isValid());
393 CHECK (port1.isValid());
394 CHECK (sink0.isValid());
395 CHECK (sink1.isValid());
402 Time frameTime{0,30};
403 size_t modelPortIDX = 0;
407 CHECK (dispatcher.
verify(job0, port0, sink0));
408 CHECK (dispatcher.
verify(job1, port1, sink1));
417 .attrib(
"start",
Time{0,10})
420 size_t modelPortIDX = 1;
421 Job job0 = dispatcher.createJobFor (modelPortIDX,
Time{0,5});
422 Job job1 = dispatcher.createJobFor (modelPortIDX,
Time{0,25});
424 CHECK (11 == job0.parameter.invoKey.part.a);
425 CHECK (22 == job1.parameter.invoKey.part.a);
size_t resolveModelPort(ModelPort modelPort) override
translate a generic ModelPort spec into the specific index number applicable at the Timeline referred...
void verify_MockPrerequisites()
Mock data structures to support implementation testing of render job planning and frame dispatch...
Generic implementation of a JobFunctor to perform no calculations.
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
Mock setup for a JobTicket to generate dummy render Job invocations.
bool verify_associated(Job const &) const
verify the given job instance was actually generated from this JobTicket.
#define INSTANCEOF(CLASS, EXPR)
shortcut for subclass test, intended for assertions only.
A mocked frame Dispatcher setup without any backing model.
int rani(uint bound=_iBOUND())
engine::JobTicket & jobTicket(size_t portNr) const
Access the JobTicket for this segment and the given portNr.
void verify_MockDispatcherSetup()
Mock setup for a render Job with NO action but built-in diagnostics.
denotes an opened connection ready to receive media data for output.
play::test::DummyOutputLink getDummyConnection(uint index)
The faked builder/playback setup provides some preconfigured ModelPort and corresponding DataSink han...
Steam-Layer implementation namespace root.
static JobTicket NOP
special »do nothing« JobTicket marker
void verify_MockSegmentation()
Lumiera's internal time value datatype.
void verify_MockJobTicket()
Abstract Base Class for all testcases.
bool verify(Job const &job, ModelPort const &port, play::DataSink const &sink)
Test support: verify the given Job is consistent with this Dispatcher.
Simplistic test class runner.
void seedRand()
draw a new random seed from a common nucleus, and re-seed the default-Gen.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Mock setup for a complete Segmentation to emulate the structure of the actual fixture, without the need of building a low-level Model.
A collection of frequently used helper functions to support unit testing.
auto singleValIterator(VAL &&something)
Build a SingleValIter: convenience free function shortcut, to pick up just any value and wrap it as L...
static bool isAssociated(Job const &, JobTicket const &)
convenience shortcut to perform this test on arbitrary JobTicket and Job instances.
Handle designating a point within the model, where actually output data can be pulled.
opaque ID attached to each individual job invocation.
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
static bool isNopJob(Job const &)
Job createJobFor(size_t portIDX, TimeValue nominalTime)
Convenience shortcut for tests: JobTicket ⟼ Job.
Building tree expanding and backtracking evaluations within hierarchical scopes.
Individual frame rendering task, forwarding to a closure.
auto getPrerequisites()
Core operation: iterate over the prerequisites, required to carry out a render operation based on thi...
execution plan for pulling a specific exit node.
Stub/Test implementation of the JobFunctor interface for a render job to do nothing at all ...
Job createJobFor(Time nominalTime)
Core operation: build a concrete render job based on this blueprint.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...