Activity-Lang: define test cases for basic Activities
This commit is contained in:
parent
4e6ee0ec9c
commit
4c0e58849a
2 changed files with 92 additions and 33 deletions
|
|
@ -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()<<endl; // HINT: use this for investigation...
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test behaviour of Activity::POST
|
||||
* @todo WIP 8/23 🔁 define ⟶ implement
|
||||
*/
|
||||
void
|
||||
verifyActivity_Post()
|
||||
{
|
||||
Activity chain;
|
||||
Activity post{Time{0,11}, Time{0,22}, &chain};
|
||||
CHECK (Activity::TICK == chain.verb_);
|
||||
CHECK (Activity::POST == post.verb_);
|
||||
CHECK (Time(0,11) == post.data_.timeWindow.life);
|
||||
CHECK (Time(0,22) == post.data_.timeWindow.dead);
|
||||
CHECK ( & chain == post.next);
|
||||
|
||||
ActivityDetector detector;
|
||||
Time tt{11,11};
|
||||
post.activate (tt, detector.executionCtx);
|
||||
|
||||
cout << detector.showLog() <<endl;
|
||||
CHECK (detector.verifyInvocation("CTX-post").arg("11.011", "Act(TICK", "≺test::CTX≻")); ///////////////////OOO need somehow to transport the time window...
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -117,31 +152,46 @@ namespace test {
|
|||
Time realTime = RealClock::now();
|
||||
CHECK (activity::PASS == invoke.activate (realTime, detector.executionCtx));
|
||||
|
||||
cout << detector.showLog()<<endl;
|
||||
CHECK (detector.verifyInvocation ("job").arg(nomTime, x1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test TODO behaviour of Activity::NOTIFY
|
||||
* - notification entails to schedule a follow-up activation
|
||||
* - implies to pass the `next`-Activity to the execution context's `post()` hook
|
||||
* - use the rigged execution context from ActivityDetector to detect call
|
||||
* @todo WIP 7/23 🔁 define ⟶ implement
|
||||
* - notification is dispatched as special message to an indicated target Activity
|
||||
* - when activated, a `NOTIFY`-Activity _posts itself_ through the Execution Context hook
|
||||
* - this way, further processing will happen in management mode (single threaded)
|
||||
* @todo WIP 8/23 🔁 define ⟶ implement
|
||||
*/
|
||||
void
|
||||
verifyActivity_Notify()
|
||||
verifyActivity_Notify_activate()
|
||||
{
|
||||
Activity chain;
|
||||
Activity notify{&chain};
|
||||
|
||||
ActivityDetector detector;
|
||||
Time tt{111,11};
|
||||
notify.activate (tt, detector.executionCtx);
|
||||
cout << detector.showLog() <<endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test TODO behaviour of Activity::NOTIFY
|
||||
* @todo WIP 7/23 ⟶ define ⟶ implement
|
||||
* - when _posting_ a `NOTIFY`, a dedicated _notification_ function is invoked on the chain
|
||||
* - what actually happens then depends on the receiver; here we just activate a test-Tap
|
||||
* @todo WIP 8/23 🔁 define ⟶ implement
|
||||
*/
|
||||
void
|
||||
verifyActivity_Post()
|
||||
verifyActivity_Notify_dispatch()
|
||||
{
|
||||
ActivityDetector detector;
|
||||
|
||||
Activity notify{detector.buildActivationProbe("targetActivity")};
|
||||
|
||||
Time tt{111,11};
|
||||
notify.dispatch (tt, detector.executionCtx);
|
||||
cout << detector.showLog() <<endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -78049,16 +78049,16 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
</node>
|
||||
<node CREATED="1688599961752" ID="ID_1476155017" MODIFIED="1688599964244" TEXT="invoke">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688599981240" ID="ID_1605268671" MODIFIED="1688601467122" TEXT="Job-Daten">
|
||||
<node COLOR="#435e98" CREATED="1688599981240" ID="ID_1605268671" MODIFIED="1692718372350" TEXT="Job-Daten">
|
||||
<arrowlink COLOR="#dd7f91" DESTINATION="ID_1404753000" ENDARROW="Default" ENDINCLINATION="1062;104;" ID="Arrow_ID_153253143" STARTARROW="None" STARTINCLINATION="779;-154;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1688601470768" HGAP="39" ID="ID_973557978" MODIFIED="1688602978000" TEXT="leider ziemlich viel Daten" VSHIFT="17">
|
||||
<icon BUILTIN="info"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1688601470768" HGAP="39" ID="ID_973557978" MODIFIED="1692718363232" TEXT="leider ziemlich viel Daten" VSHIFT="17">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1688601569851" ID="ID_567583834" MODIFIED="1688601591196" TEXT="Ptr + Time + LUID + 2*size_t"/>
|
||||
<node CREATED="1688601604198" ID="ID_1026682492" MODIFIED="1688601662698" TEXT="⟹ 3 »slots« + 3*64bit"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1688602957054" HGAP="59" ID="ID_1822229878" MODIFIED="1688602975417" TEXT="in mehrere Pakete aufteilen">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1688602957054" HGAP="59" ID="ID_1822229878" MODIFIED="1692718359872" TEXT="in mehrere Pakete aufteilen">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1688693404561" ID="ID_208511888" MODIFIED="1688693412610" TEXT="INVOCATION + 2 * FEED"/>
|
||||
</node>
|
||||
</node>
|
||||
|
|
@ -79495,8 +79495,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node CREATED="1689200449333" ID="ID_386403564" MODIFIED="1689200453433" TEXT="usage scenarios"/>
|
||||
</node>
|
||||
<node CREATED="1689201354393" HGAP="24" ID="ID_1250518280" MODIFIED="1689201365333" TEXT="Hilfsmittel" VSHIFT="2">
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1689201660559" ID="ID_747497995" MODIFIED="1692057369715" TEXT="ActivityDetector">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1689201660559" ID="ID_747497995" MODIFIED="1692718533422" TEXT="ActivityDetector">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1689201667734" ID="ID_901153159" MODIFIED="1692286015665" TEXT="speziell verdrahtetes Setup">
|
||||
<icon BUILTIN="info"/>
|
||||
<node CREATED="1689201677836" ID="ID_166879509" MODIFIED="1689201693231" TEXT="kann ihre Aktivierung dokumentieren"/>
|
||||
|
|
@ -79533,20 +79533,29 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#e0ceaa" COLOR="#690f14" CREATED="1689199381509" HGAP="-9" ID="ID_1023579954" MODIFIED="1689200613367" TEXT="Testfälle" VSHIFT="4">
|
||||
<icon BUILTIN="list"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689199958807" ID="ID_1659400931" MODIFIED="1689200471838" TEXT="simpleUsage">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689201241256" ID="ID_1940651320" MODIFIED="1689201264958" TEXT="Activity platzieren">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1689199958807" ID="ID_1659400931" MODIFIED="1692718525119" TEXT="simpleUsage">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1689201241256" ID="ID_1940651320" MODIFIED="1692718523457" TEXT="Activity erstellen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689201251263" ID="ID_629522642" MODIFIED="1689201264958" TEXT="Epoche terminieren">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1689201251263" ID="ID_629522642" MODIFIED="1692718524329" TEXT="Activity aktivieren">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1692718407577" ID="ID_500127760" MODIFIED="1692718464799" TEXT="verifyActivity_Post">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1692718467475" HGAP="25" ID="ID_1128481830" MODIFIED="1692718501944" TEXT="POST muß die Zeitfenster-Info transportieren" VSHIFT="5">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1689199390484" ID="ID_176395611" MODIFIED="1692369867056" TEXT="verifyActivity_Invoke">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689199390484" ID="ID_1274424925" MODIFIED="1689200512352" TEXT="verifyActivity_Notify">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1689199390484" ID="ID_1274424925" MODIFIED="1692718461523" TEXT="verifyActivity_Notify_activate">
|
||||
<icon BUILTIN="pencil"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1692718437941" ID="ID_1363192893" MODIFIED="1692718461522" TEXT="verifyActivity_Notify_dispatch">
|
||||
<icon BUILTIN="pencil"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1689199390484" ID="ID_212018049" MODIFIED="1692544359039" TEXT="verifyActivity_Gate">
|
||||
<linktarget COLOR="#2c8d69" DESTINATION="ID_212018049" ENDARROW="Default" ENDINCLINATION="556;74;" ID="Arrow_ID_1693904148" SOURCE="ID_1220469732" STARTARROW="None" STARTINCLINATION="472;34;"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue