complete unit test definition
...but this uncovers problem with handling of the type field
This commit is contained in:
parent
e5f25d8453
commit
8530d50b7c
2 changed files with 99 additions and 44 deletions
|
|
@ -620,7 +620,7 @@ namespace test{
|
|||
|
||||
// now back to parent scope....
|
||||
// ...add a new attribute and immediately recurse into it
|
||||
mutator1.injectNew (ATTRIB_NODE);
|
||||
mutator3.injectNew (ATTRIB_NODE);
|
||||
CHECK (mutator3.mutateChild (ATTRIB_NODE, placementHandle)); // NOTE: we're just recycling the buffer. InPlaceHolder handles lifecycle properly
|
||||
subMutatorBuffer->injectNew (TYPE_Z);
|
||||
subMutatorBuffer->injectNew (CHILD_A);
|
||||
|
|
@ -1101,54 +1101,49 @@ namespace test{
|
|||
CHECK (*++attrs == ATTRIB2);
|
||||
CHECK (isnil (++attrs));
|
||||
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992
|
||||
// prepare for recursion into sub scope..
|
||||
// Since this is a demonstration, we do not actually recurse into anything,
|
||||
// rather we invoke the operations on a nested mutator right from here.
|
||||
// rather we just let the binding generate a nested mutator into some buffer
|
||||
// and then we invoke the operations this nested mutator right from here.
|
||||
|
||||
InPlaceBuffer<TreeMutator, sizeof(mutator1)> subMutatorBuffer;
|
||||
TreeMutator::Handle placementHandle(subMutatorBuffer);
|
||||
|
||||
CHECK (mutator3.mutateChild (SUB_NODE, placementHandle)); // mutateChild
|
||||
|
||||
CHECK (isnil (subScopes[SUB_NODE.idi])); // ...this is where the nested mutator is expected to work on
|
||||
CHECK (not subMutatorBuffer->hasSrc());
|
||||
GenNode const& subNode = *root.scope();
|
||||
CHECK (subNode == SUB_NODE); // ...this is the sub node
|
||||
CHECK (isnil (subNode.data.get<Rec>())); // where the nested mutator is expected to work on
|
||||
|
||||
// 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 TreeDiffAplicator, 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.
|
||||
|
||||
// which was built and placed into the provided buffer
|
||||
CHECK (not subMutatorBuffer->hasSrc());
|
||||
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]) <<endl; // some new content into our implementation defined sub scope!
|
||||
Rec const& nestedRec = subNode.data.get<Rec>();
|
||||
CHECK (not isnil (nestedRec)); // ...and "magically" these instructions happened to insert
|
||||
cout << "Sub-" << renderNode(subNode) <<endl; // some new content into our implementation defined sub scope!
|
||||
|
||||
// verify contents of nested scope after mutation
|
||||
contents = stringify(eachElm(subScopes[SUB_NODE.idi]));
|
||||
CHECK ("≺type∣ξ≻" == *contents);
|
||||
++contents;
|
||||
CHECK ("≺β∣2≻" == *contents);
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣b≻"));
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣a≻"));
|
||||
++contents;
|
||||
CHECK (isnil (contents));
|
||||
cout <<"Type=="<<nestedRec.getType()<<endl; ///////////TODO Problem: type attribute not recognised!!!!
|
||||
// CHECK ("ξ" == nested.getType()); // type of nested node has been set to Xi
|
||||
attrs = nestedRec.attribs(); // look into the nested node's attributes...
|
||||
// CHECK ( *attrs == ATTRIB2);
|
||||
// CHECK ( *attrs == TYPE_X); //////////////TODO Problem: type attribute not recognised!!!!
|
||||
CHECK (*++attrs == ATTRIB2);
|
||||
CHECK (isnil (++attrs));
|
||||
scope = nestedRec.scope(); // look into the nested nodes's scope contents...
|
||||
CHECK ( *scope == CHILD_B);
|
||||
CHECK (*++scope == CHILD_A);
|
||||
CHECK (isnil (++scope)); // ...and that's all
|
||||
|
||||
|
||||
// now back to parent scope....
|
||||
// ...add a new attribute and immediately recurse into it
|
||||
mutator1.injectNew (ATTRIB_NODE);
|
||||
mutator3.injectNew (ATTRIB_NODE);
|
||||
CHECK (mutator3.mutateChild (ATTRIB_NODE, placementHandle)); // NOTE: we're just recycling the buffer. InPlaceHolder handles lifecycle properly
|
||||
subMutatorBuffer->injectNew (TYPE_Z);
|
||||
subMutatorBuffer->injectNew (CHILD_A);
|
||||
|
|
@ -1158,29 +1153,29 @@ namespace test{
|
|||
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]) <<endl;
|
||||
Rec const& attrRec = root.get("δ").data.get<Rec>();
|
||||
cout << "Att-" << renderNode(attrRec) <<endl;
|
||||
|
||||
// verify contents of this second nested scope
|
||||
contents = stringify(eachElm(subScopes[ATTRIB_NODE.idi]));
|
||||
CHECK ("≺type∣ζ≻" == *contents);
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣a≻"));
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣a≻"));
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣a≻"));
|
||||
++contents;
|
||||
CHECK (isnil (contents));
|
||||
CHECK (not isnil (attrRec));
|
||||
cout <<"Type=="<<attrRec.getType()<<endl; /////////////TODO Problem: type attribute not recognised!!!!
|
||||
// CHECK ("ζ" == attrNode.getType());
|
||||
// CHECK (isnil (attrNode.attribs())); ///////////////TODO Problem: type attribute not recognised!!!!
|
||||
scope = attrRec.scope();
|
||||
CHECK (not isnil (scope));
|
||||
CHECK ( *scope == CHILD_A);
|
||||
CHECK (*++scope == CHILD_A);
|
||||
CHECK (*++scope == CHILD_A);
|
||||
CHECK (isnil (++scope));
|
||||
|
||||
|
||||
// back to parent scope....
|
||||
// verify the marker left by our "nested sub-scope lambda"
|
||||
CHECK (contains (join(target), "Rec(--"+SUB_NODE.idi.getSym()+"--)"));
|
||||
CHECK (contains (join(target), "Rec(--"+ATTRIB_NODE.idi.getSym()+"--)"));
|
||||
// verify the parent scope indeed contains the nested elements in new shape
|
||||
CHECK (contains (renderRecord(target), renderRecord(attrRec)));
|
||||
CHECK (contains (renderRecord(target), renderRecord(nestedRec)));
|
||||
|
||||
cout << "Content after nested mutation; "
|
||||
<< join(target) <<endl;
|
||||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992
|
||||
<< renderRecord(target) <<endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4333,6 +4333,9 @@
|
|||
<node CREATED="1464305382975" ID="ID_1038582300" MODIFIED="1464305386130" TEXT="Implementierung">
|
||||
<node CREATED="1457742036967" ID="ID_980619979" MODIFIED="1457742040187" TEXT="Attribute">
|
||||
<node CREATED="1472781560508" ID="ID_1534877939" MODIFIED="1472781584718" TEXT="Selector: isNamed"/>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1472930964666" ID="ID_1394229571" MODIFIED="1472930972842" TEXT="Behandlung für Typ-Feld">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1457742040782" ID="ID_613087606" MODIFIED="1457742042442" TEXT="Kinder"/>
|
||||
<node CREATED="1472781922380" ID="ID_506316487" MODIFIED="1472781969409" TEXT="Problem: rekursiver Mutator">
|
||||
|
|
@ -4343,6 +4346,62 @@
|
|||
<icon BUILTIN="smily_bad"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1472930979111" ID="ID_1629990314" MODIFIED="1472931001117" TEXT="Problem: Typ-Feld">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1472931031568" ID="ID_1634653912" MODIFIED="1472931192300" TEXT="Kompromiß in GenNode">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<node CREATED="1472931061612" ID="ID_1482076461" MODIFIED="1472931066111" TEXT="halbherziges Design"/>
|
||||
<node CREATED="1472931066635" ID="ID_1488685471" MODIFIED="1472931074166" TEXT="wollte nicht wirklich Metadaten einführen"/>
|
||||
<node CREATED="1472931074754" ID="ID_1078549727" MODIFIED="1472931083789" TEXT="hab's daher dann fest verdrahtet"/>
|
||||
<node CREATED="1472931084281" ID="ID_358955160" MODIFIED="1472931095987" TEXT="erlaube "Abkürzung" über das Typ-Attribut"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1472931096647" ID="ID_1730961697" MODIFIED="1472931185935" TEXT="aber nicht wirklich konsequent...">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...diese Abkürzung ist nur auf den Konstruktur aufgepflanzt,
|
||||
</p>
|
||||
<p>
|
||||
nicht aber in der eigentlichen Implementierung verankert.
|
||||
</p>
|
||||
<p>
|
||||
Das wollte ich nicht, weil ich längerfristig doch davon ausgehe,
|
||||
</p>
|
||||
<p>
|
||||
daß es einfach einen Metadaten-Scope gibt
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
Die Inkonsequenz nun ist, daß im Rec::Mutator keine Magie dafür vorgesehen ist
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1472931195618" ID="ID_1075996120" MODIFIED="1472931261669" TEXT="aber Meta-Attribut für Diff">
|
||||
<node CREATED="1472931234165" ID="ID_160523779" MODIFIED="1472931239279" TEXT="geht nicht anders"/>
|
||||
<node CREATED="1472931241027" ID="ID_1519973794" MODIFIED="1472931247263" TEXT="direkte Folge des Objekt-Modells"/>
|
||||
<node CREATED="1472931391998" ID="ID_1361356376" MODIFIED="1472931394627" TEXT="betrifft">
|
||||
<node CREATED="1472931395526" ID="ID_1159599973" MODIFIED="1472931403393" TEXT="ins(type = X)"/>
|
||||
<node CREATED="1472931404525" ID="ID_1215961897" MODIFIED="1472931410552" TEXT="set(type = X)">
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1472931416323" ID="ID_1856124935" MODIFIED="1472931434577" TEXT="AUA: bisher übersehen">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1472931275575" ID="ID_158751268" MODIFIED="1472931286497" TEXT="Collection-Binding">
|
||||
<node CREATED="1472931287229" ID="ID_1702269467" MODIFIED="1472931308630" TEXT="klinkt sich unterhalb vom Mutator ein"/>
|
||||
<node CREATED="1472931309122" ID="ID_632255284" MODIFIED="1472931324740" TEXT="umgeht den Mutator"/>
|
||||
<node CREATED="1472931326512" ID="ID_150253618" MODIFIED="1472931332867" TEXT="arbeitet direkt auf den Collections"/>
|
||||
<node CREATED="1472931333975" ID="ID_330064662" MODIFIED="1472931342433" TEXT="reicht Werte unbetrachtet 1:1 durch"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1472782025318" ID="ID_387350632" MODIFIED="1472782043725" TEXT="Standard-Lambdas für GenNode">
|
||||
<node CREATED="1472782055217" ID="ID_1053081307" MODIFIED="1472782069243" TEXT="Selector -> ID-Vergleich"/>
|
||||
<node CREATED="1472782069784" ID="ID_893616200" MODIFIED="1472782075874" TEXT="Constructor -> copy"/>
|
||||
|
|
@ -4374,6 +4433,7 @@
|
|||
<node CREATED="1472830286462" ID="ID_1170732286" MODIFIED="1472830298035" TEXT="Einsicht: END und ATTRIBS können nicht scheitern">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node CREATED="1472830304844" ID="ID_354507274" MODIFIED="1472840380057" TEXT="...es geht nur um das Layer-Chaining"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue