33 #include "lib/util-tuple.hpp" 83 .attrib (
"start",
Time{0,10}
86 CHECK (3 == mockSegs.size());
95 CHECK (MockJob::was_invoked (job));
105 Time nominalTime = lib::test::randTime();
106 int additionalKey = rand() % 5000;
107 MockJob mockJob{nominalTime, additionalKey};
108 CHECK (mockJob.getNominalTime() == nominalTime);
109 CHECK (not MockJob::was_invoked (mockJob));
111 mockJob.triggerJob();
112 CHECK (MockJob::was_invoked (mockJob));
113 CHECK (RealClock::wasRecently (MockJob::invocationTime (mockJob)));
114 CHECK (nominalTime == MockJob::invocationNominalTime (mockJob) );
115 CHECK (additionalKey == MockJob::invocationAdditionalKey(mockJob));
117 Time prevInvocation = MockJob::invocationTime (mockJob);
118 mockJob.triggerJob();
119 CHECK (prevInvocation < MockJob::invocationTime (mockJob));
120 CHECK (nominalTime == MockJob::invocationNominalTime (mockJob) );
121 CHECK (additionalKey == MockJob::invocationAdditionalKey(mockJob));
129 auto frameTime = lib::test::randTime();
134 CHECK (nopJob.parameter.nominalTime == frameTime);
136 CHECK (lumiera_invokey_eq (&nopJob.parameter.invoKey, &empty));
140 CHECK (not mockTicket.empty());
160 Time someTime = lib::test::randTime();
165 CHECK (1 == mockSeg.size());
166 JobTicket const& ticket = mockSeg[someTime].jobTicket(0);
172 CHECK (1 == mockSegs.size());
173 CHECK (Time::MIN == mockSegs[someTime].start());
174 CHECK (
Time::MAX == mockSegs[someTime].after());
175 JobTicket& ticket = mockSegs[someTime].jobTicket(0);
179 CHECK (someJob.parameter.nominalTime == someTime);
181 CHECK (not MockJob::was_invoked (someJob));
183 someJob.triggerJob();
184 CHECK (MockJob::was_invoked (someJob));
185 CHECK (RealClock::wasRecently (MockJob::invocationTime (someJob)));
186 CHECK (someTime == MockJob::invocationNominalTime (someJob));
191 int marker = rand() % 1000;
195 .attrib (
"start",
Time{0,10}
198 CHECK (2 == mockSegs.size());
210 CHECK (marker == job.parameter.invoKey.part.a);
213 CHECK (MockJob::was_invoked (job));
214 CHECK (RealClock::wasRecently (MockJob::invocationTime (job)));
215 CHECK (marker == MockJob::invocationAdditionalKey (job));
218 job = seg1.jobTicket(0).createJobFor (someTime);
220 CHECK (lumiera_invokey_eq (&job.parameter.invoKey, &empty));
221 CHECK (seg1.jobTicket(0).empty());
222 CHECK (seg1.empty());
223 CHECK (not seg2.empty());
227 int marker = rand() % 1000;
230 .attrib (
"start",
Time{0,10}
234 CHECK (3 == mockSegs.size());
235 auto const& [s1,s2,s3] = seqTuple<3> (mockSegs.eachSeg());
237 CHECK (not s2.empty());
239 CHECK (isSameObject (s2, mockSegs[
Time{0,10}]));
240 CHECK (Time::MIN == s1.start());
241 CHECK (
Time(0,10) == s1.after());
242 CHECK (
Time(0,10) == s2.start());
243 CHECK (
Time(0,20) == s2.after());
244 CHECK (
Time(0,20) == s3.start());
247 Job job = s2.jobTicket(0).createJobFor(someTime);
249 CHECK (marker == MockJob::invocationAdditionalKey (job));
255 .attrib (
"start",
Time{0,20}
260 .attrib (
"after", Time::ZERO
264 .attrib (
"start",
Time{FSecs{-5}}
268 CHECK (5 == mockSegs.size());
269 auto const& [s1,s2,s3,s4,s5] = seqTuple<5> (mockSegs.eachSeg());
270 CHECK (not s1.empty());
271 CHECK (not s2.empty());
273 CHECK (not s4.empty());
275 CHECK (Time::MIN == s1.start());
276 CHECK (-
Time(0,5) == s1.after());
277 CHECK (-
Time(0,5) == s2.start());
278 CHECK (
Time(0, 0) == s2.after());
279 CHECK (
Time(0, 0) == s3.start());
280 CHECK (
Time(0,10) == s3.after());
281 CHECK (
Time(0,10) == s4.start());
282 CHECK (
Time(0,20) == s4.after());
283 CHECK (
Time(0,20) == s5.start());
286 auto probeKey = [&](
Segment const& segment)
288 if (segment.empty())
return 0;
290 Job job = segment.jobTicket(0).createJobFor(someTime);
292 CHECK (MockJob::was_invoked (job));
293 CHECK (RealClock::wasRecently (MockJob::invocationTime (job)));
295 return MockJob::invocationAdditionalKey (job);
297 CHECK (2 == probeKey(s1));
298 CHECK (3 == probeKey(s2));
299 CHECK (0 == probeKey(s3));
300 CHECK (1 == probeKey(s4));
301 CHECK (0 == probeKey(s5));
315 Time someTime = lib::test::randTime();
324 CHECK (1 == mockSegs.size());
325 JobTicket& ticket = mockSegs[Time::ZERO].jobTicket(0);
327 CHECK (not isnil (prereq));
331 CHECK (isnil (prereq));
334 Job job2 = ticket.createJobFor (someTime);
338 CHECK (23 == MockJob::invocationAdditionalKey (job1));
339 CHECK (11 == MockJob::invocationAdditionalKey (job2));
370 return ticket.
createJobFor(someTime).parameter.invoKey.part.a;
374 CHECK (util::join(it,
"-") ==
"11-22-33-44-55"_expect);
397 CHECK (port0 != port1);
398 CHECK (sink0 != sink1);
399 CHECK (port0.isValid());
400 CHECK (port1.isValid());
401 CHECK (sink0.isValid());
402 CHECK (sink1.isValid());
409 Time frameTime{0,30};
410 size_t modelPortIDX = 0;
414 CHECK (dispatcher.
verify(job0, port0, sink0));
415 CHECK (dispatcher.
verify(job1, port1, sink1));
424 .attrib(
"start",
Time{0,10})
427 size_t modelPortIDX = 1;
428 Job job0 = dispatcher.createJobFor (modelPortIDX,
Time{0,5});
429 Job job1 = dispatcher.createJobFor (modelPortIDX,
Time{0,25});
431 CHECK (11 == job0.parameter.invoKey.part.a);
432 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.
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.
Simple test class runner.
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, bypassing any custom comparison operators.