From 37f4caf7bec750d59a0c2e7937bb8dd66b551ba1 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 10 Jun 2016 04:30:02 +0200 Subject: [PATCH] draft data structure for the integration test to work on the idea is to demonstrate the typical situation of some implementation class, which offers to create a binding for diff messages. This alone is sufficient to allow mapping onto our "External Tree Description" --- .../diff-virtualised-application-test.cpp | 47 ++++++++++++++++++- .../diff/tree-mutator-binding-test.cpp | 2 +- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/tests/library/diff/diff-virtualised-application-test.cpp b/tests/library/diff/diff-virtualised-application-test.cpp index 6e0cde9a0..d6f531e93 100644 --- a/tests/library/diff/diff-virtualised-application-test.cpp +++ b/tests/library/diff/diff-virtualised-application-test.cpp @@ -27,15 +27,20 @@ #include "lib/iter-adapter-stl.hpp" #include "lib/time/timevalue.hpp" #include "lib/format-cout.hpp" //////////TODO necessary? -#include "lib/format-util.hpp" +#include "lib/format-string.hpp" +//#include "lib/format-util.hpp" #include "lib/util.hpp" #include #include +#include using lib::iter_stl::snapshot; using util::isnil; using util::join; +using util::_Fmt; +using util::join; +using std::unique_ptr; using std::string; using std::vector; using lib::time::Time; @@ -60,7 +65,42 @@ namespace test{ CHILD_T(Time(12,34,56,78)), // unnamed time value child SUB_NODE = MakeRec().genNode(), // empty anonymous node used to open a sub scope ATTRIB_NODE = MakeRec().genNode("δ"), // empty named node to be attached as attribute δ - GAMMA_PI("γ", 3.14159265); // happens to have the same identity (ID) as ATTRIB3AS + GAMMA_PI("γ", 3.14159265); // happens to have the same identity (ID) as ATTRIB3 + + + /** + * opaque private data structure to apply the diff. + * This class offers to build a binding for diff messages, + * which basically maps its internal structures onto the + * generic "object" scheme underlying the diff language. + */ + class Opaque + { + int alpha_ = -1; + string beta_ = "NIL"; + double gamma_ = -1; + + unique_ptr delta_; + + vector nestedObj_; + vector nestedData_; + + public: + Opaque() { } + + operator string() const + { + return _Fmt{"%s (α:%d β:%s γ:%7.5f δ:%s\n......|nested:%s\n......|data:%s\n )"} + % idi::instanceTypeID (this) + % alpha_ + % beta_ + % gamma_ + % delta_ + % join (nestedObj_, "\n......|") + % join (nestedData_) + ; + } + }; }//(End)Test fixture @@ -158,6 +198,9 @@ namespace test{ run (Arg) { /////////////////////////////TODO we need a suitable test datastructure. What follows is just placeholder code. As of 4/2016, this test waits for the completion of the TreeMutator + Opaque opa; + cout << opa < application(target); diff --git a/tests/library/diff/tree-mutator-binding-test.cpp b/tests/library/diff/tree-mutator-binding-test.cpp index e15c1f584..5795aa2be 100644 --- a/tests/library/diff/tree-mutator-binding-test.cpp +++ b/tests/library/diff/tree-mutator-binding-test.cpp @@ -69,7 +69,7 @@ namespace test{ CHILD_T(Time(12,34,56,78)), // unnamed time value child SUB_NODE = MakeRec().genNode(), // empty anonymous node used to open a sub scope ATTRIB_NODE = MakeRec().genNode("δ"), // empty named node to be attached as attribute δ - GAMMA_PI("γ", 3.14159265); // happens to have the same identity (ID) as ATTRIB3AS + GAMMA_PI("γ", 3.14159265); // happens to have the same identity (ID) as ATTRIB3 }//(End)Test fixture