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) 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 
46 
47  /*****************************************************************************/
57  class NodeGraphAttachment_test : public Test
58  {
59 
60  virtual void
61  run (Arg)
62  {
65  }
66 
67 
76  void
78  {
79  CHECK (0 == ExitNode::NIL.getPipelineIdentity());
80  CHECK (isnil (ExitNode::NIL.getPrerequisites()));
81 
82  ExitNodes subDead;
83  subDead.emplace_back(55);
84  CHECK (55 == subDead[0].getPipelineIdentity());
85  CHECK (isnil (subDead[0].getPrerequisites()));
86 
87  ExitNodes superDead;
88  superDead.emplace_back(23, move (subDead));
89  superDead.emplace_front(13);
90  CHECK (13 == superDead[0].getPipelineIdentity());
91  CHECK (23 == superDead[1].getPipelineIdentity());
92  CHECK (not isnil (superDead[1].getPrerequisites()));
93  CHECK (55 == superDead[1].getPrerequisites()->getPipelineIdentity());
94 
95  NodeGraphAttachment succubus{move (superDead)};
96  CHECK (13 == succubus[0].getPipelineIdentity());
97  CHECK (23 == succubus[1].getPipelineIdentity());
98  CHECK (55 == succubus[1].getPrerequisites()->getPipelineIdentity());
99 
100  CHECK (isSameObject (succubus[5], ExitNode::NIL)); // out-of-index access falls back to ExitNode::NIL
101  }
102 
103 
108  void
110  {
111  using lib::diff::MakeRec;
112 
114  ExitNode node =
115  builder.buildExitNodeFromSpec(MakeRec()
116  .attrib("mark", 13) // top-level: marked with hash/id = 13
117  .scope(MakeRec() // ... defines two nested prerequisites
118  .attrib("mark",23) // + Prerequisite-1 hash/id = 23
119  .genNode()
120  ,MakeRec()
121  .attrib("mark",55) // + Prerequisite-2 hash/id = 55
122  .genNode()
123  )
124  .genNode());
125 
126  // verify generated Node is assembled according to above spec...
127  CHECK (13 == node.getPipelineIdentity());
128  auto feed = node.getPrerequisites();
129  CHECK (not isnil (feed));
130  CHECK (23 == feed->getPipelineIdentity());
131  ++feed;
132  CHECK (55 == feed->getPipelineIdentity());
133  ++feed;
134  CHECK (isnil (feed));
135  }
136  };
137 
138 
140  LAUNCHER (NodeGraphAttachment_test, "unit fixture");
141 
142 
143 
144 }}} // namespace steam::fixture::test
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.
A top-level point in the render node network where data generation can be driven. ...
Definition: exit-node.hpp:72
Simple 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:103
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.
Definition: util.hpp:372