Invocation: add some test coverage for the basic genrator function
Nothing surprising here... Writing just some dull tests to avoid biting my nails while watching the US election....
This commit is contained in:
parent
c04a465134
commit
7960017403
3 changed files with 90 additions and 13 deletions
|
|
@ -98,7 +98,7 @@ namespace lib {
|
|||
|
||||
/* ===== convenience accessors ===== */
|
||||
|
||||
inline int rani() { return defaultGen.i32(); }
|
||||
inline int rani() { return defaultGen.i32(); } ///< using default params: min ≡ 0, max ≡ numeric_limits
|
||||
inline uint64_t ranu() { return defaultGen.u64(); }
|
||||
inline double runi() { return defaultGen.uni(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
NodeDevel(Test) - verify proper render node operation and calldown
|
||||
NodeDevel(Test) - Render Node development and test support
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2009, Hermann Vosseler <Ichthyostega@web.de>
|
||||
2024, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "steam/engine/test-rand-ontology.hpp" ///////////TODO
|
||||
#include "lib/test/diagnostic-output.hpp"/////////////////TODO
|
||||
#include "lib/random.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
|
||||
|
|
@ -36,18 +39,79 @@ namespace steam {
|
|||
namespace engine{
|
||||
namespace test {
|
||||
|
||||
using lib::ranu;
|
||||
|
||||
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)];
|
||||
|
||||
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)); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************//**
|
||||
* @test check render node operation modes and collaboration.
|
||||
* @test verify support for developing Render Node functionality.
|
||||
*/
|
||||
class NodeDevel_test : public Test
|
||||
{
|
||||
virtual void run(Arg)
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
UNIMPLEMENTED ("operate some render nodes as linked together");
|
||||
}
|
||||
lib::randomiseRandomness(); // inject entropy sees
|
||||
|
||||
processing_generateFrame();
|
||||
processing_generateMultichan();
|
||||
}
|
||||
|
||||
|
||||
/** @test function to generate random test data frames
|
||||
*/
|
||||
void
|
||||
processing_generateFrame()
|
||||
{
|
||||
size_t frameNr = ranu();
|
||||
uint flavour = uint(ranu());
|
||||
|
||||
Buffer buff;
|
||||
CHECK (not buff->isSane());
|
||||
|
||||
generateFrame (buff, frameNr, flavour);
|
||||
CHECK ( buff->isSane());
|
||||
CHECK (*buff == TestFrame(frameNr,flavour));
|
||||
}
|
||||
|
||||
/** @test function to generate an array of random test data frames
|
||||
* for consecutive channels
|
||||
*/
|
||||
void
|
||||
processing_generateMultichan()
|
||||
{
|
||||
size_t frameNr = ranu();
|
||||
uint flavour = uint(ranu());
|
||||
|
||||
uint channels = uint(1 + ranu() % 50);
|
||||
CHECK (1 <= channels and channels <= 50);
|
||||
|
||||
Buffer buffs[50];
|
||||
for (uint i=0; i<channels; ++i)
|
||||
CHECK (not buffs[i]->isSane());
|
||||
|
||||
generateMultichan (channels, buffs[0], frameNr, flavour);
|
||||
for (uint i=0; i<channels; ++i)
|
||||
{
|
||||
CHECK (buffs[i]->isSane());
|
||||
CHECK (*(buffs[i]) == TestFrame(frameNr,flavour+i));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -57023,8 +57023,7 @@
|
|||
also per reinterpret-cast mit std::launder, storage als std::byte mit sauberer Alignment-Angabe
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
<arrowlink COLOR="#5b9aaa" DESTINATION="ID_1432722861" ENDARROW="Default" ENDINCLINATION="63;7;" ID="Arrow_ID_1569718697" STARTARROW="None" STARTINCLINATION="61;0;"/>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
|
|
@ -85744,9 +85743,23 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1730830270041" ID="ID_1591571416" MODIFIED="1730830413355" TEXT="parallel zum Prototyping mitführen">
|
||||
<icon BUILTIN="yes"/>
|
||||
<icon BUILTIN="bell"/>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1730830293781" ID="ID_1464679892" MODIFIED="1730830442239" TEXT="Strukturen der TDO anlegen">
|
||||
<arrowlink COLOR="#f01c36" DESTINATION="ID_124715076" ENDARROW="Default" ENDINCLINATION="-1234;-110;" ID="Arrow_ID_1508179375" STARTARROW="None" STARTINCLINATION="1159;108;"/>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1730830293781" ID="ID_1464679892" MODIFIED="1730850532210" TEXT="Strukturen der TestDomainOntology anlegen">
|
||||
<arrowlink COLOR="#f01c36" DESTINATION="ID_124715076" ENDARROW="Default" ENDINCLINATION="-1234;-110;" ID="Arrow_ID_1508179375" STARTARROW="None" STARTINCLINATION="1225;76;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1730850551731" ID="ID_569300878" MODIFIED="1730850558012" TEXT="processing functions">
|
||||
<node COLOR="#338800" CREATED="1730862521858" ID="ID_1019281023" MODIFIED="1730862530365" TEXT="processing_generateFrame">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1730862527871" ID="ID_1565354242" MODIFIED="1730862531851" TEXT="processing_generateMultichan">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1730862533053" ID="ID_708999522" MODIFIED="1730862564593" TEXT="processing_manipulateFrame">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1730862558806" ID="ID_450962417" MODIFIED="1730862564593" TEXT="processing_combineFrames">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1730836421602" ID="ID_592635517" MODIFIED="1730836446025" TEXT="auch TestFrame_test ensprechend ergänzen">
|
||||
<icon BUILTIN="bell"/>
|
||||
|
|
@ -91540,8 +91553,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1730825075913" ID="ID_265868890" MODIFIED="1730825103541" TEXT="der zweite und dritte Port ist explzit zu verdrahten"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1730827694080" ID="ID_124715076" MODIFIED="1730830442239" TEXT="Test-Code bereitstellen">
|
||||
<linktarget COLOR="#f01c36" DESTINATION="ID_124715076" ENDARROW="Default" ENDINCLINATION="-1234;-110;" ID="Arrow_ID_1508179375" SOURCE="ID_1464679892" STARTARROW="None" STARTINCLINATION="1159;108;"/>
|
||||
<node CREATED="1730827694080" ID="ID_124715076" MODIFIED="1730850532211" TEXT="Test-Code bereitstellen">
|
||||
<linktarget COLOR="#f01c36" DESTINATION="ID_124715076" ENDARROW="Default" ENDINCLINATION="-1234;-110;" ID="Arrow_ID_1508179375" SOURCE="ID_1464679892" STARTARROW="None" STARTINCLINATION="1225;76;"/>
|
||||
<node CREATED="1730827701591" ID="ID_1382558170" MODIFIED="1730827720498" TEXT="muß nun beginnen, die Test-Processing-Funktionen zu organisieren">
|
||||
<icon BUILTIN="smily_bad"/>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue