diff --git a/tests/core/steam/engine/testframe-test.cpp b/tests/core/steam/engine/testframe-test.cpp index e5c9de8b8..e919b50d9 100644 --- a/tests/core/steam/engine/testframe-test.cpp +++ b/tests/core/steam/engine/testframe-test.cpp @@ -190,7 +190,7 @@ namespace test { CHECK ( testData(3,51).isSane()); CHECK ( testData(3,49).isSane()); - resetTestFrames(); + TestFrame::reseed(); CHECK ( testData(3,50).isSane()); } diff --git a/tests/core/steam/engine/testframe.cpp b/tests/core/steam/engine/testframe.cpp index 6353d2317..710077770 100644 --- a/tests/core/steam/engine/testframe.cpp +++ b/tests/core/steam/engine/testframe.cpp @@ -19,9 +19,10 @@ #include "lib/error.hpp" #include "lib/random.hpp" #include "steam/engine/testframe.hpp" +#include "lib/nocopy.hpp" +#include "lib/util.hpp" -#include - +#include #include #include #include @@ -32,33 +33,78 @@ namespace steam { namespace engine { namespace test { + using lib::HashVal; using std::vector; using std::memcpy; using lib::rani; - typedef boost::rand48 PseudoRandom; + /** @note using a random-congruential engine to generate the payload data */ + using PseudoRandom = lib::RandomSequencer; namespace error = lumiera::error; namespace { // hidden local support facilities.... + /** + * Offset to set the seed values of »families« apart. + * The data in the test frames is generated from a distinctive ID-seed, + * which is controlled by the _family_ and the _seq-No_ within each family. + * The seeds for consecutive frames are spread apart by the #dataSeed, + * and the SEQUENCE_SPREAD constant acts as minimum spread. While seed + * values can wrap within the 64bit number range, this generation scheme + * makes it very unlikely that neighbouring frames end up with the same seed. + */ + const size_t SEQUENCE_SPREAD = 100; + + HashVal + drawSeed (lib::Random& srcGen) + { + return srcGen.distribute( + std::uniform_int_distribution{SEQUENCE_SPREAD + ,std::numeric_limits::max()-SEQUENCE_SPREAD}); + } + + /** @internal a static seed hash used to anchor the data distinction ID-seeds */ + HashVal dataSeed{drawSeed(lib::entropyGen)}; + /** @internal helper for generating unique test frames. - * This "discriminator" is used as a random seed when - * filling the test frame data buffers. It is generated - * to be different on adjacent frames of the same series, - * as well as to differ to all near by neighbouring channels. + * This "discriminator" is used as a random seed when filling the test frame data buffers. + * It is generated to be very likely different on adjacent frames of the same series, + * as well as to differ to all nearby neighbouring channels. * @param seq the sequence number of the frame within the channel * @param family the channel this frame belongs to */ uint64_t generateDistinction(uint seq, uint family) { - // random offset, but fixed per executable run - static uint base(10 + rani(990)); /////////////////////////////////////////////////////////////////////TICKET #1372 this is not reproducible!! - // use the family as stepping - return (seq+1) * (base+family); + return (seq+1) * (dataSeed+family); + } + + class DistinctNucleus + : public lib::SeedNucleus + , util::MoveOnly + { + uint64_t const& fixPoint_; + public: + DistinctNucleus(uint64_t const& anchor) + : fixPoint_{anchor} + { } + + uint64_t + getSeed() override + { + return fixPoint_; + } + }; + + /** @internal build a PRNG starting from the referred fixed seed */ + auto + buildDataGenFrom (uint64_t const& anchor) + { + DistinctNucleus seed{anchor}; + return PseudoRandom{seed}; } @@ -155,11 +201,23 @@ namespace test { { return accessTestFrame (seqNr,chanNr); } + + + /** + * @remark this function should be invoked at the start of any test + * which requires reproducible data values in the TestFrame. + * It generates a new base seed to distinguish individual data frames. + * The seed is drawn from the \ref lib::defaultGen, and thus will be + * reproducible if the latter has been reseeded beforehand. + * @warning after invoking reseed(), the validity of previously generated + * frames can no longer be verified. + */ void - resetTestFrames() + TestFrame::reseed() { - testFrames.reset(0); + testFrames.reset(); + drawSeed (lib::defaultGen); } @@ -194,7 +252,7 @@ namespace test { { if (DISCARDED == stage_) throw new error::Logic ("target TestFrame is already dead"); - if (this != &o) + if (not util::isSameAdr (this, o)) { distinction_ = o.distinction_; stage_ = CREATED; @@ -246,9 +304,9 @@ namespace test { bool TestFrame::verifyData() const { - PseudoRandom gen(distinction_); + auto gen = buildDataGenFrom (distinction_); for (uint i=0; i @@ -66,6 +67,9 @@ namespace test { std::byte buffer_[sizeof(_Arr)]; public: + /** discard all cached #testData and recalibrate data generation */ + static void reseed(); + ~TestFrame(); TestFrame (uint seq=0, uint family=0); TestFrame (TestFrame const&); @@ -114,11 +118,6 @@ namespace test { TestFrame& testData (uint chanNr, uint seqNr); - /** discards all the TestFrame instances and - * initialises an empty table of test frames */ - void resetTestFrames(); - - }}} // namespace steam::engine::test #endif diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 775e19ff5..d3838ffd2 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -17563,9 +17563,7 @@ - - - +

d.h. das Text-Label bekommt ggfs. eine Längenbeschränkung. @@ -18015,9 +18013,7 @@ - - - +

ein Marker, ein Pin, Position,.... @@ -18832,9 +18828,7 @@ - - - +

zwar machen wir im Ctor zuletzt ein show_all(), welches dann erst diese Layout-Berechnung anstößt. Aber zum Zeitpunkt der Allokations-Zuteilung für das Container-Widget (ElementBox selber) haben die nested-children noch keine Allokation bekommen; zwar gelten sie schon als "mapped" und "realized", aber offensichtlich führt eine Änderung des visible()-Status dazu, daß das damit ausgeblendete Kind-Widget schon gleich gar nicht gezeichnet wird @@ -19140,9 +19134,7 @@ - - - +

...weil der Constraint ja gelockert sein könnte @@ -19842,9 +19834,7 @@ - - - +

egal ob nun absolut oder relativ, aber die Lumiera Time-Koordinaten sind gemein. Das ist nicht die »wall clock time« @@ -21177,9 +21167,7 @@ - - - +

durch die Lösung mit dem "Einhäkeln" via temporär durchgereichtem Lambda! @@ -23790,9 +23778,7 @@ - - - +

...damit würde eine std::function konstruiert, @@ -40081,9 +40067,7 @@ - - - +

a fixed absolute number of tick units, @@ -42417,9 +42401,7 @@ - - - +

aus praktischen Gründen erfolgt die Rechnung in FSecs, und das ist hier nicht gefährlich, weil der Nenner dieses Wertes in der Metrik-Berechnung nur mit den Pixeln in Berührung kommt @@ -43907,9 +43889,7 @@ - - - +

Extrem wichtig. Und auch wichtig: mit diesem Akkumulator nachher noch etwas machen (z.B. ausgeben). Sonst merkt der Compiler daß das kein beobachtbarer Effekt ist, und entfernt die Addition, und dann in einigen Fällen auch den eigentlichen Funktionsaufruf @@ -45842,9 +45822,7 @@ - - - +

(GlobalCtx)->InteractionDirector (=Model Root) @@ -46178,9 +46156,7 @@ - - - +

dann immer besser noch ein: frame#element @@ -46324,9 +46300,7 @@ - - - +

mark "clearMsg" @@ -46392,9 +46366,7 @@ - - - +

was haben alle UI-Elemente wirklich gemeinsam? @@ -56312,7 +56284,8 @@ - + + @@ -56815,12 +56788,33 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -56987,7 +56981,7 @@ - + @@ -57189,7 +57183,7 @@ - + @@ -57332,7 +57326,7 @@ - + @@ -57393,7 +57387,7 @@ - + @@ -57443,7 +57437,7 @@ - + @@ -57751,7 +57745,7 @@ - + @@ -57809,17 +57803,20 @@ - + - + - + + - + + + - + @@ -57999,7 +57996,7 @@ - + @@ -90363,6 +90360,111 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + +

+ aber diese baut nur auf dem Typ der Funktoren auf +

+ +
+ + + + + +

+ es könnte passieren, daß wir lediglich die Hash-ID generiern für generische Signaturen wie z.B. size_t(string); alle Funktoren mit dieser Signatur wären dann identisch +

+ +
+ +
+
+ + + + + + + +

+ eine stabile Charakteriseierung wird benögigt +

+ +
+ + + +

+ ...bedeutet: eine Speicher-Adresse könnte bereits zu spezifisch sein.... +

+ +
+
+ + + + + + + +

+ irgendwie binden wir hier einen Handler ein, der »hinten rum« am Lib-Plugin hängt und dafür einen (privaten) Datentyp konstruiert ⟹ diese  Info muß in den Prototyp eingehen +

+ + +
+ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -90389,7 +90491,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -90425,7 +90527,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -90455,9 +90557,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + + - + + + @@ -92162,7 +92268,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -92174,7 +92280,27 @@ Date:   Thu Apr 20 18:53:17 2023 +0200

- + + + + + + + + + + + +

+ wirft auch den internen Daten-Cache weg und re-seeded den Basis-Hash, auf dem die Distinction-ID dann aufbaut +

+ + +
+
+ + + @@ -92199,6 +92325,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ @@ -92298,6 +92425,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + +
@@ -92654,6 +92785,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + @@ -92689,12 +92824,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + - + @@ -92704,6 +92840,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + @@ -93636,6 +93774,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + +