Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MutationMessage_test Class Reference

Description

Test:
properties of a container to transport a diff from an abstracted source generator to an abstracted consumer.
  • 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
  • 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 MutationMessage.
    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 together with its variant node element. 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 also
AbstractTangible_test::mutate() concrete usage scenario for UI-elements
DiffTreeApplication_test change a tree-like data structure by diff
DiffComplexApplication_test handling arbitrary data structures
DiffListApplication_test
MutationMessage
ui-bus.hpp

Definition at line 118 of file mutation-message-test.cpp.

Private Member Functions

void demonstrate_standardUsage ()
 
void demonstrate_treeApplication ()
 
MutationMessage mutationDiff ()
 
MutationMessage populationDiff ()
 
virtual void run (Arg)
 
void verify_builder ()
 
void verify_diagnostics ()
 
- Private Member Functions inherited from TreeDiffLanguage
 DiffStep_CTOR (ins)
 
 DiffStep_CTOR (del)
 
 DiffStep_CTOR (pick)
 
 DiffStep_CTOR (find)
 
 DiffStep_CTOR (skip)
 
 DiffStep_CTOR (after)
 
 DiffStep_CTOR (set)
 
 DiffStep_CTOR (mut)
 
 DiffStep_CTOR (emu)
 

Additional Inherited Members

- Private Types inherited from TreeDiffLanguage
using Interpreter = TreeDiffInterpreter
 
- Private Types inherited from DiffLanguage< TreeDiffInterpreter, GenNode >
using DiffToken = std::tuple< DiffVerb, GenNode >
 
using DiffVerb = VerbToken< TreeDiffInterpreter, void(GenNodeconst &)>
 
using Interpreter = TreeDiffInterpreter
 
- Static Private Attributes inherited from DiffLanguage< TreeDiffInterpreter, GenNode >
static const DiffStep NIL
 fixed "invalid" marker token More...
 

Member Function Documentation

virtual void run ( Arg  )
inlineprivatevirtual

Definition at line 124 of file mutation-message-test.cpp.

References MutationMessage_test::demonstrate_standardUsage(), MutationMessage_test::demonstrate_treeApplication(), MutationMessage_test::verify_builder(), and MutationMessage_test::verify_diagnostics().

+ Here is the call graph for this function:

void demonstrate_standardUsage ( )
inlineprivate
Test:
demonstrate the intended usage pattern
  • a diff generation context is allocated
  • the MutationMessage takes ownership
  • and exposes the generated diff sequence
  • which is pulled during iteration

Definition at line 140 of file mutation-message-test.cpp.

References util::isnil(), lib::iter_stl::snapshot(), and VERIFY_ERROR.

Referenced by MutationMessage_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void verify_builder ( )
inlineprivate

Definition at line 229 of file mutation-message-test.cpp.

References lib::append_all(), util::isnil(), lib::iter_stl::snapshot(), and VERIFY_ERROR.

Referenced by MutationMessage_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void verify_diagnostics ( )
inlineprivate

Definition at line 290 of file mutation-message-test.cpp.

References util::contains(), util::isnil(), and util::join().

Referenced by MutationMessage_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

MutationMessage populationDiff ( )
inlineprivate

Definition at line 332 of file mutation-message-test.cpp.

Referenced by MutationMessage_test::demonstrate_treeApplication().

+ Here is the caller graph for this function:

MutationMessage mutationDiff ( )
inlineprivate

Definition at line 351 of file mutation-message-test.cpp.

References Ref::ATTRIBS, Ref::END, and proc::mobject::session::test::find().

Referenced by MutationMessage_test::demonstrate_treeApplication().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void demonstrate_treeApplication ( )
inlineprivate
Test:
use MutationMessage to transport and apply changes to target data
Remarks
this almost literally repeats the DiffTreeApplication_test

Definition at line 388 of file mutation-message-test.cpp.

References Record< VAL >::Mutator::appendChild(), DiffApplicator< TAR >::consume(), data, Record< VAL >::Mutator::genNode(), Record< VAL >::get(), Record< VAL >::getType(), util::isnil(), util::join(), Record< VAL >::keys(), MutationMessage_test::mutationDiff(), MutationMessage_test::populationDiff(), and Record< VAL >::scope().

Referenced by MutationMessage_test::run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

+ Inheritance diagram for MutationMessage_test:
+ Collaboration diagram for MutationMessage_test:

The documentation for this class was generated from the following file: