74 simpleAttributeBinding();
75 simpleCollectionBinding();
80 simpleAttributeBinding()
86 .change(
"data", [&](
string val)
88 cout <<
"\"data\" closure received something "<<val<<endl;
92 cout <<
"concrete TreeMutator size=" <<
sizeof(mutator)
93 <<
" type="<< typeStr(mutator)
98 CHECK (isnil (localData));
99 string testValue{
"that would be acceptable"};
100 mutator.assignElm ({
"lore", testValue});
101 CHECK ( isnil (localData));
102 mutator.assignElm ({
"data", testValue});
103 CHECK (!isnil (localData));
104 cout <<
"localData changed to: "<<localData<<endl;
105 CHECK (localData ==
"that would be acceptable");
110 simpleCollectionBinding()
113 vector<string> values;
114 values.push_back(
"a");
115 values.push_back(
"b");
117 cout << join(values) <<endl;
118 CHECK (2 == values.size());
119 CHECK (
"a, b" == join(values));
125 cout <<
"concrete TreeMutator size=" <<
sizeof(mutator)
126 <<
" type="<< typeStr(mutator)
131 CHECK (isnil (values));
132 CHECK (mutator.matchSrc (
GenNode(
"a")));
133 mutator.skipSrc (
GenNode(
"a"));
134 CHECK (mutator.matchSrc (
GenNode(
"b")));
135 CHECK (mutator.injectNew (
GenNode(
"c")));
136 CHECK (mutator.acceptSrc (
GenNode(
"b")));
138 cout << join(values) <<endl;
139 CHECK (2 == values.size());
140 CHECK (
"c, b" == join(values));
Implementation namespace for support and library code.
static Builder< TreeMutator > build()
DSL: start building a custom adapted tree mutator, where the operations are tied by closures or wrapp...
#define MARK_TEST_FUN
Macro to mark the current test function in STDOUT.
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
Customisable intermediary to abstract generic tree mutation operations.
auto collection(COLL &coll)
Entry point to a nested DSL for setup and configuration of a collection binding.
generic data element node within a tree