Lumiera  0.pre.03
»edit your freedom«
node-link-test.cpp
Go to the documentation of this file.
1 /*
2  NodeLink(Test) - render node connectivity and collaboration
3 
4  Copyright (C)
5  2024, 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"
24 #include "lib/util.hpp"
25 
26 
27 using util::isnil;
28 //using std::string;
29 using util::isSameObject;
30 
31 
32 namespace steam {
33 namespace engine{
34 namespace test {
35 
36 
37 
38 
39  /***************************************************************/
47  class NodeLink_test : public Test
48  {
49  virtual void
50  run (Arg)
51  {
52  seedRand();
53 
57  }
58 
59 
60 
61 
65  void
67  {
68  auto con = prepareNode("Test:Src")
69  .preparePort()
70  .invoke(DUMMY_FUN_ID, dummyOp)
71  .completePort()
72  .build();
73  CHECK (isnil (con.leads));
74  CHECK (1 == con.ports.size());
75 
76  // can build a ProcNode with this connectivity
77  ProcNode n1{move(con)};
78  CHECK (watch(n1).isValid());
79  CHECK (watch(n1).leads().empty());
80  CHECK (watch(n1).ports().size() == 1);
81 
82  // can generate a symbolic spec to describe the Port's processing functionality...
83  CHECK (watch(n1).getPortSpec(0) == "Test:Src.dummyFun(TestFrame)"_expect);
84  CHECK (watch(n1).getPortSpec(1) == "↯"_expect);
85 
86  // such a symbolic spec is actually generated by a deduplicated metadata descriptor
87  auto& meta1 = ProcID::describe("N1","(arg)");
88  auto& meta1b = ProcID::describe("N1","(arg)");
89  auto& meta2 = ProcID::describe("N2","(arg)");
90  auto& meta3 = ProcID::describe("N1","uga()");
91  CHECK ( isSameObject (meta1,meta1b));
92  CHECK (not isSameObject (meta1,meta2));
93  CHECK (not isSameObject (meta1,meta3));
94  CHECK (hash_value(meta1) == hash_value(meta1b));
95  CHECK (hash_value(meta1) != hash_value(meta2));
96  CHECK (hash_value(meta1) != hash_value(meta3));
97 
98  CHECK (meta1.genProcSpec() == "N1(arg)"_expect);
99  CHECK (meta2.genProcSpec() == "N2(arg)"_expect);
100  CHECK (meta3.genProcSpec() == "N1.uga()"_expect);
101 
102  // re-generate the descriptor for the source node (n1)
103  auto& metaN1 = ProcID::describe("Test:Src",DUMMY_FUN_ID);
104  CHECK (metaN1.genProcSpec() == "Test:Src.dummyFun(TestFrame)"_expect);
105 SHOW_EXPR(metaN1.genProcName())
106  CHECK (metaN1.genProcName() == "Test:Src.dummyFun"_expect);
107 SHOW_EXPR(metaN1.genNodeName())
108  CHECK (metaN1.genNodeName() == "Test:Src"_expect);
109 SHOW_EXPR(metaN1.genNodeSpec(con.leads))
110  CHECK (metaN1.genNodeSpec(con.leads) == "Test:Src-◎"_expect);
111  }
112 
113 
117  void
119  {
120  UNIMPLEMENTED ("use existing node connectivity to generate a TurnoutSystem");
121  }
122 
123 
127  void
129  {
130  UNIMPLEMENTED ("operate some render nodes as linked together");
131  }
132  };
133 
134 
136  LAUNCHER (NodeLink_test, "unit node");
137 
138 
139 
140 }}} // namespace steam::engine::test
Definition: run.hpp:40
Specialised shorthand notation for building the Render Node network.
A faked »media calculation« environment to validate the render node network.
Helpers typically used while writing tests.
Steam-Layer implementation namespace root.
static ProcID & describe(StrView nodeSymb, StrView portSpec)
build and register a processing ID descriptor
Definition: proc-node.cpp:69
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Interface to the processing nodes and the render nodes network.
auto prepareNode(StrView nodeSymbol)
Entrance point for building actual Render Node Connectivity (Level-2)
void dummyOp(NoArg in, SoloArg out)
Key abstraction of the Render Engine: A Data processing Node.
Definition: proc-node.hpp:154
HashVal hash_value(ProcID const &procID)
generate registry hash value based on the distinct data in ProcID.
Definition: proc-node.cpp:105
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