diff --git a/tests/core/steam/engine/mock-dispatcher.hpp b/tests/core/steam/engine/mock-dispatcher.hpp index d99f4a502..5b3583a61 100644 --- a/tests/core/steam/engine/mock-dispatcher.hpp +++ b/tests/core/steam/engine/mock-dispatcher.hpp @@ -150,6 +150,16 @@ namespace test { SpecTuple(DummyJob::getFunctor(), 0, emptyPrereq)); } + inline auto + defineSimpleSpec (HashVal seed) /////////////////TODO collapse with defineBottomSpec() ?? + { + auto emptyPrereq = lib::nilIterator(); + using Iter = decltype(emptyPrereq); + using SpecTuple = std::tuple; + return lib::singleValIterator( + SpecTuple(DummyJob::getFunctor(), seed, emptyPrereq)); + } + }//(End)internal test helpers.... #if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1221 @@ -169,9 +179,14 @@ namespace test { public: MockJobTicket() : JobTicket{defineBottomSpec()} - { }; + { } + + MockJobTicket (HashVal seed) + : JobTicket{defineSimpleSpec (seed)} + { } bool verify_associated (Job const&) const; + static bool isAssociated (Job const&, JobTicket const&); private: }; @@ -190,7 +205,11 @@ namespace test { MockSegmentation (std::initializer_list specs) : MockSegmentation{} { - UNIMPLEMENTED ("populate mock sequence structure"); + for (auto& spec : specs) + { + auto seed = spec.retrieveAttribute("mark"); + tickets_.emplace_back (seed? *seed : HashVal(rand() % 1000)); + } } }; @@ -211,6 +230,19 @@ namespace test { and this->verifyInstance(functor, invoKey, nominalTime); } + /** + * convenience shortcut to perform [this test](\ref MockJobTicket::verify_associated) + * on arbitrary JobTicket and Job instances. + * @warning a positive test result however relies on some casting trickery and there is no + * guarantee this test works if the JobTicket was not created from this mock framework. + */ + inline bool + MockJobTicket::isAssociated (Job const& job, JobTicket const& ticket) + { // should work always, since storage is the same + MockJobTicket const& backdoor = static_cast (ticket); + return backdoor.verify_associated (job); + } + }}} // namespace steam::engine::test diff --git a/tests/core/steam/engine/mock-support-test.cpp b/tests/core/steam/engine/mock-support-test.cpp index 1381b56e2..d676706af 100644 --- a/tests/core/steam/engine/mock-support-test.cpp +++ b/tests/core/steam/engine/mock-support-test.cpp @@ -139,11 +139,32 @@ namespace test { void verify_MockSegmentation() { - MockSegmentation mockSeg; - CHECK (1 == mockSeg.size()); - Time arbitraryTime = lib::test::randTime(); - JobTicket const& ticket = mockSeg[arbitraryTime].jobTicket(); - CHECK (util::isSameObject (ticket, JobTicket::NOP)); + FrameCoord coord; + Time someTime = lib::test::randTime(); + coord.absoluteNominalTime = someTime; + { + MockSegmentation mockSeg; + CHECK (1 == mockSeg.size()); + JobTicket const& ticket = mockSeg[someTime].jobTicket(); + CHECK (util::isSameObject (ticket, JobTicket::NOP)); + } + { + MockSegmentation mockSeg{MakeRec().genNode()}; + CHECK (1 == mockSeg.size()); + JobTicket const& ticket = mockSeg[someTime].jobTicket(); + CHECK (not util::isSameObject (ticket, JobTicket::NOP)); + + Job someJob = ticket.createJobFor(coord); + CHECK (MockJobTicket::isAssociated (someJob, ticket)); + CHECK (not DummyJob::was_invoked (someJob)); + + someJob.triggerJob(); + CHECK (DummyJob::was_invoked (someJob)); + CHECK (RealClock::wasRecently (DummyJob::invocationTime (someJob))); + CHECK (someTime == DummyJob::invocationNominalTime (someJob)); + } + + TODO ("cover details of MockSegmentation"); } }; diff --git a/tests/library/diff/gen-node-test.cpp b/tests/library/diff/gen-node-test.cpp index 1be51abfc..ce19afde0 100644 --- a/tests/library/diff/gen-node-test.cpp +++ b/tests/library/diff/gen-node-test.cpp @@ -156,7 +156,7 @@ namespace test{ auto o0 = MakeRec().genNode(); auto o1 = MakeRec().genNode("νόμος"); auto o2 = MakeRec().type("spam").genNode(); - auto o3 = MakeRec().attrib("Ψ", int64_t(42), "π", 3.14159265358979323846264338328).genNode("λόγος"); + auto o3 = MakeRec().attrib("Ψ", int64_t(42), "π", 3.14159265358979323846264338328).genNode("μάθησις"); CHECK (!o0.isNamed()); CHECK (isnil(o0.data.get())); @@ -171,7 +171,7 @@ namespace test{ CHECK (isnil(o2.data.get())); CHECK (o3.isNamed()); - CHECK ("λόγος" == o3.idi.getSym()); + CHECK ("μάθησις" == o3.idi.getSym()); CHECK ("NIL" == o3.data.get().getType()); CHECK (GenNode("Ψ", int64_t(42)) == o3.data.get().get("Ψ")); CHECK (42L == o3.data.get().get("Ψ").data.get()); diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 175970825..243bc8110 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -69645,8 +69645,8 @@ - - + + @@ -69871,9 +69871,9 @@ - + - + @@ -69971,6 +69971,10 @@ + + + + @@ -69990,8 +69994,8 @@ - - + + @@ -70010,8 +70014,8 @@ - - + + @@ -70019,10 +70023,25 @@ - + + + + + + + + + + + + + + + +