Library/Application: switch BusTerm_test

This commit is contained in:
Fischlurch 2023-10-05 01:50:54 +02:00
parent 77622a3f2d
commit 0ae675239d
3 changed files with 25 additions and 20 deletions

View file

@ -120,7 +120,7 @@ namespace diff{
/**
* Opaque message to effect a structural change on a target, which is
* likewise only known in an abstract way, as being specifically structured.
* Sending such messages typically allows some _implemention defined_ part within
* Sending such messages typically allows some _implementation defined_ part within
* the Session to communicate structure and content to some other _implementation defined_
* part within the UI-Layer, without the necessity of both partners to be tightly coupled on
* implementation level or even know much about the other's implementation details. As motivation,

View file

@ -27,9 +27,9 @@
#include "lib/test/run.hpp"
#include "lib/test/test-helper.hpp"
#include "lib/thread.hpp"
#include "lib/sync.hpp"
#include "lib/sync-classlock.hpp"
#include "vault/thread-wrapper.hpp"
#include "include/ui-protocol.hpp"
#include "stage/ctrl/bus-term.hpp"
#include "stage/ctrl/state-manager.hpp"
@ -54,7 +54,7 @@ using boost::lexical_cast;
using lib::Sync;
using lib::ClassLock;
using vault::ThreadJoinable;
using lib::ThreadJoinable;
using lib::iter_stl::dischargeToSnapshot;
using lib::IterQueue;
using lib::IterStack;
@ -546,10 +546,10 @@ namespace test {
/**
* @test integration test of mutation by diff message
* @test integration test of mutation by diff message.
* Since this test focuses on the bus side of standard interactions,
* it seems indicated to emulate the complete invocation situation,
* which involves passing thread boundraries. The main thread running
* it seems indicated to simulate the complete invocation situation,
* which involves passing thread boundaries. The main thread running
* this test shall enact the role of the UI event thread (since the
* UI-Bus in the real application is confined to this UI thread).
* Thus we'll start another thread to enact the role of the Session,
@ -566,7 +566,7 @@ namespace test {
struct SessionThread
: Sync<>
, ThreadJoinable
, ThreadJoinable<>
{
// shared data
uint64_t borgChecksum_ = 0;
@ -663,21 +663,22 @@ namespace test {
/**
* launch the Session Thread and start injecting Borg
* launch the Session Thread and start injecting Borgs
*/
SessionThread(function<void(DiffSource*)> notifyGUI)
: ThreadJoinable{"BusTerm_test: asynchronous diff mutation"
, [=]() {
uint cnt = rand() % MAX_RAND_BORGS;
for (uint i=0; i<cnt; ++i)
{
uint delay = rand() % MAX_RAND_DELAY;
uint id = rand() % MAX_RAND_NUMBS;
usleep (delay);
scheduleBorg (id);
notifyGUI (new BorgGenerator{*this, i});
}
}}
, [=]
{
uint cnt = rand() % MAX_RAND_BORGS;
for (uint i=0; i<cnt; ++i)
{
uint delay = rand() % MAX_RAND_DELAY;
uint id = rand() % MAX_RAND_NUMBS;
usleep (delay);
scheduleBorg (id);
notifyGUI (new BorgGenerator{*this, i});
}
}}
{ }
};
@ -685,6 +686,8 @@ namespace test {
EventLog nexusLog = stage::test::Nexus::startNewLog();
// the simulated »GUI model«
// — to be infested by hosts of Borg sent via Diff-Message...
MockElm rootMock("alpha zero");
ID rootID = rootMock.getID();

View file

@ -81087,7 +81087,9 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<node COLOR="#338800" CREATED="1696029465120" ID="ID_1705540772" MODIFIED="1696461340096" TEXT="CallQueue_test">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1696029465120" ID="ID_1782746519" MODIFIED="1696029465120" TEXT="bus-term-test.cpp (/zLumi/tests/stage)"/>
<node COLOR="#338800" CREATED="1696029465120" ID="ID_1782746519" MODIFIED="1696463320731" TEXT="BusTerm_test">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node CREATED="1696029465119" ID="ID_820648476" MODIFIED="1696029572456" TEXT="eigentliche Verwendungen">
<node CREATED="1696029465121" ID="ID_484763089" MODIFIED="1696029589510" TEXT="dummy-tick.hpp">