65 simpleAttributeBinding();
66 simpleCollectionBinding();
71 simpleAttributeBinding()
77 .change(
"data", [&](
string val)
79 cout <<
"\"data\" closure received something "<<val<<endl;
83 cout <<
"concrete TreeMutator size=" <<
sizeof(mutator)
84 <<
" type="<< typeStr(mutator)
89 CHECK (isnil (localData));
90 string testValue{
"that would be acceptable"};
91 mutator.assignElm ({
"lore", testValue});
92 CHECK ( isnil (localData));
93 mutator.assignElm ({
"data", testValue});
94 CHECK (!isnil (localData));
95 cout <<
"localData changed to: "<<localData<<endl;
96 CHECK (localData ==
"that would be acceptable");
101 simpleCollectionBinding()
104 vector<string> values;
105 values.push_back(
"a");
106 values.push_back(
"b");
108 cout << join(values) <<endl;
109 CHECK (2 == values.size());
110 CHECK (
"a, b" == join(values));
116 cout <<
"concrete TreeMutator size=" <<
sizeof(mutator)
117 <<
" type="<< typeStr(mutator)
122 CHECK (isnil (values));
123 CHECK (mutator.matchSrc (
GenNode(
"a")));
124 mutator.skipSrc (
GenNode(
"a"));
125 CHECK (mutator.matchSrc (
GenNode(
"b")));
126 CHECK (mutator.injectNew (
GenNode(
"c")));
127 CHECK (mutator.acceptSrc (
GenNode(
"b")));
129 cout << join(values) <<endl;
130 CHECK (2 == values.size());
131 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.
Simplistic 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