26 #include <boost/algorithm/string.hpp> 51 contents (vector<string>
const& strings)
53 return util::join (strings);
57 lowerCase (
string src)
59 return boost::algorithm::to_lower_copy(src);
63 caseInsensitiveEqual (
string a,
string b)
65 return lowerCase (a) == lowerCase (b);
110 std::vector<string> subject_;
111 int structChanges_ = 0;
112 int localChanges_ = 0;
126 .matchElement ([](
GenNode const& spec,
string const& elm) ->
bool 128 return caseInsensitiveEqual(elm, spec.data.get<
string>());
130 .assignElement ([](
string& target,
GenNode const& spec) ->
bool 132 target = spec.data.get<
string>();
139 .onLocalChange ([&]()
150 CHECK (isnil (subject_));
151 CHECK (0 == structChanges_);
152 CHECK (0 == localChanges_);
161 CHECK (
"a, c, d, c" == contents(subject_));
162 CHECK (1 == structChanges_);
163 CHECK (1 == localChanges_);
169 CHECK (
"a, c, D, C" == contents(subject_));
170 CHECK (1 == structChanges_);
171 CHECK (2 == localChanges_);
180 CHECK (
"a, b, D, c" == contents(subject_));
181 CHECK (2 == structChanges_);
182 CHECK (3 == localChanges_);
186 CHECK (
"a, b, D, c" == contents(subject_));
187 CHECK (2 == structChanges_);
188 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_"
Simplistic 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.