- Test:
- Building blocks to map generic changes to arbitrary private data structures.
- use a dummy diagnostic implementation to verify the interface
- verify an adapter to apply structure modification to a generic collection
- use closures to translate mutation into manipulation of private attributes
- integrate the standard case of tree diff application to
Rec<GenNode>
- See also
- TreeMutator
-
TreeMutator_test
-
DiffTreeApplication_test
-
GenNode_test
-
AbstractTangible_test::mutate()
Definition at line 154 of file tree-mutator-binding-test.cpp.
◆ mutateDummy()
◆ mutateCollection()
void mutateCollection |
( |
| ) |
|
|
inlineprivate |
- Test:
- map mutation primitives onto a STL collection managed locally.
- we perform literally the same diff steps as in mutateDummy()
- but now we have a completely opaque implementation data structure, where even the data type is unknown beyond this functions's scope.
- thus we build a custom mutator, installing lambdas to tie into this local data structure, without disclosing any details. In fact we even install different lambdas on each usage cycle, according to the specific mutation operations to perform. Of course, it would be pointless to do so in real world usage, yet nicely demonstrates the point that the implementation really remains in control about anything regarding its private data structure.
- and still, by exposing such a custom configured mutator, this private structure can be populated, reordered and even altered recursively, by generic instructions.
Definition at line 363 of file tree-mutator-binding-test.cpp.
References TreeMutator::build(), lib::diff::anonymous_namespace{tree-mutator-collection-binding.hpp}::collection(), MARK_TEST_FUN, lib::operator==(), and lib::diff::anonymous_namespace{test-mutation-target.hpp}::render().
◆ mutateAttribute()
- Test:
- translate generic mutation into attribute manipulation
- here we bind directly to data fields local to this scope
- we execute the same diff primitives used in the preceding tests
- yet binding to data fields has certain intrinsic limits; due to the fixed non-dynamic nature of data fields, it is impossible to define an "ordering" and consequently there is no sequence of diff application.
- so the only form of actually applying a change is to invoke the given setter or use the given mechanism to construct a nested mutator.
Definition at line 681 of file tree-mutator-binding-test.cpp.
References TreeMutator::build(), and MARK_TEST_FUN.
◆ mutateGenNode()
- Test:
- apply mutation primitives to a GenNode tree.
- again we perform literally the same diff steps as before
- but we use the pre-configured binding for Record<GenNode>
- internally this is comprised of two collection binding layers
- we start with an empty root node, to be populated and transformed
Definition at line 957 of file tree-mutator-binding-test.cpp.
References TreeMutator::build(), and MARK_TEST_FUN.
The documentation for this class was generated from the following file: