From 4fb37c8172bab8e39305efdeea315085447e9b6e Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 10 Oct 2015 01:29:58 +0200 Subject: [PATCH] reorganise generation of the diff sequences for test ...just inherit from TreeDiffLanguage -- gives us the diff step ctors for free. --- .../diff/diff-tree-application-test.cpp | 119 ++++++++---------- 1 file changed, 54 insertions(+), 65 deletions(-) diff --git a/tests/library/diff/diff-tree-application-test.cpp b/tests/library/diff/diff-tree-application-test.cpp index ba6488699..2401480e2 100644 --- a/tests/library/diff/diff-tree-application-test.cpp +++ b/tests/library/diff/diff-tree-application-test.cpp @@ -58,70 +58,6 @@ namespace test{ ATTRIB_NODE = MakeRec().genNode("δ"), // empty named node to be attached as attribute δ CHILD_NODE = Ref(SUB_NODE); // use a Node-Reference as child node (!) - - using Interpreter = TreeDiffInterpreter; - using DiffStep = TreeDiffLanguage::DiffStep; - using DiffSeq = iter_stl::IterSnapshot; - - DiffStep_CTOR(ins); - DiffStep_CTOR(del); - DiffStep_CTOR(pick); - DiffStep_CTOR(find); - DiffStep_CTOR(skip); - - DiffStep_CTOR(after); - DiffStep_CTOR(mut); - DiffStep_CTOR(emu); - - - inline DiffSeq - populationDiff() - { - return snapshot({ins(TYPE_X) - , ins(ATTRIB1) - , ins(ATTRIB2) - , ins(ATTRIB3) - , ins(CHILD_A) - , ins(CHILD_T) - , ins(CHILD_T) - , ins(SUB_NODE) - , mut(SUB_NODE) - , ins(CHILD_B) - , ins(CHILD_A) - , emu(SUB_NODE) - }); - } - - - inline DiffSeq - mutationDiff() - { - return snapshot({after(Ref::ATTRIBS) - , find(CHILD_T) - , pick(CHILD_A) - , skip(CHILD_T) - , del(CHILD_T) - , pick(Ref::CHILD) - , mut(Ref::THIS) - , ins(ATTRIB3) - , ins(ATTRIB_NODE) - , find(CHILD_A) - , del(CHILD_B) - , ins(CHILD_NODE) - , ins(CHILD_T) - , skip(CHILD_A) - , mut(CHILD_NODE) - , ins(TYPE_Y) - , ins(ATTRIB2) - , emu(CHILD_NODE) - , mut(ATTRIB_NODE) - , ins(CHILD_A) - , ins(CHILD_A) - , ins(CHILD_A) - , emu(ATTRIB_NODE) - , emu(Ref::THIS) - }); - } }//(End)Test fixture @@ -141,8 +77,61 @@ namespace test{ * * @see session-structure-mapping-test.cpp */ - class DiffTreeApplication_test : public Test + class DiffTreeApplication_test + : public Test + , TreeDiffLanguage { + using DiffSeq = iter_stl::IterSnapshot; + + DiffSeq + populationDiff() + { + return snapshot({ins(TYPE_X) + , ins(ATTRIB1) + , ins(ATTRIB2) + , ins(ATTRIB3) + , ins(CHILD_A) + , ins(CHILD_T) + , ins(CHILD_T) + , ins(SUB_NODE) + , mut(SUB_NODE) + , ins(CHILD_B) + , ins(CHILD_A) + , emu(SUB_NODE) + }); + } + + + DiffSeq + mutationDiff() + { + return snapshot({after(Ref::ATTRIBS) + , find(CHILD_T) + , pick(CHILD_A) + , skip(CHILD_T) + , del(CHILD_T) + , pick(Ref::CHILD) + , mut(Ref::THIS) + , ins(ATTRIB3) + , ins(ATTRIB_NODE) + , find(CHILD_A) + , del(CHILD_B) + , ins(CHILD_NODE) + , ins(CHILD_T) + , skip(CHILD_A) + , mut(CHILD_NODE) + , ins(TYPE_Y) + , ins(ATTRIB2) + , emu(CHILD_NODE) + , mut(ATTRIB_NODE) + , ins(CHILD_A) + , ins(CHILD_A) + , ins(CHILD_A) + , emu(ATTRIB_NODE) + , emu(Ref::THIS) + }); + } + virtual void run (Arg)