From 33534065a6d12697e36d5da48ef6593225ec597c Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 13 Aug 2016 17:50:40 +0200 Subject: [PATCH] reshape test diff to be more in line with the newly written implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...during implementation of the binding, I decided to be more strict with the interpretation of "reshaping" of attributes: since my onion-layer for attribute binding works without the notion of any 'position' or 'ordering', I made up my mind that it's best outright to reject any diff verbs attempting to re-order or delete attributes. The rationale is that otherwise the same diff might lead to substantially different results when applied to a Rec as when applied to a target data structure bound via TreeMutator. Consequently, the previously established test diff sequence would raise an error::Logic in the second segment, since it attempts to re-order attributes. Instead of this, I've now introduced a after(Ref::ATTRIBS) verb and I'm re-ordering children rather than attributes. Unfortunately this also prompts me to re-adjust all of the TreeMutatorBinding_tests, since these detail tests are intended to play the same sequence on low level. This is not a fundamental problem, though, just laborious. CHECK (target.showContent() == "α = 1, γ = 3.45, γ = 3.45, β = 2, Rec(), 78:56:34.012, b"); --- .../diff/diff-virtualised-application-test.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/library/diff/diff-virtualised-application-test.cpp b/tests/library/diff/diff-virtualised-application-test.cpp index 5de017cb6..f9a9fcf31 100644 --- a/tests/library/diff/diff-virtualised-application-test.cpp +++ b/tests/library/diff/diff-virtualised-application-test.cpp @@ -277,22 +277,20 @@ namespace test{ , ins(CHILD_B) , ins(CHILD_T) }); - } // ==> ATTRIB1, ATTRIB3, ATTRIB3, CHILD_B, CHILD_B, CHILD_T + } // ==> ATTRIB1, ATTRIB3, (ATTRIB3), CHILD_B, CHILD_B, CHILD_T DiffSeq reorderingDiff() { - return snapshot({find(ATTRIB3) - , pick(ATTRIB1) - , skip(ATTRIB3) + return snapshot({after(Ref::ATTRIBS) , ins(ATTRIB2) - , pick(ATTRIB3) , del(CHILD_B) , ins(SUB_NODE) + , find(CHILD_T) , pick(CHILD_B) - , pick(CHILD_T) + , skip(CHILD_T) }); - } // ==> ATTRIB3, ATTRIB1, ATTRIB2, ATTRIB3, SUB_NODE, CHILD_B, CHILD_T + } // ==> ATTRIB1, ATTRIB3, (ATTRIB3), ATTRIB2, SUB_NODE, CHILD_T, CHILD_B DiffSeq mutationDiff() @@ -314,10 +312,10 @@ namespace test{ , ins(CHILD_A) , emu(ATTRIB_NODE) }); - } // ==> ATTRIB3 := π, ATTRIB1, ATTRIB2, ATTRIB3, + } // ==> ATTRIB1, ATTRIB3 := π, (ATTRIB3), ATTRIB2, // ATTRIB_NODE{ type ζ, CHILD_A, CHILD_A, CHILD_A } // SUB_NODE{ type ξ, ATTRIB2, CHILD_B, CHILD_A }, - // CHILD_B, CHILD_T, + // CHILD_T, CHILD_B