From 4c0e58849afb03762fc765f161f0c943e9747b71 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 22 Aug 2023 17:37:58 +0200 Subject: [PATCH] Activity-Lang: define test cases for basic Activities --- tests/vault/gear/scheduler-activity-test.cpp | 86 ++++++++++++++++---- wiki/thinkPad.ichthyo.mm | 39 +++++---- 2 files changed, 92 insertions(+), 33 deletions(-) diff --git a/tests/vault/gear/scheduler-activity-test.cpp b/tests/vault/gear/scheduler-activity-test.cpp index 29c29d9d8..6f797282b 100644 --- a/tests/vault/gear/scheduler-activity-test.cpp +++ b/tests/vault/gear/scheduler-activity-test.cpp @@ -68,9 +68,10 @@ namespace test { { simpleUsage(); - verifyActivity_Invoke(); - verifyActivity_Notify(); verifyActivity_Post(); + verifyActivity_Invoke(); + verifyActivity_Notify_activate(); + verifyActivity_Notify_dispatch(); verifyActivity_Gate(); termBuilder(); @@ -81,18 +82,52 @@ namespace test { } - /** @test TODO demonstrate a simple usage scenario - * @todo WIP 7/23 🔁 define 🔁 implement - */ + /** @test demonstrate simple Activity usage */ void simpleUsage() { // Activities are »POD with constructor« - Activity gate{5, Time{FSecs{3,2}}}; - CHECK (gate.verb_ == Activity::GATE); - CHECK (gate.next == nullptr); - CHECK (gate.data_.condition.rest == 5); - CHECK (gate.data_.condition.dead == Time(500,1)); + Activity start{Activity::WORKSTART}; + CHECK (start.verb_ == Activity::WORKSTART); + CHECK (start.next == nullptr); + CHECK (start.data_.timing.instant == Time::NEVER); //////////////////////////////////////////TICKET #1317 : the purpose of this time data is not clear yet + CHECK (start.data_.timing.quality == 0); + + // use the ActivityDetector for test instrumentation... + ActivityDetector detector; + + // Activities can be invoked within an ExecutionContext + Time now = RealClock::now(); + start.activate (now, detector.executionCtx); + + // In this case, activation causes invocation of λ-work on the context + CHECK (detector.verifyInvocation("CTX-work").arg(now, 0)); + +// cout << detector.showLog()< - + - - + + - - + + @@ -79495,8 +79495,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -79533,20 +79533,29 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - - + + + + - - + + + + + + + + - - + + + + +