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)
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 
28 namespace steam {
29 namespace fixture {
30 namespace test {
31 
32  using std::move;
33  using util::isnil;
34  using util::isSameObject;
35  using engine::ExitNode;
36  using lib::diff::MakeRec;
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
static const Time ANYTIME
border condition marker value. ANYTIME <= any time value
Definition: timevalue.hpp:313
Mock data structures to support implementation testing of render job planning and frame dispatch...
Definition: run.hpp:40
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:299
Simplistic 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:59
static const Time NEVER
border condition marker value. NEVER >= any time value
Definition: timevalue.hpp:314
Individual frame rendering task, forwarding to a closure.
Definition: job.h:268
auto getPrerequisites()
Core operation: iterate over the prerequisites, required to carry out a render operation based on thi...
Definition: job-ticket.hpp:155
execution plan for pulling a specific exit node.
Definition: job-ticket.hpp:78
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee&#39;s memory identities. ...
Definition: util.hpp:421