From 20c61167327116500c99b4a2c1942d5cc70abeb4 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 5 Jun 2016 16:52:37 +0200 Subject: [PATCH] draft remainder of this test case --- .../diff/tree-mutator-binding-test.cpp | 91 +++++-------------- 1 file changed, 25 insertions(+), 66 deletions(-) diff --git a/tests/library/diff/tree-mutator-binding-test.cpp b/tests/library/diff/tree-mutator-binding-test.cpp index 3083c47c1..f94dc0abe 100644 --- a/tests/library/diff/tree-mutator-binding-test.cpp +++ b/tests/library/diff/tree-mutator-binding-test.cpp @@ -835,6 +835,12 @@ namespace test{ gamma = val; }); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 + // we have two lambdas now and thus can save on the size of one function pointer.... + CHECK (sizeof(mutator1) - sizeof(mutator2) == sizeof(void*)); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 + + VERIFY_ERROR (LOGIC, mutator3.accept_until (ATTRIB3)); // rejected; no support for ordering // accept_until CHECK (not mutator3.accept_until (ATTRIB2)); // unknown binding, no one is responsible CHECK (not mutator3.accept_until (ATTRIB1)); @@ -848,7 +854,8 @@ namespace test{ CHECK (not mutator3.acceptSrc (ATTRIB1)); CHECK (not mutator3.acceptSrc (ATTRIB2)); CHECK ( mutator3.acceptSrc (ATTRIB3)); // in this round we just have a binding for ATTRIB3 (== "γ") -// CHECK ( mutator3.acceptSrc (SUB_NODE));// ...and of course a binding for SUB_NODE + CHECK ( mutator3.acceptSrc (ATTRIB_NODE)); + // ...and of course a binding for a nested ATTRIB_NODE CHECK (3.45 == gamma); CHECK (mutator3.assignElm(GAMMA_PI)); // ...we assign a new payload to the current element first // assignElm @@ -859,86 +866,38 @@ namespace test{ cout << "successfully assigned a new value." < subMutatorBuffer; + const size_t BUFF_SIZ = sizeof(TreeMutator::build().attachDummy (delta)); + + InPlaceBuffer subMutatorBuffer; TreeMutator::MutatorBuffer placementHandle(subMutatorBuffer); - CHECK (mutator3.mutateChild (SUB_NODE, placementHandle)); // mutateChild + CHECK (mutator3.mutateChild (ATTRIB_NODE, placementHandle)); // mutateChild - CHECK (isnil (subScopes[SUB_NODE.idi])); // ...this is where the nested mutator is expected to work on + CHECK (isnil (delta)); // ...this is where the nested mutator is expected to work on CHECK (not subMutatorBuffer->hasSrc()); - // now use the Mutator *interface* to talk to the nested mutator... - // This code might be confusing, because in fact we're playing two roles here! - // For one, above, in the definition of mutator3 and in the declaration of MapD subScopes, - // the test code represents what a private data structure and binding would do. - // But below we enact the TreeDiffAplicattor, which *would* use the Mutator interface - // to talk to an otherwise opaque nested mutator implementation. Actually, here this - // nested opaque mutator is created on-the-fly, embedded within the .buildChildMutator(..lambda...) - // Incidentally, we "just happen to know" how large the buffer needs to be to hold that mutator, - // since this is a topic beyond the scope of this test. In real usage, the DiffApplicator cares - // to provide a stack of suitably sized buffers for the nested mutators. + // now use the Mutator *interface* to talk to the nested mutator... subMutatorBuffer->injectNew (TYPE_X); // >> // injectNew subMutatorBuffer->injectNew (ATTRIB2); // >> // injectNew subMutatorBuffer->injectNew (CHILD_B); // >> // injectNew subMutatorBuffer->injectNew (CHILD_A); // >> // injectNew - CHECK (not isnil (subScopes[SUB_NODE.idi])); // ...and "magically" these instructions happened to insert - cout << "Sub|" << join(subScopes[SUB_NODE.idi]) <injectNew (TYPE_Z); - subMutatorBuffer->injectNew (CHILD_A); - subMutatorBuffer->injectNew (CHILD_A); - subMutatorBuffer->injectNew (CHILD_A); - CHECK (subMutatorBuffer->completeScope()); // no pending "open ends" left in sub-scope - CHECK (mutator3.completeScope()); // and likewise in the enclosing main scope - - // and thus we've gotten a second nested scope, populated with new values - cout << "Sub|" << join(subScopes[ATTRIB_NODE.idi]) <