DiffMessage: draft test steps to drive refactoring
This commit is contained in:
parent
f6baef16c5
commit
88b2260496
2 changed files with 76 additions and 39 deletions
|
|
@ -81,24 +81,26 @@ namespace test{
|
|||
* - this covers a standard usage scenario within Lumiera, where some
|
||||
* producer in the Session core detects changes in session structure
|
||||
* and sends a message to make the UI conform to the new structure
|
||||
* - #########TODO
|
||||
* The representation is given as a linearised sequence of verb tokens.
|
||||
* In addition to the verbs used for list diffing, here we additionally
|
||||
* have to deal with nested scopes, which can be entered thorough a
|
||||
* bracketing construct \c mut(ID)...emu(ID).
|
||||
* This test demonstrates the application of such diff sequences
|
||||
* - in the first step, an empty root #Record<GenNode> is populated
|
||||
* with a type-ID, three named attribute values, three child values
|
||||
* and a nested child-Record.
|
||||
* - the second step demonstrates various diff language constructs
|
||||
* to alter, reshape and mutate this data structure
|
||||
* After applying those two diff sequences, we verify the data
|
||||
* is indeed in the expected shape.
|
||||
* @remarks to follow this test, you should be familiar both with our
|
||||
* \link diff::Record generic data record \endlink, as well as with
|
||||
* the \link diff::GenNode variant data node \endlink. The key point
|
||||
* to note is the usage of Record elements as payload within GenNode,
|
||||
* which allows to represent tree shaped object like data structures.
|
||||
* - diff messages are hard to debug and test, since they are designed
|
||||
* as opaque sequences to be consumed only once. Thus for we provide
|
||||
* a snapshot decorator to offer diagnostic facilities
|
||||
* - moreover we provide a simplified builder function to create
|
||||
* hard wired diff messages in a concise way
|
||||
* - and finally this test repeats the scenario of DiffTreeApplication_test,
|
||||
* but this time the diff sequences are encapsulated as DiffMessage.
|
||||
* @remarks like all the other _diff related_ tests, this code might be hard
|
||||
* to follow, unless you're familiar with the underlying concepts. Basically,
|
||||
* a _Diff_ is represented as _a linearised sequence of verb tokens_. Together
|
||||
* these tokens form a _diff language_. The semantics of that language are
|
||||
* oriented towards application of this diff onto a target structure. The
|
||||
* goal is to represent structure changes without being bound to a specific
|
||||
* data structure implementation. Yet there is one _meta_ data representation
|
||||
* used within the diff itself, as well as for various test and demonstration
|
||||
* examples: the [generic data record](\ref diff::Record) together with its
|
||||
* [variant node element](\ref diff::GenNode). The key point to note is the
|
||||
* (recursive) usage of Record elements as payload within GenNode, which
|
||||
* allows to represent tree shaped object like data structures.
|
||||
*
|
||||
* @see AbstractTangible_test::mutate() concrete usage scenario for UI-elements
|
||||
* @see DiffTreeApplication_test change a tree-like data structure by diff
|
||||
* @see DiffComplexApplication_test handling arbitrary data structures
|
||||
|
|
@ -110,6 +112,40 @@ namespace test{
|
|||
: public Test
|
||||
, TreeDiffLanguage
|
||||
{
|
||||
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
demonstrate_simpleUsage();
|
||||
verify_diagnostics();
|
||||
verify_builder();
|
||||
demonstrate_treeApplication();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
demonstrate_simpleUsage()
|
||||
{
|
||||
UNIMPLEMENTED("generate and iterate, everything right here");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
verify_diagnostics()
|
||||
{
|
||||
UNIMPLEMENTED("add toString decorator");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
verify_builder()
|
||||
{
|
||||
UNIMPLEMENTED("a builder function to simplify tests");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
using DiffSeq = iter_stl::IterSnapshot<DiffStep>;
|
||||
|
||||
DiffSeq
|
||||
|
|
@ -167,9 +203,10 @@ namespace test{
|
|||
}
|
||||
|
||||
|
||||
virtual void
|
||||
run (Arg)
|
||||
void
|
||||
demonstrate_treeApplication()
|
||||
{
|
||||
UNIMPLEMENTED("redo the tree-diff example, but now with diff messages");
|
||||
Rec::Mutator target;
|
||||
Rec& subject = target;
|
||||
DiffApplicator<Rec::Mutator> application(target);
|
||||
|
|
|
|||
|
|
@ -1042,25 +1042,6 @@
|
|||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1484877590492" ID="ID_1552177670" MODIFIED="1502403195805" TEXT="könnte sich später noch Ändern">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
....aber im Moment sieht das adäquat aus,
|
||||
</p>
|
||||
<p>
|
||||
da ja der Konstruktor von MutationMessage generisch (Template) ist,
|
||||
</p>
|
||||
<p>
|
||||
und man damit jedes diff-iterable einbetten kann.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1484877658891" FOLDED="true" ID="ID_1855662071" MODIFIED="1502403195805" TEXT="Vorsicht: Storage / GUI-Thread">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1484877696486" ID="ID_476867583" MODIFIED="1484877708576" TEXT="wir müssen jede Aktion in den Event-Thread übergeben"/>
|
||||
|
|
@ -1101,6 +1082,19 @@
|
|||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1502459141531" ID="ID_301431029" MODIFIED="1502459212307" TEXT="Refactoring">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1502459182214" ID="ID_1601884743" MODIFIED="1502459221104" TEXT="MutationMessage wird überflüssig">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node CREATED="1502459190477" ID="ID_102437369" MODIFIED="1502459223854" TEXT="DiffMessage übernimmt deren Rolle">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1502459198611" ID="ID_1739527989" MODIFIED="1502459229225" TEXT="aber DiffMessage wird umbenannt in MutationMessage">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1493753249399" HGAP="75" ID="ID_1023343635" MODIFIED="1502411050829" TEXT="#1098 hand-over in UI-Thread" VSHIFT="61">
|
||||
<linktarget COLOR="#a75677" DESTINATION="ID_1023343635" ENDARROW="Default" ENDINCLINATION="-317;-24;" ID="Arrow_ID_274836249" SOURCE="ID_1146157818" STARTARROW="None" STARTINCLINATION="-647;-66;"/>
|
||||
|
|
@ -11279,6 +11273,12 @@
|
|||
<node CREATED="1502453280050" ID="ID_60387485" MODIFIED="1502454672712" TEXT="DiffMessage_test">
|
||||
<linktarget COLOR="#71e5ac" DESTINATION="ID_60387485" ENDARROW="Default" ENDINCLINATION="50;-12;" ID="Arrow_ID_1384671312" SOURCE="ID_667427572" STARTARROW="None" STARTINCLINATION="12;195;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1502459245238" ID="ID_1193318639" MODIFIED="1502459280642" TEXT="Basisfall: Producer / Consumer">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node CREATED="1502459259123" ID="ID_372973959" MODIFIED="1502459264007" TEXT="Diagnose-Dekorator"/>
|
||||
<node CREATED="1502459264523" ID="ID_640036069" MODIFIED="1502459265854" TEXT="Builder"/>
|
||||
<node CREATED="1502459266371" ID="ID_883276790" MODIFIED="1502459273222" TEXT="Integrationstest"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue