Lumiera  0.pre.03
»edit your freedom«
node-graph-attachment-test.cpp
Go to the documentation of this file.
1 /*
2  NodeGraphAttachment(Test) - verify link from fixture to low-level-model
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 
37 
38  /*****************************************************************************/
48  class NodeGraphAttachment_test : public Test
49  {
50 
51  virtual void
52  run (Arg)
53  {
54  seedRand();
57  }
58 
59 
68  void
70  {
71  CHECK (0 == ExitNode::NIL.getPipelineIdentity());
72  CHECK (isnil (ExitNode::NIL.getPrerequisites()));
73 
74  ExitNodes subDead;
75  subDead.emplace_back(55);
76  CHECK (55 == subDead[0].getPipelineIdentity());
77  CHECK (isnil (subDead[0].getPrerequisites()));
78 
79  ExitNodes superDead;
80  superDead.emplace_back(23, move (subDead));
81  superDead.emplace_front(13);
82  CHECK (13 == superDead[0].getPipelineIdentity());
83  CHECK (23 == superDead[1].getPipelineIdentity());
84  CHECK (not isnil (superDead[1].getPrerequisites()));
85  CHECK (55 == superDead[1].getPrerequisites()->getPipelineIdentity());
86 
87  NodeGraphAttachment succubus{move (superDead)};
88  CHECK (13 == succubus[0].getPipelineIdentity());
89  CHECK (23 == succubus[1].getPipelineIdentity());
90  CHECK (55 == succubus[1].getPrerequisites()->getPipelineIdentity());
91 
92  CHECK (isSameObject (succubus[5], ExitNode::NIL)); // out-of-index access falls back to ExitNode::NIL
93  }
94 
95 
100  void
102  {
103  using lib::diff::MakeRec;
104 
106  ExitNode node =
107  builder.buildExitNodeFromSpec(MakeRec()
108  .attrib("mark", 13) // top-level: marked with hash/id = 13
109  .scope(MakeRec() // ... defines two nested prerequisites
110  .attrib("mark",23) // + Prerequisite-1 hash/id = 23
111  .genNode()
112  ,MakeRec()
113  .attrib("mark",55) // + Prerequisite-2 hash/id = 55
114  .genNode()
115  )
116  .genNode());
117 
118  // verify generated Node is assembled according to above spec...
119  CHECK (13 == node.getPipelineIdentity());
120  auto feed = node.getPrerequisites();
121  CHECK (not isnil (feed));
122  CHECK (23 == feed->getPipelineIdentity());
123  ++feed;
124  CHECK (55 == feed->getPipelineIdentity());
125  ++feed;
126  CHECK (isnil (feed));
127  }
128  };
129 
130 
132  LAUNCHER (NodeGraphAttachment_test, "unit fixture");
133 
134 
135 
136 }}} // namespace steam::fixture::test
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.
A top-level point in the render node network where data generation can be driven. ...
Definition: exit-node.hpp:63
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Binding and access point from a given Segment to access the actual render nodes.
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.
static ExitNode NIL
storage for the »inactive« ExitNode marker
Definition: exit-node.hpp:94
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