diff --git a/src/lib/diff/tree-diff-mutator-binding.cpp b/src/lib/diff/tree-diff-mutator-binding.cpp index 842ec77cc..bc6e5a7c1 100644 --- a/src/lib/diff/tree-diff-mutator-binding.cpp +++ b/src/lib/diff/tree-diff-mutator-binding.cpp @@ -285,12 +285,6 @@ namespace diff{ UNIMPLEMENTED("ensure the next source element matches with given spec"); } - bool - TreeDiffMutatorBinding::accept_until (GenNode const& refMark) - { - UNIMPLEMENTED("repeatedly accept until encountering the mark"); - } - void TreeDiffMutatorBinding::assignElm (GenNode const& n) { @@ -362,7 +356,7 @@ namespace diff{ void TreeDiffMutatorBinding::after (GenNode const& n) { - if (not accept_until(n)) + if (not treeMutator_->accept_until(n)) __fail_not_found (n); } diff --git a/src/lib/diff/tree-diff-mutator-binding.hpp b/src/lib/diff/tree-diff-mutator-binding.hpp index 71506869c..e581a2b05 100644 --- a/src/lib/diff/tree-diff-mutator-binding.hpp +++ b/src/lib/diff/tree-diff-mutator-binding.hpp @@ -292,7 +292,6 @@ namespace diff{ /* == Forwarding: mutation primitives == */ bool matchSrc (GenNode const& n); - bool accept_until (GenNode const& refMark); void assignElm (GenNode const& n); void open_subScope (GenNode const& n); void close_subScope(); diff --git a/src/lib/diff/tree-mutator-collection-binding.hpp b/src/lib/diff/tree-mutator-collection-binding.hpp index 2f799a255..079f92188 100644 --- a/src/lib/diff/tree-mutator-collection-binding.hpp +++ b/src/lib/diff/tree-mutator-collection-binding.hpp @@ -301,19 +301,18 @@ else if (binding_.isApplicable(spec)) { - bool foundTarget = true; - while (pos_ and not ChildCollectionMutator::matchSrc(spec)) + bool foundTarget = false; + while (pos_ and not binding_.matches (spec, *pos_)) { binding_.inject (move(*pos_)); ++pos_; } - if (ChildCollectionMutator::matchSrc(spec)) + if (binding_.matches (spec, *pos_)) { binding_.inject (move(*pos_)); ++pos_; + foundTarget = true; } - else - foundTarget = false; return foundTarget; } else diff --git a/tests/library/diff/diff-virtualised-application-test.cpp b/tests/library/diff/diff-virtualised-application-test.cpp index f9a9fcf31..02ce37a3c 100644 --- a/tests/library/diff/diff-virtualised-application-test.cpp +++ b/tests/library/diff/diff-virtualised-application-test.cpp @@ -83,7 +83,7 @@ namespace test{ string type_ = Rec::TYPE_NIL; int alpha_ = -1; - string beta_ = "NIL"; + int64_t beta_ = -1; double gamma_ = -1; unique_ptr delta_; @@ -167,13 +167,17 @@ namespace test{ { return not spec.isNamed(); // »Selector« : accept anything unnamed value-like }) + .matchElement ([&](GenNode const& spec, string const& elm) -> bool + { + return elm == render(spec.data); + }) .constructFrom ([&](GenNode const& spec) -> string { - return string(spec); + return render (spec.data); }) .assignElement ([&](string& target, GenNode const& spec) -> bool { - target = render(spec.data); + target = render (spec.data); return true; })) .attach (collection(nestedObj_) @@ -181,14 +185,14 @@ namespace test{ { return BOTTOM_INDICATOR != spec.data.recordType(); // »Selector« : require object-like sub scope }) - .constructFrom ([&](GenNode const& spec) -> Opaque - { - return Opaque{spec.idi}; - }) .matchElement ([&](GenNode const& spec, Opaque const& elm) -> bool { return spec.idi == elm.key_; }) + .constructFrom ([&](GenNode const& spec) -> Opaque + { + return Opaque{spec.idi}; + }) .buildChildMutator ([&](Opaque& target, GenNode::ID const& subID, TreeMutator::Handle buff) -> bool { if (target.key_ != subID) return false; // require match on already existing child object @@ -203,7 +207,7 @@ namespace test{ { alpha_ = val; }) - .change("β", [&](string val) + .change("β", [&](int64_t val) { beta_ = val; }) diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index dbb99426e..931891972 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -994,8 +994,7 @@ with multiple layers

- - + @@ -1015,8 +1014,7 @@ since skipSrc performs both the `del` and the `skip` verb, it can not perform the match itself...

- - + @@ -1055,8 +1053,7 @@ to the next lower layer in both cases, and the result and behaviour depends on this next lower layer solely

- - +
@@ -1076,8 +1073,7 @@ then move into target

- - + @@ -4417,8 +4413,9 @@ - - + + + @@ -4426,7 +4423,7 @@ - + @@ -4577,7 +4574,7 @@ - + @@ -4596,20 +4593,19 @@
  • wenn wir in einen geschachtelten Scope eintreten
  • +
  • + wenn wir einen Solchen verlassen +
  • Zwar sind indirekte Calls aufwendiger, aber letzten Endes auch wieder nicht soooo aufwendig,

    - daß sie uns im gegebenen Kontext umbringen + daß sie uns im gegebenen Kontext umbringen...

    -
      -
    • - wenn wir einen Solchen verlassen -
    • -
    -
    + +
    @@ -4753,8 +4749,8 @@
    - - + + @@ -4827,9 +4823,69 @@ - + + + + + + + + + + + + + + + + + +

    + ...das ist ein Versuch, den Code für den Leser verständlich zu halten. +

    +

    + Die Idee ist, daß es einen high-level Unit-Test gibt, der die gesamte Diff-Anwendung durchspielt +

    +

    + und dazu passend einen low-level Unit-Test, der analog die gleichen Operationen macht, +

    +

    + allerdings direkt auf dem TreeDiff-Interface durch Aufruf der passenden Primitiv-Operaionen. +

    +

    + Letztere müssen für jede Art von "onion-layer" (konkretes Binding) erneut implementiert +

    +

    + und daher auch jeweils eigens per Unit-Test abgedeckt werden. +

    + + +
    +
    + + + + + + +

    + das ist hier sinnvoll. Das Binding sollte komplexer sein, +

    +

    + als in der Praxis auftretende Bindings. Warum? Weil letztere immer etwas einseitg sind +

    +

    + und damit Abkürzungen im Code-Pfad ausnützen. Die Gefahr schlummert aber im Zusammenspiel +

    +

    + der konkreten Bindings mit mehreren "onion layers"! +

    + + +
    +