diff --git a/src/vault/gear/activity.hpp b/src/vault/gear/activity.hpp index be4c4bd93..ef1c07e77 100644 --- a/src/vault/gear/activity.hpp +++ b/src/vault/gear/activity.hpp @@ -154,12 +154,10 @@ namespace gear { "Execution-Context: " STRINGIFY(_FUN_) " expect function with signature: " STRINGIFY(_SIG_)); - EXE const& ctx = std::declval(); - - ASSERT_MEMBER_FUNCTOR (ctx.post, Proc(Activity&, EXE&, Time)); - ASSERT_MEMBER_FUNCTOR (ctx.work, void(Time, size_t)); - ASSERT_MEMBER_FUNCTOR (ctx.done, void(Time, size_t)); - ASSERT_MEMBER_FUNCTOR (ctx.tick, Proc(Time)); + ASSERT_MEMBER_FUNCTOR (EXE::post, Proc(Activity&, EXE&, Time)); + ASSERT_MEMBER_FUNCTOR (EXE::work, void(Time, size_t)); + ASSERT_MEMBER_FUNCTOR (EXE::done, void(Time, size_t)); + ASSERT_MEMBER_FUNCTOR (EXE::tick, Proc(Time)); #undef ASSERT_MEMBER_FUNCTOR diff --git a/tests/vault/gear/activity-detector-test.cpp b/tests/vault/gear/activity-detector-test.cpp index 0ef03f51b..2066450e3 100644 --- a/tests/vault/gear/activity-detector-test.cpp +++ b/tests/vault/gear/activity-detector-test.cpp @@ -69,6 +69,7 @@ namespace test { verifyMockInvocation(); verifyMockJobFunctor(); + verifyFakeExeContext(); detect_activation(); detect_gate(); } @@ -179,8 +180,26 @@ namespace test { + /** @test faked execution context to perform Activity activation + * @todo WIP 8/23 🔁 define ⟶ implement + */ + void + verifyFakeExeContext() + { + ActivityDetector detector; + auto& ctx = detector.executionCtx; + // an otherwise opaque object fulfilling the "Concept" + activity::_verify_usable_as_ExecutionContext(); + + Time t = lib::test::randTime(); + + CHECK (activity::PASS == ctx.tick(t)); + cout<call (log_->getID(), id_, args...) .addAttrib (MARK_SEQ, util::toString(*seqNr_)); @@ -401,6 +406,39 @@ namespace test { } + + struct FakeExecutionCtx; + using SIG_post = activity::Proc(Activity&, FakeExecutionCtx&, Time); + using SIG_work = void(Time, size_t); + using SIG_done = void(Time, size_t); + using SIG_tick = activity::Proc(Time); + + /** + * Mock setup of the execution context for Activity activation. + * The instance #executionCtx is wired back with the #eventLog_ + * and allows thus to detect and verify all callbacks from the Activities. + * @note the return value of the #post and #tick functions can be changed + * to another fixed response by calling DiagnosticFun::returning + */ + struct FakeExecutionCtx + { + _DiagnosticFun::Type post; + _DiagnosticFun::Type work; + _DiagnosticFun::Type done; + _DiagnosticFun::Type tick; + + FakeExecutionCtx (ActivityDetector& adi) + : post{adi.buildDiagnosticFun(CTX_POST).returning(activity::PASS)} + , work{adi.buildDiagnosticFun(CTX_WORK)} + , done{adi.buildDiagnosticFun(CTX_DONE)} + , tick{adi.buildDiagnosticFun(CTX_TICK).returning(activity::PASS)} + { } + }; + + FakeExecutionCtx executionCtx{*this}; + + + ActivityMatch verifyInvocation (string fun) { diff --git a/tests/vault/gear/scheduler-activity-test.cpp b/tests/vault/gear/scheduler-activity-test.cpp index dc36046e9..94ab20e0a 100644 --- a/tests/vault/gear/scheduler-activity-test.cpp +++ b/tests/vault/gear/scheduler-activity-test.cpp @@ -26,6 +26,7 @@ #include "lib/test/run.hpp" +#include "activity-detector.hpp" #include "vault/gear/activity-lang.hpp" #include "lib/time/timevalue.hpp" //#include "lib/format-cout.hpp" @@ -78,7 +79,7 @@ namespace test { /** @test TODO demonstrate a simple usage scenario - * @todo WIP 7/23 ⟶ define ⟶ implement + * @todo WIP 7/23 🔁 define 🔁 implement */ void simpleUsage() @@ -94,11 +95,12 @@ namespace test { /** @test TODO behaviour of Activity::INVOKE - * @todo WIP 7/23 ⟶ define ⟶ implement + * @todo WIP 7/23 🔁 define ⟶ implement */ void verifyActivity_Invoke() { + ActivityDetector detector; } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 13ec52e55..3623af93c 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -78454,7 +78454,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + + + + + + @@ -79425,10 +79431,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + + + + @@ -82030,6 +82040,23 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + +