2007-09-03 02:33:47 +02:00
|
|
|
|
/*
|
2024-12-06 23:43:18 +01:00
|
|
|
|
NodeMeta(Test) - verify render node data feeds
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
Copyright (C)
|
2024-12-06 23:43:18 +01:00
|
|
|
|
2024, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
**Lumiera** is free software; you can redistribute it and/or modify it
|
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
|
Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
|
option) any later version. See the file COPYING for further details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
* *****************************************************************/
|
2007-09-03 02:33:47 +02:00
|
|
|
|
|
2024-12-06 23:43:18 +01:00
|
|
|
|
/** @file node-meta-test.cpp
|
|
|
|
|
|
** Naming and hash-key identification of render nodes is covered by \ref NodeMeta_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"
|
2025-01-11 17:05:53 +01:00
|
|
|
|
#include "steam/engine/proc-node.hpp"
|
|
|
|
|
|
#include "steam/engine/node-builder.hpp"
|
2025-01-31 19:29:04 +01:00
|
|
|
|
#include "lib/format-util.hpp"
|
2025-01-11 17:05:53 +01:00
|
|
|
|
//#include "steam/engine/test-rand-ontology.hpp" ///////////TODO
|
|
|
|
|
|
#include "lib/test/diagnostic-output.hpp"/////////////////TODO
|
2008-12-18 04:47:41 +01:00
|
|
|
|
//#include "lib/util.hpp"
|
2007-09-03 02:33:47 +02:00
|
|
|
|
|
2025-01-11 17:05:53 +01:00
|
|
|
|
#include <cmath>
|
2007-09-03 02:33:47 +02:00
|
|
|
|
|
2016-01-07 03:58:29 +01:00
|
|
|
|
//using std::string;
|
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 {
|
|
|
|
|
|
|
2025-01-31 19:29:04 +01:00
|
|
|
|
using std::abs;
|
|
|
|
|
|
using util::join;
|
2009-08-31 00:49:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:06:36 +02:00
|
|
|
|
/***************************************************************//**
|
2024-12-06 23:43:18 +01:00
|
|
|
|
* @test Render node metadata and hash identity keys.
|
2009-08-31 00:49:08 +02:00
|
|
|
|
*/
|
2024-12-06 23:43:18 +01:00
|
|
|
|
class NodeMeta_test : public Test
|
2007-09-03 02:33:47 +02:00
|
|
|
|
{
|
2025-01-11 17:05:53 +01:00
|
|
|
|
virtual void
|
|
|
|
|
|
run (Arg)
|
2009-08-31 00:49:08 +02:00
|
|
|
|
{
|
2025-01-11 17:05:53 +01:00
|
|
|
|
verify_ID_specification();
|
|
|
|
|
|
verify_ID_properties();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO evaluation of processing-spec for a ProcID
|
2025-01-11 22:17:07 +01:00
|
|
|
|
* @todo WIP 1/25 🔁 define ⟶ 🔁 implement
|
2025-01-11 17:05:53 +01:00
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
verify_ID_specification()
|
|
|
|
|
|
{
|
|
|
|
|
|
auto& p1 = ProcID::describe("N1","(arg)");
|
2025-01-11 22:17:07 +01:00
|
|
|
|
auto& p2 = ProcID::describe("U:N2","+(a1,a2)");
|
|
|
|
|
|
auto& p3 = ProcID::describe("O:N3","(in/3)(o1,o2/2)");
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (p1.genNodeName() == "N1"_expect );
|
|
|
|
|
|
CHECK (p1.genNodeSymbol() == "N1"_expect );
|
|
|
|
|
|
CHECK (p1.genNodeDomain() == ""_expect );
|
|
|
|
|
|
CHECK (p2.genNodeName() == "U:N2"_expect );
|
|
|
|
|
|
CHECK (p2.genNodeSymbol() == "N2"_expect );
|
|
|
|
|
|
CHECK (p2.genNodeDomain() == "U"_expect );
|
|
|
|
|
|
CHECK (p3.genNodeName() == "O:N3"_expect );
|
|
|
|
|
|
CHECK (p3.genNodeSymbol() == "N3"_expect );
|
|
|
|
|
|
CHECK (p3.genNodeDomain() == "O"_expect );
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (p1.genProcName() == "N1"_expect );
|
|
|
|
|
|
CHECK (p1.genQualifier() == ""_expect );
|
|
|
|
|
|
CHECK (p2.genProcName() == "N2.+"_expect ); // domain omitted, qualifier joined with '.'
|
|
|
|
|
|
CHECK (p2.genQualifier() == ".+"_expect ); // qualifier includes leading '.'
|
|
|
|
|
|
CHECK (p3.genProcName() == "N3"_expect );
|
|
|
|
|
|
CHECK (p2.genProcSpec() == "U:N2.+(a1,a2)"_expect );
|
|
|
|
|
|
CHECK (p3.genProcSpec() == "O:N3(in/3)(o1,o2/2)"_expect );
|
2025-01-31 19:29:04 +01:00
|
|
|
|
|
|
|
|
|
|
ProcID::ArgModel arg1 = p1.genArgModel();
|
|
|
|
|
|
ProcID::ArgModel arg2 = p2.genArgModel();
|
|
|
|
|
|
ProcID::ArgModel arg3 = p3.genArgModel();
|
|
|
|
|
|
SHOW_EXPR(join (arg1.iArg))
|
2025-01-11 17:05:53 +01:00
|
|
|
|
UNIMPLEMENTED ("parse and evaluate");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO aspects of node definition relevant for the ProcID
|
|
|
|
|
|
* @todo WIP 1/25 🔁 define ⟶ implement
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
verify_ID_properties()
|
|
|
|
|
|
{
|
|
|
|
|
|
// This operation emulates a data source
|
|
|
|
|
|
auto src_opA = [](int param, int* res) { *res = param; };
|
|
|
|
|
|
auto src_opB = [](ulong param, ulong* res){ *res = param; };
|
|
|
|
|
|
|
|
|
|
|
|
// A Node with two (source) ports
|
|
|
|
|
|
ProcNode nA{prepareNode("srcA")
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("a(int)", src_opA)
|
|
|
|
|
|
.setParam(5)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("b(int)", src_opA)
|
|
|
|
|
|
.setParam(23)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.build()};
|
|
|
|
|
|
|
|
|
|
|
|
// A different Node with three ports
|
|
|
|
|
|
ProcNode nB{prepareNode("srcB")
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("a(ulong)", src_opB)
|
|
|
|
|
|
.setParam(7)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("b(ulong)", src_opB)
|
|
|
|
|
|
.setParam(13)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("c(ulong)", src_opB)
|
|
|
|
|
|
.setParam(17)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.build()};
|
|
|
|
|
|
|
|
|
|
|
|
// This operation emulates fading of two source chains
|
|
|
|
|
|
auto fade_op = [](double mix, tuple<int*,ulong*> src, uint64_t* res)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto [srcA,srcB] = src;
|
|
|
|
|
|
*res = uint64_t(abs(*srcA * mix + (1-mix) * int64_t(*srcB)));
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Wiring for the Mix, building up three ports
|
|
|
|
|
|
// Since the first source-chain has only two ports,
|
|
|
|
|
|
// for the third result port we'll re-use the second source
|
|
|
|
|
|
ProcNode nM{prepareNode("fade")
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("A_mix(int,ulong)(uint64_t)", fade_op)
|
|
|
|
|
|
.connectLead(nA)
|
|
|
|
|
|
.connectLead(nB)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("B_mix(int,ulong)(uint64_t)", fade_op)
|
|
|
|
|
|
.connectLead(nA)
|
|
|
|
|
|
.connectLead(nB)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("C_mix(int,ulong)(uint64_t)", fade_op)
|
|
|
|
|
|
.connectLeadPort(nA,1)
|
|
|
|
|
|
.connectLead(nB)
|
|
|
|
|
|
.setParam(0.5)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.build()};
|
|
|
|
|
|
UNIMPLEMENTED ("verify connectivity");
|
|
|
|
|
|
}
|
2009-08-31 00:49:08 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register this test class... */
|
2024-12-06 23:43:18 +01:00
|
|
|
|
LAUNCHER (NodeMeta_test, "unit node");
|
2009-08-31 00:49:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
}}} // namespace steam::engine::test
|