Lumiera  0.pre.03
»edit your freedom«
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) Lumiera.org
5  2023, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
28 #include "lib/test/run.hpp"
32 #include "lib/util.hpp"
33 
34 #include <utility>
35 
36 
37 namespace steam {
38 namespace fixture {
39 namespace test {
40 
41  using std::move;
42  using util::isnil;
43  using util::isSameObject;
44  using engine::ExitNode;
45  using lib::diff::MakeRec;
46 
47  using vault::gear::Job;
48  using engine::JobTicket;
49  using engine::test::MockSegmentation;
50 
51 
52  /*****************************************************************************/
60  class FixtureSegment_test : public Test
61  {
62 
63  virtual void
64  run (Arg)
65  {
68  }
69 
70 
75  void
77  {
78  // Build a Segmentation partitioned at 10s
79  MockSegmentation segmentation{MakeRec()
80  .attrib ("start", Time{0,10}
81  ,"mark", 101010)
82  .genNode()};
83  CHECK (2 == segmentation.size());
84  Segment const& seg = segmentation[Time{0,20}]; // access anywhere >= 10s
85  CHECK (Time(0,10) == seg.start());
86  CHECK (Time::NEVER == seg.after());
87  CHECK (101010 == seg.exitNode[0].getPipelineIdentity());
88  }
89 
90 
93  void
95  {
96  MockSegmentation segmentation{MakeRec()
97  .attrib("mark", 13) // top-level: marked with hash/id = 13
98  .scope(MakeRec() // ... defines two nested prerequisites
99  .attrib("mark",23) // + Prerequisite-1 hash/id = 23
100  .genNode()
101  ,MakeRec()
102  .attrib("mark",55) // + Prerequisite-2 hash/id = 55
103  .genNode()
104  )
105  .genNode()};
106  CHECK (1 == segmentation.size()); // whole time axis covered by one segment
107  Segment const& seg = segmentation[Time::ANYTIME]; // thus accessed time point is irrelevant
108 
109  // verify mapped JobTicket is assembled according to above spec...
110  auto getMarker = [](JobTicket& ticket)
111  {
112  Job job = ticket.createJobFor(Time::ANYTIME);
113  return job.parameter.invoKey.part.a;
114  };
115 
116  JobTicket& ticket = seg.jobTicket(0);
117  CHECK (13 == getMarker (ticket));
118  auto prereq = ticket.getPrerequisites();
119  CHECK (not isnil(prereq));
120  CHECK (55 == getMarker (*prereq)); // Note: order of prerequisites is flipped (by LinkedElements)
121  ++prereq;
122  CHECK (23 == getMarker (*prereq));
123  ++prereq;
124  CHECK (isnil(prereq));
125  }
126  };
127 
128 
130  LAUNCHER (FixtureSegment_test, "unit fixture");
131 
132 
133 
134 }}} // namespace steam::fixture::test
static const Time ANYTIME
border condition marker value. ANYTIME <= any time value
Definition: timevalue.hpp:322
Mock data structures to support implementation testing of render job planning and frame dispatch...
Definition: run.hpp:49
Effective top-level exit point to pull rendered data from the nodes network.
Steam-Layer implementation namespace root.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
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.
Link from the Fixture datastructure into the render node network.
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
Definition: segment.hpp:68
static const Time NEVER
border condition marker value. NEVER >= any time value
Definition: timevalue.hpp:323
Individual frame rendering task, forwarding to a closure.
Definition: job.h:277
auto getPrerequisites()
Core operation: iterate over the prerequisites, required to carry out a render operation based on thi...
Definition: job-ticket.hpp:164
execution plan for pulling a specific exit node.
Definition: job-ticket.hpp:87
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.
Definition: util.hpp:372