diff --git a/tests/core/steam/engine/buffer-proxy-provider-test.cpp b/tests/core/steam/engine/buffer-proxy-provider-test.cpp index 4a0635bec..8bcc8aabc 100644 --- a/tests/core/steam/engine/buffer-proxy-provider-test.cpp +++ b/tests/core/steam/engine/buffer-proxy-provider-test.cpp @@ -66,7 +66,7 @@ namespace test { CHECK (handle.isValid()); auto& data = handle.accessAs(); uint64_t param = defaultGen.u64(); - manipulateFrame (&data, &data, param); + ont::manipulateFrame (&data, &data, param); // »client« is done... handle.emit(); diff --git a/tests/core/steam/engine/node-devel-test.cpp b/tests/core/steam/engine/node-devel-test.cpp index 1c4d5be91..f52b9d64e 100644 --- a/tests/core/steam/engine/node-devel-test.cpp +++ b/tests/core/steam/engine/node-devel-test.cpp @@ -97,7 +97,7 @@ namespace test { Buffer buff; CHECK (not buff->isSane()); - generateFrame (buff, frameNr, flavour); + ont::generateFrame (buff, frameNr, flavour); CHECK ( buff->isSane()); CHECK ( buff->isPristine()); CHECK (*buff == TestFrame(frameNr,flavour)); @@ -119,7 +119,7 @@ namespace test { for (uint i=0; iisSane()); - generateMultichan (buff[0], channels, frameNr, flavour); + ont::generateMultichan (buff[0], channels, frameNr, flavour); for (uint i=0; iisPristine()); @@ -136,13 +136,13 @@ namespace test { uint flavour = defaultGen.u64(); uint channels = 1 + rani(50); Buffer srcBuff[50]; - generateMultichan (srcBuff[0], channels, frameNr, flavour); + ont::generateMultichan (srcBuff[0], channels, frameNr, flavour); Buffer clone[50]; for (uint i=0; iisSane()); - duplicateMultichan (clone[0],srcBuff[0], channels); + ont::duplicateMultichan (clone[0],srcBuff[0], channels); for (uint i=0; iisPristine()); @@ -168,15 +168,15 @@ namespace test { uint flavour = defaultGen.u64(); uint channels = 1 + rani(50); Buffer buff[50], refData[50]; - generateMultichan (buff[0], channels, frameNr, flavour); + ont::generateMultichan (buff[0], channels, frameNr, flavour); // stash away a copy of the test data for verification - duplicateMultichan(refData[0],buff[0], channels); + ont::duplicateMultichan(refData[0],buff[0], channels); for (uint c=0; cisPristine()); uint64_t param = defaultGen.u64(); - manipulateMultichan(buff[0], channels, param); + ont::manipulateMultichan(buff[0], channels, param); const uint SIZ = buff[0]->data64().size(); vector xlink(SIZ, param); // temporary storage for verifying the hash-chain @@ -214,7 +214,7 @@ namespace test { CHECK (oBuff->isPristine()); uint64_t param = defaultGen.u64(); - manipulateFrame (oBuff, iBuff, param); + ont::manipulateFrame (oBuff, iBuff, param); CHECK ( oBuff->isValid()); CHECK (not oBuff->isPristine()); CHECK ( iBuff->isPristine()); @@ -230,7 +230,7 @@ namespace test { CHECK (feed == oDat); } // can also process in-place - manipulateFrame (iBuff, iBuff, param); + ont::manipulateFrame (iBuff, iBuff, param); CHECK (not iBuff->isPristine()); CHECK ( iBuff->isValid()); CHECK (*iBuff == *oBuff); // second invocation exactly reproduced data from first invocation @@ -253,7 +253,7 @@ namespace test { CHECK (oBuff->isPristine()); double mix = defaultGen.uni(); - combineFrames (oBuff, i1Buff, i2Buff, mix); + ont::combineFrames (oBuff, i1Buff, i2Buff, mix); CHECK ( oBuff->isValid()); CHECK (not oBuff->isPristine()); CHECK ( i1Buff->isPristine()); @@ -265,7 +265,7 @@ namespace test { CHECK (oDat == std::lround((1-mix)*i1Dat + mix*i2Dat)); // can also process in-place - combineFrames (i1Buff, i1Buff, i2Buff, mix); + ont::combineFrames (i1Buff, i1Buff, i2Buff, mix); CHECK (not i1Buff->isPristine()); CHECK ( i1Buff->isValid()); CHECK (*i1Buff == *oBuff); // second invocation exactly reproduced data from first invocation @@ -283,15 +283,14 @@ namespace test { testRand_simpleUsage() { auto spec = testRand().setupGenerator(); -SHOW_EXPR(spec.PROTO); CHECK (spec.PROTO == "generate-TestFrame"_expect); -SHOW_EXPR(spec.describe()) + + // generate a binding as processing-functor auto procFun = spec.makeFun(); using Sig = lib::meta::_Fun::Sig; -SHOW_EXPR(showType()) CHECK (showType() == "void (tuple, engine::test::TestFrame*)"_expect); - // Behaves identical to processing_generateFrame() + // Behaves identical to processing_generateFrame() — see above... size_t frameNr = defaultGen.u64(); uint flavour = defaultGen.u64(); @@ -303,15 +302,14 @@ SHOW_EXPR(showType()) CHECK ( buff->isPristine()); CHECK (*buff == TestFrame(frameNr,flavour)); - ProcNode node{prepareNode("Test") + ProcNode node{prepareNode(spec.nodeID()) .preparePort() - .invoke(spec.describe(), procFun) + .invoke(spec.procID(), procFun) .setParam(frameNr,flavour) .completePort() .build()}; -SHOW_EXPR(watch(node).getPortSpec(0)) - CHECK (watch(node).getPortSpec(0) == "Test(TestFrame)"_expect); + CHECK (watch(node).getPortSpec(0) == "Test:generate(TestFrame)"_expect); BufferProvider& provider = DiagnosticBufferProvider::build(); BuffHandle buffHandle = provider.lockBuffer (provider.getDescriptorFor(sizeof(TestFrame))); diff --git a/tests/core/steam/engine/node-link-test.cpp b/tests/core/steam/engine/node-link-test.cpp index 2d4bcea91..aade1ca89 100644 --- a/tests/core/steam/engine/node-link-test.cpp +++ b/tests/core/steam/engine/node-link-test.cpp @@ -65,9 +65,16 @@ namespace test { void build_connected_nodes() { - auto con = prepareNode("Test:Src") + // use some dummy specs and a dummy operation.... + StrView nodeID{ont::DUMMY_NODE_ID}; + StrView procID{ont::DUMMY_PROC_ID}; + CHECK (nodeID == "Test:dummy"_expect); + CHECK (procID == "op(int)"_expect); + + // use the NodeBuilder to construct a simple source-node connectivity + auto con = prepareNode(nodeID) .preparePort() - .invoke(DUMMY_FUN_ID, dummyOp) + .invoke(procID, ont::dummyOp) .completePort() .build(); CHECK (isnil (con.leads)); @@ -80,7 +87,7 @@ namespace test { CHECK (watch(n1).ports().size() == 1); // can generate a symbolic spec to describe the Port's processing functionality... - CHECK (watch(n1).getPortSpec(0) == "Test:Src.dummyFun(TestFrame)"_expect); + CHECK (watch(n1).getPortSpec(0) == "Test:dummy.op(int)"_expect); CHECK (watch(n1).getPortSpec(1) == "↯"_expect); // such a symbolic spec is actually generated by a deduplicated metadata descriptor @@ -100,14 +107,11 @@ namespace test { CHECK (meta3.genProcSpec() == "N1.uga()"_expect); // re-generate the descriptor for the source node (n1) - auto& metaN1 = ProcID::describe("Test:Src",DUMMY_FUN_ID); - CHECK (metaN1.genProcSpec() == "Test:Src.dummyFun(TestFrame)"_expect); -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); + auto& metaN1 = ProcID::describe("Test:dummy","op(int)"); + CHECK (metaN1.genProcSpec() == "Test:dummy.op(int)"_expect); + CHECK (metaN1.genProcName() == "Test:dummy.op"_expect); + CHECK (metaN1.genNodeName() == "Test:dummy"_expect); + CHECK (metaN1.genNodeSpec(con.leads) == "Test:dummy-◎"_expect); } diff --git a/tests/core/steam/engine/test-rand-ontology.cpp b/tests/core/steam/engine/test-rand-ontology.cpp index bc029e9e1..d2cb8dfb3 100644 --- a/tests/core/steam/engine/test-rand-ontology.cpp +++ b/tests/core/steam/engine/test-rand-ontology.cpp @@ -36,132 +36,130 @@ using lib::zip; namespace steam { namespace engine{ namespace test { +namespace ont { // namespace err = lumiera::error; - - using ont::FraNo; - using ont::ChaNo; - using ont::Flavr; - using ont::Factr; - using ont::Param; - - namespace { // hidden local support facilities.... - } // (End) hidden impl details - - - const string DUMMY_FUN_ID{"dummyFun(TestFrame)"}; - - /* ========= Dummy implementation of Media processing ========= */ - - /** - * @param buff a sufficiently sized allocation to place the result data into - * @param frameNr the frame of the »source feed« to generate (determines actual random data) - * @param flavour a further seed parameter to determine the actual (reproducibly) random data - */ - void - generateFrame (TestFrame* buff, FraNo frameNr, Flavr flavour) - { - REQUIRE (buff); - new(buff) TestFrame{uint(frameNr), flavour}; - } - - /** - * @param chanCnt size of the array of frames to generate - * @param buffArry pointer to an allocation sufficiently sized to hold `TestFrame[chanCnt]` - * @param frameNr the frame of the »source feed« to use commonly on all those frames in the output - * @param flavour a further seed parameter used as starting offest for the output's `family` parameters - * @remark this is a variation of the [dummy data generator](\ref #generateFrame), - * which immediately generates a planar block of related frames with random data, - * all seeded with the _same_ `frameNr` and _consecutive_ `family` parameters, - * which will be offset commonly by adding the \a flavour parameter. - */ - void - generateMultichan (TestFrame* buffArry, ChaNo chanCnt, FraNo frameNr, Flavr flavour) - { - REQUIRE (buffArry); - for (uint i=0; idata64().size(); - for (uint i=0; idata64(), in->data64())) - res = calculate(param, src); - out->markChecksum(); - } - - /** - * @param out existing allocation to receive the calculated result TestFrame - * @param srcA a buffer holding the input data for feed-A - * @param srcB a buffer holding the input data for feed-B - * @param mix degree of mixing (by integer arithmetics): 100 means 100% feed-B - * @remark this function emulates a mixing or overlaying operation: - * each result byte is the linear interpolation between the corresponding inputs. - */ - void - combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, Factr mix) - { - REQUIRE (srcA); - REQUIRE (srcB); - REQUIRE (out); - for (auto& [res,inA,inB] : zip (out->data() - ,srcA->data() - ,srcB->data())) - res = lround((1-mix)*inA + mix*inB); - out->markChecksum(); - } + namespace { // hidden local support facilities.... + + } // (End) hidden impl details + + /** @remark will be returned from dummyOp() */ + int dummyNum{-1}; + + + + /* ========= Dummy implementation of Media processing ========= */ + + /** + * @param buff a sufficiently sized allocation to place the result data into + * @param frameNr the frame of the »source feed« to generate (determines actual random data) + * @param flavour a further seed parameter to determine the actual (reproducibly) random data + */ + void + generateFrame (TestFrame* buff, FraNo frameNr, Flavr flavour) + { + REQUIRE (buff); + new(buff) TestFrame{uint(frameNr), flavour}; + } + + /** + * @param chanCnt size of the array of frames to generate + * @param buffArry pointer to an allocation sufficiently sized to hold `TestFrame[chanCnt]` + * @param frameNr the frame of the »source feed« to use commonly on all those frames in the output + * @param flavour a further seed parameter used as starting offest for the output's `family` parameters + * @remark this is a variation of the [dummy data generator](\ref #generateFrame), + * which immediately generates a planar block of related frames with random data, + * all seeded with the _same_ `frameNr` and _consecutive_ `family` parameters, + * which will be offset commonly by adding the \a flavour parameter. + */ + void + generateMultichan (TestFrame* buffArry, ChaNo chanCnt, FraNo frameNr, Flavr flavour) + { + REQUIRE (buffArry); + for (uint i=0; idata64().size(); + for (uint i=0; idata64(), in->data64())) + res = calculate(param, src); + out->markChecksum(); + } + + /** + * @param out existing allocation to receive the calculated result TestFrame + * @param srcA a buffer holding the input data for feed-A + * @param srcB a buffer holding the input data for feed-B + * @param mix degree of mixing (by integer arithmetics): 100 means 100% feed-B + * @remark this function emulates a mixing or overlaying operation: + * each result byte is the linear interpolation between the corresponding inputs. + */ + void + combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, Factr mix) + { + REQUIRE (srcA); + REQUIRE (srcB); + REQUIRE (out); + for (auto& [res,inA,inB] : zip (out->data() + ,srcA->data() + ,srcB->data())) + res = lround((1-mix)*inA + mix*inB); + out->markChecksum(); + } + }//(End)namespace ont diff --git a/tests/core/steam/engine/test-rand-ontology.hpp b/tests/core/steam/engine/test-rand-ontology.hpp index e0a64f343..5a9df7814 100644 --- a/tests/core/steam/engine/test-rand-ontology.hpp +++ b/tests/core/steam/engine/test-rand-ontology.hpp @@ -60,53 +60,55 @@ namespace test { using Factr = double; using Param = uint64_t; + const Literal OID{"Test"}; ///< classificatory prefix for functionality provided by this „library“ const Literal TYPE_TESTFRAME{"TestFrame"}; ///< a stream implementation type with a frame of reproducible random data - } + /** a dummy value */ + extern int dummyNum; + + /** the simplest possible function, + * which can be bound as Render Node */ + inline void + dummyOp (int* num_in_buff) + { + CHECK (num_in_buff != nullptr); + *num_in_buff = dummyNum++; + } + const Literal DUMMY_NODE_ID{"Test:dummy"}; + const Literal DUMMY_PROC_ID{"op(int)"}; + + + /** produce sequences of frames with (reproducible) random data */ + void generateFrame (TestFrame* buff, FraNo frameNr =0, Flavr flavour =0); + + /** produce planar multi channel output of random data frames */ + void generateMultichan (TestFrame* buffArry, ChaNo chanCnt, FraNo frameNr =0, Flavr flavour =0); + + /** create an identical clone copy of the planar multi channel frame array */ + void duplicateMultichan (TestFrame* outArry, TestFrame* inArry, ChaNo chanCnt); + + /** »process« a planar multi channel array of data frames in-place */ + void manipulateMultichan (TestFrame* buffArry, ChaNo chanCnt, Param param); + + /** »process« random frame date by hash-chaining with a parameter */ + void manipulateFrame (TestFrame* out, TestFrame const* in, Param param); + + /** mix two random data frames by a parameter-controlled proportion */ + void combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, Factr mix); + + }//(End)namespace ont - /** produce sequences of frames with (reproducible) random data */ - void generateFrame (TestFrame* buff, ont::FraNo frameNr =0, ont::Flavr flavour =0); - /** produce planar multi channel output of random data frames */ - void generateMultichan (TestFrame* buffArry, ont::ChaNo chanCnt, ont::FraNo frameNr =0, ont::Flavr flavour =0); - /** create an identical clone copy of the planar multi channel frame array */ - void duplicateMultichan (TestFrame* outArry, TestFrame* inArry, ont::ChaNo chanCnt); - - /** »process« a planar multi channel array of data frames in-place */ - void manipulateMultichan (TestFrame* buffArry, ont::ChaNo chanCnt, ont::Param param); - /** »process« random frame date by hash-chaining with a parameter */ - void manipulateFrame (TestFrame* out, TestFrame const* in, ont::Param param); - - /** mix two random data frames by a parameter-controlled proportion */ - void combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, ont::Factr mix); - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Dummy / Placeholder - using NoArg = std::array; - using SoloArg = std::array; - - extern const string DUMMY_FUN_ID; - - /** @todo a placeholder operation to wire a prototypical render node - */ - inline void - dummyOp (NoArg in, SoloArg out) - { - UNIMPLEMENTED ("a sincerely nonsensical operation"); - } -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Dummy / Placeholder /** - * A fake _Domain Ontology_ to describe mocked »render operations« on - * dummy data frames filled with random numbers. - * + * A fake **Domain Ontology** to describe mocked »render operations« on dummy data frames + * filled with random numbers. It provides a _builder notation_ to configure a _processing-functor_ + * for some operations working on such data frames. * @see TestFrame_test * @see NodeDevel_test * @see NodeLink_test - * */ class TestRandOntology { @@ -120,21 +122,25 @@ namespace test { ~TestRandOntology() = default; TestRandOntology() = default; - auto setupGenerator (string qual =""); + auto setupGenerator(); private: }; + + struct TestRandOntology::Spec : util::Cloneable { const string PROTO; + const string FUNC_ID; const string BASE_TYPE; Spec (Literal kind ,Literal type ) : PROTO{_Fmt{"%s-%s"} % kind % type} + , FUNC_ID{kind} , BASE_TYPE{type} { } }; @@ -152,17 +158,9 @@ namespace test { , conf_{make_shared (spec, forward (init)...)} { } - auto - makeFun() - { - return conf_->binding(); - } - - string - describe() - { - return conf_->procSpec(); - } + auto makeFun() { return conf_->binding(); } + string procID() { return conf_->procSpec(); } + string nodeID() { return string{ont::OID}+":"+FUNC_ID; } }; @@ -200,10 +198,14 @@ namespace test { % streamType; } }; - } + }//(End)namespace ont + + /** + * Initiate configuration of a generator-node to produce TestFrame(s) + */ inline auto - TestRandOntology::setupGenerator (string qual) + TestRandOntology::setupGenerator() { Spec spec{"generate", ont::TYPE_TESTFRAME}; Builder builder{spec}; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 98e1e2906..18a6bf0eb 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -88486,9 +88486,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -99312,19 +99312,33 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + - - + + - - + + + + + + + +

+ ...im Grunde bräuchte es diese dummy-Funktion jetzt gar nicht mehr, da nun viel flexiblere Signaturen akzeptiert werden; zu Beginn des Prototyping hatte ich ja noch eine recht spezielle Konvention mit einem std::array... +

+

+ Ich lasse diese Dummy-Operation dennoch bestehen, vor allem, weil auch dazu passende Specs gegeben sind +

+ + +
@@ -99590,16 +99604,13 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - +

herausfinden wie ein API für Tests sinnvollerweise aufgebaut werden kann...

- -
+ @@ -100421,7 +100432,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -100430,6 +100441,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + + @@ -100735,16 +100751,13 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - +

es bleibt zu klären: was stellt das Turnout-System dar?

- -
+