35 #include <boost/algorithm/string.hpp> 60 contents (vector<string>
const& strings)
62 return util::join (strings);
66 lowerCase (
string src)
68 return boost::algorithm::to_lower_copy(src);
72 caseInsensitiveEqual (
string a,
string b)
74 return lowerCase (a) == lowerCase (b);
119 std::vector<string> subject_;
120 int structChanges_ = 0;
121 int localChanges_ = 0;
135 .matchElement ([](
GenNode const& spec,
string const& elm) ->
bool 137 return caseInsensitiveEqual(elm, spec.data.get<
string>());
139 .assignElement ([](
string& target,
GenNode const& spec) ->
bool 141 target = spec.data.get<
string>();
148 .onLocalChange ([&]()
159 CHECK (isnil (subject_));
160 CHECK (0 == structChanges_);
161 CHECK (0 == localChanges_);
170 CHECK (
"a, c, d, c" == contents(subject_));
171 CHECK (1 == structChanges_);
172 CHECK (1 == localChanges_);
178 CHECK (
"a, c, D, C" == contents(subject_));
179 CHECK (1 == structChanges_);
180 CHECK (2 == localChanges_);
189 CHECK (
"a, b, D, c" == contents(subject_));
190 CHECK (2 == structChanges_);
191 CHECK (3 == localChanges_);
195 CHECK (
"a, b, D, c" == contents(subject_));
196 CHECK (2 == structChanges_);
197 CHECK (3 == localChanges_);
Concrete implementation to apply structural changes to hierarchical data structures.
Generic Message with an embedded diff, to describe changes to model elements.
void buildMutator(TreeMutator::Handle buff) override
rig the test class itself to receive a diff mutation.
Opaque message to effect a structural change on a target, which is likewise only known in an abstract...
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...
SUB & emplace(SUB &&implementation)
move-construct an instance of a subclass into the opaque buffer
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
static const Ref END
symbolic ID ref "_END_"
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
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
Marker or capability interface: an otherwise not further disclosed data structure, which can be transformed through "tree diff messages".
generic builder to apply a diff description to a given target data structure.