2007-09-03 02:33:47 +02:00
|
|
|
|
/*
|
2024-11-06 02:13:23 +01:00
|
|
|
|
NodeDevel(Test) - Render Node development and test support
|
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, 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-04-22 23:13:55 +02:00
|
|
|
|
/** @file node-devel-test.cpp
|
2024-12-06 23:43:18 +01:00
|
|
|
|
** Unit test \ref NodeDevel_test verifies helpers for testing of render nodes.
|
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-11-20 21:44:50 +01:00
|
|
|
|
#include "lib/hash-combine.hpp"
|
2024-11-28 23:41:56 +01:00
|
|
|
|
#include "lib/test/test-helper.hpp"
|
2025-01-06 19:47:51 +01:00
|
|
|
|
#include "steam/engine/node-builder.hpp"
|
|
|
|
|
|
#include "steam/engine/test-rand-ontology.hpp"
|
|
|
|
|
|
#include "steam/engine/diagnostic-buffer-provider.hpp"
|
2024-11-06 02:13:23 +01:00
|
|
|
|
#include "lib/test/diagnostic-output.hpp"/////////////////TODO
|
2024-11-27 15:31:50 +01:00
|
|
|
|
#include "lib/iter-zip.hpp"
|
2024-11-06 02:13:23 +01:00
|
|
|
|
#include "lib/random.hpp"
|
2008-12-18 04:47:41 +01:00
|
|
|
|
//#include "lib/util.hpp"
|
2007-09-03 02:33:47 +02:00
|
|
|
|
|
2024-11-28 02:15:59 +01:00
|
|
|
|
#include <vector>
|
2007-09-03 02:33:47 +02:00
|
|
|
|
|
2024-11-27 15:31:50 +01:00
|
|
|
|
using lib::zip;
|
2024-11-28 02:15:59 +01:00
|
|
|
|
using lib::izip;
|
|
|
|
|
|
using std::vector;
|
2025-01-06 19:47:51 +01:00
|
|
|
|
using std::make_tuple;
|
|
|
|
|
|
using lib::test::showType;
|
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 {
|
|
|
|
|
|
|
2024-11-06 02:13:23 +01:00
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
/** uninitialised local storage that can be passed
|
|
|
|
|
|
* as working buffer and accessed as TestFrame */
|
|
|
|
|
|
struct Buffer
|
|
|
|
|
|
: util::NonCopyable
|
|
|
|
|
|
{
|
|
|
|
|
|
alignas(TestFrame)
|
|
|
|
|
|
std::byte storage[sizeof(TestFrame)];
|
|
|
|
|
|
|
2024-11-20 21:44:50 +01:00
|
|
|
|
operator TestFrame* () { return std::launder (reinterpret_cast<TestFrame* > (&storage)); }
|
|
|
|
|
|
TestFrame* operator->() { return std::launder (reinterpret_cast<TestFrame* > (&storage)); }
|
|
|
|
|
|
TestFrame& operator* () { return * std::launder (reinterpret_cast<TestFrame* > (&storage)); }
|
|
|
|
|
|
|
|
|
|
|
|
TestFrame&
|
|
|
|
|
|
buildData (uint seq=0, uint family=0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return * new(&storage) TestFrame{seq,family};
|
|
|
|
|
|
}
|
2024-11-06 02:13:23 +01:00
|
|
|
|
};
|
|
|
|
|
|
}
|
2009-08-31 00:49:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:06:36 +02:00
|
|
|
|
/***************************************************************//**
|
2024-11-06 02:13:23 +01:00
|
|
|
|
* @test verify support for developing Render Node functionality.
|
2009-08-31 00:49:08 +02:00
|
|
|
|
*/
|
2024-04-22 23:13:55 +02:00
|
|
|
|
class NodeDevel_test : public Test
|
2007-09-03 02:33:47 +02:00
|
|
|
|
{
|
2024-11-06 02:13:23 +01:00
|
|
|
|
virtual void
|
|
|
|
|
|
run (Arg)
|
|
|
|
|
|
{
|
2024-11-12 22:35:54 +01:00
|
|
|
|
seedRand();
|
2024-11-20 21:44:50 +01:00
|
|
|
|
TestFrame::reseed();
|
2024-11-06 02:13:23 +01:00
|
|
|
|
|
|
|
|
|
|
processing_generateFrame();
|
|
|
|
|
|
processing_generateMultichan();
|
2024-11-28 02:15:59 +01:00
|
|
|
|
processing_duplicateMultichan();
|
|
|
|
|
|
processing_manipulateMultichan();
|
2024-11-20 21:44:50 +01:00
|
|
|
|
processing_manipulateFrame();
|
2024-11-27 15:31:50 +01:00
|
|
|
|
processing_combineFrames();
|
2024-11-28 23:41:56 +01:00
|
|
|
|
|
|
|
|
|
|
testRand_simpleUsage();
|
2025-02-09 18:04:39 +01:00
|
|
|
|
testRand_buildFilterNode();
|
|
|
|
|
|
testRand_buildMixNode();
|
2024-11-06 02:13:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test function to generate random test data frames
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
processing_generateFrame()
|
|
|
|
|
|
{
|
2024-11-12 22:35:54 +01:00
|
|
|
|
size_t frameNr = defaultGen.u64();
|
|
|
|
|
|
uint flavour = defaultGen.u64();
|
2024-11-06 02:13:23 +01:00
|
|
|
|
|
|
|
|
|
|
Buffer buff;
|
|
|
|
|
|
CHECK (not buff->isSane());
|
|
|
|
|
|
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::generateFrame (buff, frameNr, flavour);
|
2024-11-06 02:13:23 +01:00
|
|
|
|
CHECK ( buff->isSane());
|
2024-11-28 02:15:59 +01:00
|
|
|
|
CHECK ( buff->isPristine());
|
2024-11-06 02:13:23 +01:00
|
|
|
|
CHECK (*buff == TestFrame(frameNr,flavour));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @test function to generate an array of random test data frames
|
|
|
|
|
|
* for consecutive channels
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
processing_generateMultichan()
|
2009-08-31 00:49:08 +02:00
|
|
|
|
{
|
2024-11-12 22:35:54 +01:00
|
|
|
|
size_t frameNr = defaultGen.u64();
|
|
|
|
|
|
uint flavour = defaultGen.u64();
|
2024-11-06 02:13:23 +01:00
|
|
|
|
|
2024-11-12 22:35:54 +01:00
|
|
|
|
uint channels = 1 + rani(50);
|
2024-11-06 02:13:23 +01:00
|
|
|
|
CHECK (1 <= channels and channels <= 50);
|
|
|
|
|
|
|
2024-11-28 02:15:59 +01:00
|
|
|
|
Buffer buff[50];
|
2024-11-06 02:13:23 +01:00
|
|
|
|
for (uint i=0; i<channels; ++i)
|
2024-11-28 02:15:59 +01:00
|
|
|
|
CHECK (not buff[i]->isSane());
|
2024-11-06 02:13:23 +01:00
|
|
|
|
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::generateMultichan (buff[0], channels, frameNr, flavour);
|
2024-11-06 02:13:23 +01:00
|
|
|
|
for (uint i=0; i<channels; ++i)
|
|
|
|
|
|
{
|
2024-11-28 02:15:59 +01:00
|
|
|
|
CHECK (buff[i]->isPristine());
|
|
|
|
|
|
CHECK (*(buff[i]) == TestFrame(frameNr,flavour+i));
|
2024-11-06 02:13:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-20 21:44:50 +01:00
|
|
|
|
|
2024-11-28 02:15:59 +01:00
|
|
|
|
|
|
|
|
|
|
/** @test clone copy of multichannel test data */
|
|
|
|
|
|
void
|
|
|
|
|
|
processing_duplicateMultichan()
|
|
|
|
|
|
{
|
|
|
|
|
|
size_t frameNr = defaultGen.u64();
|
|
|
|
|
|
uint flavour = defaultGen.u64();
|
|
|
|
|
|
uint channels = 1 + rani(50);
|
|
|
|
|
|
Buffer srcBuff[50];
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::generateMultichan (srcBuff[0], channels, frameNr, flavour);
|
2024-11-28 02:15:59 +01:00
|
|
|
|
|
|
|
|
|
|
Buffer clone[50];
|
|
|
|
|
|
for (uint i=0; i<channels; ++i)
|
|
|
|
|
|
CHECK (not clone[i]->isSane());
|
|
|
|
|
|
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::duplicateMultichan (clone[0],srcBuff[0], channels);
|
2024-11-28 02:15:59 +01:00
|
|
|
|
for (uint i=0; i<channels; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
CHECK (clone[i]->isPristine());
|
|
|
|
|
|
CHECK (*(clone[i]) == *(srcBuff[i]));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test multichannel data hash-chain manipulation
|
|
|
|
|
|
* - use multichannel pseudo random input data
|
|
|
|
|
|
* - store away a clone copy before manipulation
|
|
|
|
|
|
* - the #manipulateMultichan() operates in-place in the buffers
|
|
|
|
|
|
* - each buffer has been marked with a new checksum afterwards
|
|
|
|
|
|
* - and each buffer now differs from original state
|
|
|
|
|
|
* - verify that corresponding data points over all channels
|
|
|
|
|
|
* have been linked by a hashcode-chain, seeded with the `param`
|
|
|
|
|
|
* and then consecutively hashing in data from each channel.
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
processing_manipulateMultichan()
|
|
|
|
|
|
{
|
|
|
|
|
|
size_t frameNr = defaultGen.u64();
|
|
|
|
|
|
uint flavour = defaultGen.u64();
|
|
|
|
|
|
uint channels = 1 + rani(50);
|
|
|
|
|
|
Buffer buff[50], refData[50];
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::generateMultichan (buff[0], channels, frameNr, flavour);
|
2024-11-28 02:15:59 +01:00
|
|
|
|
// stash away a copy of the test data for verification
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::duplicateMultichan(refData[0],buff[0], channels);
|
2024-11-28 02:15:59 +01:00
|
|
|
|
|
|
|
|
|
|
for (uint c=0; c<channels; ++c)
|
|
|
|
|
|
CHECK (buff[c]->isPristine());
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t param = defaultGen.u64();
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::manipulateMultichan(buff[0], channels, param);
|
2024-11-28 02:15:59 +01:00
|
|
|
|
|
|
|
|
|
|
const uint SIZ = buff[0]->data64().size();
|
|
|
|
|
|
vector<uint64_t> xlink(SIZ, param); // temporary storage for verifying the hash-chain
|
|
|
|
|
|
for (uint c=0; c<channels; ++c)
|
|
|
|
|
|
{
|
|
|
|
|
|
CHECK (buff[c]->isSane()); // checksum matches
|
|
|
|
|
|
CHECK (not buff[c]->isPristine()); // data was indeed changed
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (*(buff[c]) != *(refData[c]));
|
|
|
|
|
|
|
|
|
|
|
|
for (auto& [i, link] : izip(xlink))
|
|
|
|
|
|
{
|
|
|
|
|
|
auto const& refPoint = refData[c]->data64()[i];
|
|
|
|
|
|
lib::hash::combine (link, refPoint);
|
|
|
|
|
|
CHECK (link != refPoint);
|
|
|
|
|
|
CHECK (link == buff[c]->data64()[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @test function to apply a numeric computation to test data frames;
|
|
|
|
|
|
* @remark here basically the same hash-chaining is used as for #manipulateMultichan,
|
|
|
|
|
|
* but only one hash-chain per data point is used and output is written to a different buffer.
|
2024-11-20 21:44:50 +01:00
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
processing_manipulateFrame()
|
|
|
|
|
|
{
|
|
|
|
|
|
size_t frameNr = defaultGen.u64();
|
|
|
|
|
|
uint flavour = defaultGen.u64();
|
|
|
|
|
|
|
|
|
|
|
|
Buffer iBuff, oBuff;
|
|
|
|
|
|
iBuff.buildData(frameNr,flavour);
|
|
|
|
|
|
oBuff.buildData(frameNr,flavour);
|
|
|
|
|
|
CHECK (iBuff->isPristine());
|
2024-11-27 15:31:50 +01:00
|
|
|
|
CHECK (oBuff->isPristine());
|
2024-11-20 21:44:50 +01:00
|
|
|
|
|
|
|
|
|
|
uint64_t param = defaultGen.u64();
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::manipulateFrame (oBuff, iBuff, param);
|
2024-11-20 21:44:50 +01:00
|
|
|
|
CHECK ( oBuff->isValid());
|
|
|
|
|
|
CHECK (not oBuff->isPristine());
|
|
|
|
|
|
CHECK ( iBuff->isPristine());
|
|
|
|
|
|
|
2024-11-27 15:31:50 +01:00
|
|
|
|
for (auto [iDat,oDat] : zip (iBuff->data64()
|
|
|
|
|
|
,oBuff->data64()))
|
2024-11-20 21:44:50 +01:00
|
|
|
|
{
|
2024-11-27 15:31:50 +01:00
|
|
|
|
CHECK (oDat != iDat);
|
2024-11-20 21:44:50 +01:00
|
|
|
|
uint64_t feed = param;
|
2024-11-27 15:31:50 +01:00
|
|
|
|
lib::hash::combine (feed, iDat);
|
|
|
|
|
|
CHECK (feed != param);
|
|
|
|
|
|
CHECK (feed != iDat);
|
|
|
|
|
|
CHECK (feed == oDat);
|
2024-11-20 21:44:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
// can also process in-place
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::manipulateFrame (iBuff, iBuff, param);
|
2024-11-20 21:44:50 +01:00
|
|
|
|
CHECK (not iBuff->isPristine());
|
|
|
|
|
|
CHECK ( iBuff->isValid());
|
|
|
|
|
|
CHECK (*iBuff == *oBuff); // second invocation exactly reproduced data from first invocation
|
|
|
|
|
|
}
|
2024-11-27 15:31:50 +01:00
|
|
|
|
|
|
|
|
|
|
/** @test function to mix two test data frames
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
processing_combineFrames()
|
|
|
|
|
|
{
|
|
|
|
|
|
size_t frameNr = defaultGen.u64();
|
|
|
|
|
|
uint flavour = defaultGen.u64();
|
|
|
|
|
|
|
|
|
|
|
|
Buffer i1Buff, i2Buff, oBuff;
|
|
|
|
|
|
i1Buff.buildData(frameNr,flavour+0);
|
|
|
|
|
|
i2Buff.buildData(frameNr,flavour+1);
|
|
|
|
|
|
oBuff.buildData();
|
|
|
|
|
|
CHECK (i1Buff->isPristine());
|
|
|
|
|
|
CHECK (i2Buff->isPristine());
|
|
|
|
|
|
CHECK (oBuff->isPristine());
|
|
|
|
|
|
|
|
|
|
|
|
double mix = defaultGen.uni();
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::combineFrames (oBuff, i1Buff, i2Buff, mix);
|
2024-11-27 15:31:50 +01:00
|
|
|
|
CHECK ( oBuff->isValid());
|
|
|
|
|
|
CHECK (not oBuff->isPristine());
|
|
|
|
|
|
CHECK ( i1Buff->isPristine());
|
|
|
|
|
|
CHECK ( i2Buff->isPristine());
|
|
|
|
|
|
|
|
|
|
|
|
for (auto [oDat,i1Dat,i2Dat] : zip (oBuff->data()
|
|
|
|
|
|
,i1Buff->data()
|
|
|
|
|
|
,i2Buff->data()))
|
|
|
|
|
|
CHECK (oDat == std::lround((1-mix)*i1Dat + mix*i2Dat));
|
|
|
|
|
|
|
|
|
|
|
|
// can also process in-place
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ont::combineFrames (i1Buff, i1Buff, i2Buff, mix);
|
2024-11-27 15:31:50 +01:00
|
|
|
|
CHECK (not i1Buff->isPristine());
|
|
|
|
|
|
CHECK ( i1Buff->isValid());
|
|
|
|
|
|
CHECK (*i1Buff == *oBuff); // second invocation exactly reproduced data from first invocation
|
|
|
|
|
|
}
|
2024-11-28 23:41:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
2024-12-05 23:58:22 +01:00
|
|
|
|
|
2024-11-28 23:41:56 +01:00
|
|
|
|
/** @test demonstrate simple usage of test-render setup
|
|
|
|
|
|
* - access the TestRandOntology as singleton
|
|
|
|
|
|
* - create a Spec record
|
2024-12-05 23:58:22 +01:00
|
|
|
|
* - retrieve a functor bound suitably to invoke
|
|
|
|
|
|
* data processing code from the TestRandOntology
|
2024-11-28 23:41:56 +01:00
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
testRand_simpleUsage()
|
|
|
|
|
|
{
|
|
|
|
|
|
auto spec = testRand().setupGenerator();
|
|
|
|
|
|
CHECK (spec.PROTO == "generate-TestFrame"_expect);
|
2025-01-06 22:00:29 +01:00
|
|
|
|
|
|
|
|
|
|
// generate a binding as processing-functor
|
2025-01-06 19:47:51 +01:00
|
|
|
|
auto procFun = spec.makeFun();
|
|
|
|
|
|
using Sig = lib::meta::_Fun<decltype(procFun)>::Sig;
|
|
|
|
|
|
CHECK (showType<Sig>() == "void (tuple<ulong, uint>, engine::test::TestFrame*)"_expect);
|
|
|
|
|
|
|
2025-01-06 22:00:29 +01:00
|
|
|
|
// Behaves identical to processing_generateFrame() — see above...
|
2025-01-06 19:47:51 +01:00
|
|
|
|
size_t frameNr = defaultGen.u64();
|
|
|
|
|
|
uint flavour = defaultGen.u64();
|
|
|
|
|
|
|
|
|
|
|
|
Buffer buff;
|
|
|
|
|
|
CHECK (not buff->isSane());
|
|
|
|
|
|
|
|
|
|
|
|
procFun (make_tuple (frameNr,flavour), buff);
|
|
|
|
|
|
CHECK ( buff->isSane());
|
|
|
|
|
|
CHECK ( buff->isPristine());
|
|
|
|
|
|
CHECK (*buff == TestFrame(frameNr,flavour));
|
|
|
|
|
|
|
2025-02-09 18:04:39 +01:00
|
|
|
|
// Build a node using this processing-functor...
|
2025-01-06 22:00:29 +01:00
|
|
|
|
ProcNode node{prepareNode(spec.nodeID())
|
2025-01-06 19:47:51 +01:00
|
|
|
|
.preparePort()
|
2025-01-06 22:00:29 +01:00
|
|
|
|
.invoke(spec.procID(), procFun)
|
2025-01-06 19:47:51 +01:00
|
|
|
|
.setParam(frameNr,flavour)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.build()};
|
|
|
|
|
|
|
2025-02-09 18:04:39 +01:00
|
|
|
|
CHECK (watch(node).isSrc());
|
|
|
|
|
|
CHECK (watch(node).getNodeSpec() == "Test:generate-◎"_expect);
|
|
|
|
|
|
CHECK (watch(node).getPortSpec(0) == "generate(TestFrame)"_expect);
|
2025-01-06 19:47:51 +01:00
|
|
|
|
|
|
|
|
|
|
BufferProvider& provider = DiagnosticBufferProvider::build();
|
|
|
|
|
|
BuffHandle buffHandle = provider.lockBuffer (provider.getDescriptorFor(sizeof(TestFrame)));
|
|
|
|
|
|
|
|
|
|
|
|
uint port{0};
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (not buffHandle.accessAs<TestFrame>().isSane());
|
|
|
|
|
|
|
|
|
|
|
|
// Trigger Node invocation...
|
|
|
|
|
|
buffHandle = node.pull (port, buffHandle, Time::ZERO, ProcessKey{0});
|
|
|
|
|
|
|
|
|
|
|
|
TestFrame& result = buffHandle.accessAs<TestFrame>();
|
|
|
|
|
|
CHECK (result.isSane());
|
|
|
|
|
|
CHECK (result.isPristine());
|
|
|
|
|
|
CHECK (result == *buff);
|
|
|
|
|
|
buffHandle.release();
|
2024-11-28 23:41:56 +01:00
|
|
|
|
}
|
2025-02-09 18:04:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test use the »TestRand«-framework to setup a filter node
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
testRand_buildFilterNode()
|
|
|
|
|
|
{
|
|
|
|
|
|
auto spec = testRand().setupManipulator();
|
|
|
|
|
|
CHECK (spec.PROTO == "manipulate-TestFrame"_expect);
|
|
|
|
|
|
|
|
|
|
|
|
// generate a binding as processing-functor
|
|
|
|
|
|
auto procFun = spec.makeFun();
|
|
|
|
|
|
using Sig = lib::meta::_Fun<decltype(procFun)>::Sig;
|
|
|
|
|
|
CHECK (showType<Sig>() == "void (ulong, engine::test::TestFrame const*, engine::test::TestFrame*)"_expect);
|
|
|
|
|
|
|
|
|
|
|
|
// Results can be verified by ont::manipulateFrame() — see above
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test use the »TestRand«-framework to setup a two-chain mixer node
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
testRand_buildMixNode()
|
|
|
|
|
|
{
|
|
|
|
|
|
UNIMPLEMENTED ("Mixer Node");
|
|
|
|
|
|
}
|
2009-08-31 00:49:08 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register this test class... */
|
2024-04-22 23:13:55 +02:00
|
|
|
|
LAUNCHER (NodeDevel_test, "unit node");
|
2009-08-31 00:49:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
}}} // namespace steam::engine::test
|