Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
fixture-segment-test.cpp
Go to the documentation of this file.
1/*
2 FixtureSegment(Test) - verify properties of a single segment in the fixture
3
4 Copyright (C)
5 2023, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
19#include "lib/test/run.hpp"
23#include "lib/util.hpp"
24
25#include <utility>
26
27
28namespace steam {
29namespace fixture {
30namespace test {
31
32 using std::move;
33 using util::isnil;
35 using engine::ExitNode;
37
38 using vault::gear::Job;
39 using engine::JobTicket;
40 using engine::test::MockSegmentation;
41
42
43 /*****************************************************************************/
51 class FixtureSegment_test : public Test
52 {
53
54 virtual void
55 run (Arg)
56 {
57 seedRand();
60 }
61
62
67 void
69 {
70 // Build a Segmentation partitioned at 10s
71 MockSegmentation segmentation{MakeRec()
72 .attrib ("start", Time{0,10}
73 ,"mark", 101010)
74 .genNode()};
75 CHECK (2 == segmentation.size());
76 Segment const& seg = segmentation[Time{0,20}]; // access anywhere >= 10s
77 CHECK (Time(0,10) == seg.start());
78 CHECK (Time::NEVER == seg.after());
79 CHECK (101010 == seg.exitNode[0].getPipelineIdentity());
80 }
81
82
85 void
87 {
88 MockSegmentation segmentation{MakeRec()
89 .attrib("mark", 13) // top-level: marked with hash/id = 13
90 .scope(MakeRec() // ... defines two nested prerequisites
91 .attrib("mark",23) // + Prerequisite-1 hash/id = 23
92 .genNode()
93 ,MakeRec()
94 .attrib("mark",55) // + Prerequisite-2 hash/id = 55
95 .genNode()
96 )
97 .genNode()};
98 CHECK (1 == segmentation.size()); // whole time axis covered by one segment
99 Segment const& seg = segmentation[Time::ANYTIME]; // thus accessed time point is irrelevant
100
101 // verify mapped JobTicket is assembled according to above spec...
102 auto getMarker = [](JobTicket& ticket)
103 {
104 Job job = ticket.createJobFor(Time::ANYTIME);
105 return job.parameter.invoKey.part.a;
106 };
107
108 JobTicket& ticket = seg.jobTicket(0);
109 CHECK (13 == getMarker (ticket));
110 auto prereq = ticket.getPrerequisites();
111 CHECK (not isnil(prereq));
112 CHECK (55 == getMarker (*prereq)); // Note: order of prerequisites is flipped (by LinkedElements)
113 ++prereq;
114 CHECK (23 == getMarker (*prereq));
115 ++prereq;
116 CHECK (isnil(prereq));
117 }
118 };
119
120
122 LAUNCHER (FixtureSegment_test, "unit fixture");
123
124
125
126}}} // namespace steam::fixture::test
Mutator && scope(X const &initialiser, ARGS &&...args)
Definition record.hpp:578
Mutator && attrib(string const &key, X &&initialiser, ARGS &&...args)
Definition record.hpp:569
Lumiera's internal time value datatype.
static const Time NEVER
border condition marker value. NEVER >= any time value
static const Time ANYTIME
border condition marker value. ANYTIME <= any time value
execution plan for pulling a specific exit node.
auto getPrerequisites()
Core operation: iterate over the prerequisites, required to carry out a render operation based on thi...
Mock setup for a complete Segmentation to emulate the structure of the actual fixture,...
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
Definition segment.hpp:60
engine::JobTicket & jobTicket(size_t portNr) const
Access the JobTicket for this segment and the given portNr.
Definition segment.hpp:122
NodeGraphAttachment exitNode
connection to the render nodes network
Definition segment.hpp:114
Individual frame rendering task, forwarding to a closure.
Definition job.h:276
Effective top-level exit point to pull rendered data from the nodes network.
Mock data structures to support implementation testing of render job planning and frame dispatch.
Steam-Layer implementation namespace root.
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.
Definition util.hpp:421
bool isnil(lib::time::Duration const &dur)
Link from the Fixture datastructure into the render node network.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...