31using LERR_(ITER_EXHAUST);
55 ATTRIB2(
"β", int64_t(2)),
61 CHILD_T(
Time(12,34,56,78)),
64 CHILD_NODE = SUB_NODE;
141 : Source{snapshot({ins(TYPE_X)
155 CHECK (0 == instances);
158 CHECK (!isnil (diffMsg));
159 CHECK (1 == instances);
162 CHECK (ins(TYPE_X) == *diffMsg);
165 CHECK (
"ins" ==
string(diffMsg->verb()));
166 CHECK (
"type" == diffMsg->elm().idi.getSym());
167 CHECK (
"X" == diffMsg->elm().data.get<
string>());
172 CHECK (set(ATTRIB1) == *diffMsg);
173 CHECK (
"set" ==
string(diffMsg->verb()));
174 CHECK (
"α" == diffMsg->elm().idi.getSym());
175 CHECK ( 1 == diffMsg->elm().data.get<
int>());
181 CHECK (clone == diffMsg);
182 CHECK (set(ATTRIB1) == *clone);
184 CHECK (1 == instances);
187 CHECK (del(CHILD_T) == *clone);
188 CHECK (set(ATTRIB1) == *diffMsg);
189 CHECK (clone != diffMsg);
193 CHECK (isnil (clone));
199 CHECK (set(ATTRIB1) == *diffMsg);
205 CHECK (2 == instances);
207 CHECK (ins(TYPE_X) == *clone);
209 CHECK (set(ATTRIB1) == *clone);
212 CHECK (isnil (diffMsg));
215 CHECK (0 == instances);
226 CHECK (!isnil (diffMsg));
227 CHECK (ins(TYPE_X) == *diffMsg);
228 CHECK (set(ATTRIB1) == *++diffMsg);
229 CHECK (del(CHILD_T) == *++diffMsg);
230 CHECK (isnil (++diffMsg));
241 CHECK (!isnil (diffMsg));
242 CHECK (ins(TYPE_X) == *diffMsg);
243 CHECK (set(ATTRIB1) == *++diffMsg);
244 CHECK (del(CHILD_T) == *++diffMsg);
245 CHECK (isnil (++diffMsg));
255 CHECK (!isnil (diffMsg));
256 CHECK (ins(TYPE_X) == *diffMsg);
257 CHECK (set(ATTRIB1) == *++diffMsg);
258 CHECK (del(CHILD_T) == *++diffMsg);
259 CHECK (isnil (++diffMsg));
264 std::vector<DiffStep> steps;
265 CHECK (isnil (steps));
268 ,del(CHILD_T)}), steps);
272 CHECK (!isnil (diffMsg));
273 CHECK (ins(TYPE_X) == *diffMsg);
274 CHECK (set(ATTRIB1) == *++diffMsg);
275 CHECK (del(CHILD_T) == *++diffMsg);
276 CHECK (isnil (++diffMsg));
288 CHECK (
string(diffMsg) ==
"IterSource<DiffLanguage<TreeDiffInterpreter, GenNode>::DiffStep>");
291 diffMsg.updateDiagnostics();
294 string expectedRendering = join ({ins(TYPE_X), set(ATTRIB1), del(CHILD_T)});
295 CHECK (contains (
string(diffMsg), expectedRendering));
297 CHECK (
string(set(ATTRIB1)) ==
"set(GenNode-ID(\"α\")-DataCap|«int»|1)");
300 CHECK (!isnil (diffMsg));
301 CHECK (ins(TYPE_X) == *diffMsg);
302 CHECK (set(ATTRIB1) == *++diffMsg);
305 diffMsg.updateDiagnostics();
306 CHECK (not contains (
string(diffMsg),
string(ins(TYPE_X))));
307 CHECK ( contains (
string(diffMsg),
string(set(ATTRIB1))));
308 CHECK ( contains (
string(diffMsg),
string(del(CHILD_T))));
311 CHECK (del(CHILD_T) == *++diffMsg);
312 CHECK (isnil (++diffMsg));
314 diffMsg.updateDiagnostics();
315 CHECK (
string(diffMsg) ==
"Diff--{}");
382 Rec& subject = target;
388 CHECK (!isnil (subject));
389 CHECK (
"X" == subject.
getType());
390 CHECK (1 == subject.
get(
"α").data.get<
int>());
391 CHECK (2L == subject.
get(
"β").data.get<int64_t>());
392 CHECK (3.45 == subject.
get(
"γ").data.get<
double>());
393 auto scope = subject.
scope();
394 CHECK ( *scope == CHILD_A);
395 CHECK (*++scope == CHILD_T);
396 CHECK (*++scope == CHILD_T);
397 CHECK (*++scope ==
MakeRec().appendChild(CHILD_B)
398 .appendChild(CHILD_A)
400 CHECK (isnil(++scope));
404 CHECK (join (subject.
keys()) ==
"α, β, γ");
405 scope = subject.
scope();
406 CHECK ( *scope == CHILD_T);
407 CHECK (*++scope == CHILD_A);
409 CHECK (nested.
get(
"γ").data.get<
double>() == 3.45);
410 CHECK (nested.
get(
"δ") ==
MakeRec().appendChild(CHILD_A)
411 .appendChild(CHILD_A)
412 .appendChild(CHILD_A)
414 auto subScope = nested.
scope();
415 CHECK ( *subScope != CHILD_A);
416 CHECK (CHILD_A.
idi == subScope->idi);
417 CHECK (
"A" == subScope->data.get<
string>());
418 CHECK (*++subScope ==
MakeRec().type(
"Y")
419 .set(
"β", int64_t(2))
421 CHECK (*++subScope == CHILD_T);
422 CHECK (isnil (++subScope));
423 CHECK (isnil (++scope));
Standard implementation of the IterSource interface: a wrapped "Lumiera Forward Iterator".
generic builder to apply a diff description to a given target data structure.
void consume(DIFF &&diff)
object-like record of data.
Access get(string key) const
void verify_diagnostics()
void demonstrate_treeApplication()
void demonstrate_standardUsage()
MutationMessage mutationDiff()
MutationMessage populationDiff()
string const & getSym() const
materialised iterator contents.
Lumiera's internal time value datatype.
Preconfigured adapters for some STL container standard usage situations.
Generic Message with an embedded diff, to describe changes to model elements.
int instances
verify instance management
ContentSnapshot< CON > snapshot(CON const &con)
Take a snapshot of the given STL compliant container.
Implementation namespace for support and library code.
void append_all(IT iter, CON &container)
Test runner and basic definitions for tests.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
string join(COLL &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
generic data element node within a tree
Opaque message to effect a structural change on a target, which is likewise only known in an abstract...
static const Ref END
symbolic ID ref "_END_"
static const Ref ATTRIBS
symbolic ID ref "_ATTRIBS_"
A collection of frequently used helper functions to support unit testing.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
a family of time value like entities and their relationships.
Concrete implementation to apply structural changes to hierarchical data structures.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...