2007-09-03 02:33:47 +02:00
|
|
|
/*
|
2024-04-22 23:13:55 +02:00
|
|
|
NodeLinkage(Test) - verify proper render node operation and calldown
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-03-10 04:25:03 +01:00
|
|
|
Copyright (C) Lumiera.org
|
2009-08-31 00:49:08 +02:00
|
|
|
2009, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-09-03 02:33:47 +02:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
2010-12-17 23:28:49 +01:00
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
2007-09-03 02:33:47 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-09-03 02:33:47 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2007-09-03 02:33:47 +02:00
|
|
|
* *****************************************************/
|
|
|
|
|
|
2024-04-22 23:13:55 +02:00
|
|
|
/** @file node-linkage-test.cpp
|
|
|
|
|
** unit test \ref NodeLinkage_test
|
2016-11-03 18:20:10 +01:00
|
|
|
*/
|
|
|
|
|
|
2007-09-03 02:33:47 +02:00
|
|
|
|
2008-12-18 04:47:41 +01:00
|
|
|
#include "lib/test/run.hpp"
|
2024-06-29 04:23:55 +02:00
|
|
|
#include "steam/engine/proc-node.hpp"
|
2024-07-04 23:54:13 +02:00
|
|
|
#include "steam/engine/node-builder.hpp"
|
2024-07-05 23:36:41 +02:00
|
|
|
#include "steam/engine/test-rand-ontology.hpp" ///////////TODO
|
2024-10-14 04:07:47 +02:00
|
|
|
#include "lib/test/diagnostic-output.hpp"/////////////////TODO
|
|
|
|
|
#include "lib/util.hpp"
|
2007-09-03 02:33:47 +02:00
|
|
|
|
|
|
|
|
|
2024-10-14 04:07:47 +02:00
|
|
|
using util::isnil;
|
2024-04-22 23:13:55 +02:00
|
|
|
//using std::string;
|
2024-11-03 23:58:25 +01:00
|
|
|
using util::isSameObject;
|
2007-09-03 02:33:47 +02:00
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
namespace steam {
|
2009-08-31 00:49:08 +02:00
|
|
|
namespace engine{
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:06:36 +02:00
|
|
|
/***************************************************************//**
|
2024-06-29 04:23:55 +02:00
|
|
|
* @test demonstrate and document how [render nodes](\ref proc-node.hpp)
|
|
|
|
|
* are connected into a processing network, allowing to _invoke_
|
|
|
|
|
* a \ref Port on a node to pull-generate a render result.
|
|
|
|
|
* - the foundation layer is formed by the nodes as linked into a network
|
|
|
|
|
* - starting from any Port, a TurnoutSystem can be established
|
|
|
|
|
* - which in turn allows _turn out_ a render result from this port.
|
2009-08-31 00:49:08 +02:00
|
|
|
*/
|
2024-04-22 23:13:55 +02:00
|
|
|
class NodeLinkage_test : public Test
|
2007-09-03 02:33:47 +02:00
|
|
|
{
|
2024-06-29 04:23:55 +02:00
|
|
|
virtual void
|
|
|
|
|
run (Arg)
|
|
|
|
|
{
|
2024-11-12 22:35:54 +01:00
|
|
|
seedRand();
|
|
|
|
|
|
2024-06-29 04:23:55 +02:00
|
|
|
build_connected_nodes();
|
|
|
|
|
generate_turnout_system();
|
|
|
|
|
trigger_node_port_invocation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO Build render nodes linked into a connectivity network
|
|
|
|
|
* @todo WIP 7/24 🔁 define ⟶ ✔ implement
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
build_connected_nodes()
|
|
|
|
|
{
|
2024-11-03 22:55:06 +01:00
|
|
|
auto con = prepareNode("Test:Src")
|
2024-10-13 03:49:01 +02:00
|
|
|
.preparePort()
|
2024-11-02 23:54:41 +01:00
|
|
|
.invoke(DUMMY_FUN_ID, dummyOp)
|
2024-10-13 03:49:01 +02:00
|
|
|
.completePort()
|
2024-06-29 04:23:55 +02:00
|
|
|
.build();
|
2024-10-14 04:07:47 +02:00
|
|
|
CHECK (isnil (con.leads));
|
|
|
|
|
CHECK (1 == con.ports.size());
|
2024-10-26 23:44:42 +02:00
|
|
|
|
|
|
|
|
// can build a ProcNode with this connectivity
|
|
|
|
|
ProcNode n1{move(con)};
|
|
|
|
|
CHECK (watch(n1).isValid());
|
|
|
|
|
CHECK (watch(n1).leads().empty());
|
|
|
|
|
CHECK (watch(n1).ports().size() == 1);
|
2024-11-04 23:56:16 +01:00
|
|
|
|
2024-11-04 01:04:01 +01:00
|
|
|
// can generate a symbolic spec to describe the Port's processing functionality...
|
2024-11-03 23:58:25 +01:00
|
|
|
CHECK (watch(n1).getPortSpec(0) == "Test:Src.dummyFun(TestFrame)"_expect);
|
|
|
|
|
CHECK (watch(n1).getPortSpec(1) == "↯"_expect);
|
2024-11-04 01:04:01 +01:00
|
|
|
|
|
|
|
|
// such a symbolic spec is actually generated by a deduplicated metadata descriptor
|
|
|
|
|
auto& meta1 = ProcID::describe("N1","(arg)");
|
|
|
|
|
auto& meta1b = ProcID::describe("N1","(arg)");
|
|
|
|
|
auto& meta2 = ProcID::describe("N2","(arg)");
|
|
|
|
|
auto& meta3 = ProcID::describe("N1","uga()");
|
|
|
|
|
CHECK ( isSameObject (meta1,meta1b));
|
|
|
|
|
CHECK (not isSameObject (meta1,meta2));
|
|
|
|
|
CHECK (not isSameObject (meta1,meta3));
|
|
|
|
|
CHECK (hash_value(meta1) == hash_value(meta1b));
|
|
|
|
|
CHECK (hash_value(meta1) != hash_value(meta2));
|
|
|
|
|
CHECK (hash_value(meta1) != hash_value(meta3));
|
|
|
|
|
|
|
|
|
|
CHECK (meta1.genProcSpec() == "N1(arg)"_expect);
|
|
|
|
|
CHECK (meta2.genProcSpec() == "N2(arg)"_expect);
|
|
|
|
|
CHECK (meta3.genProcSpec() == "N1.uga()"_expect);
|
2024-11-04 23:56:16 +01:00
|
|
|
|
|
|
|
|
// re-generate the descriptor for the source node (n1)
|
2024-11-04 01:04:01 +01:00
|
|
|
auto& metaN1 = ProcID::describe("Test:Src",DUMMY_FUN_ID);
|
|
|
|
|
CHECK (metaN1.genProcSpec() == "Test:Src.dummyFun(TestFrame)"_expect);
|
2024-11-04 23:56:16 +01:00
|
|
|
SHOW_EXPR(metaN1.genProcName())
|
|
|
|
|
CHECK (metaN1.genProcName() == "Test:Src.dummyFun"_expect);
|
|
|
|
|
SHOW_EXPR(metaN1.genNodeName())
|
|
|
|
|
CHECK (metaN1.genNodeName() == "Test:Src"_expect);
|
|
|
|
|
SHOW_EXPR(metaN1.genNodeSpec(con.leads))
|
|
|
|
|
CHECK (metaN1.genNodeSpec(con.leads) == "Test:Src-◎"_expect);
|
2024-06-29 04:23:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO Use existing node connectivity to generate a TurnoutSystem
|
|
|
|
|
* @todo WIP 7/24 🔁 define ⟶ implement
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
generate_turnout_system()
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("use existing node connectivity to generate a TurnoutSystem");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO Invoke some render nodes as linked together
|
|
|
|
|
* @todo WIP 7/24 🔁 define ⟶ implement
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
trigger_node_port_invocation()
|
2009-08-31 00:49:08 +02:00
|
|
|
{
|
2024-04-22 23:13:55 +02:00
|
|
|
UNIMPLEMENTED ("operate some render nodes as linked together");
|
2024-06-29 04:23:55 +02:00
|
|
|
}
|
2009-08-31 00:49:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register this test class... */
|
2024-04-22 23:13:55 +02:00
|
|
|
LAUNCHER (NodeLinkage_test, "unit node");
|
2009-08-31 00:49:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
}}} // namespace steam::engine::test
|