LocationSolver: draft pattern for writing those test cases

...which shows: we also need a DSL mechanism for writing "create clauses"
This commit is contained in:
Fischlurch 2018-02-11 02:34:56 +01:00
parent 65a86bc426
commit 7a167c4c3a
2 changed files with 70 additions and 3 deletions

View file

@ -136,14 +136,58 @@ namespace test {
/** @test cover theoretical corner cases regarding the process of location solving.
* Point in question are the requirements and limits when querying against one or several
* location specification clauses. The actual matching of a location pattern against a UI topology
* is beyond scope and covered [elsewhere](\ref UICoordResolver_test::verify_mutateCoverage)
* - empty clauses act as neutral element
* - prerequisites regarding the depth of a location clause relevant for solution
* - the impact of the query and especially its expected depth
* - completely explicit clauses vs clauses with wildcards
* - relevance of partial or total coverage for the solution
* - regular clauses vs. _create clauses_ (which mandate creating parents as needed)
* - usage of the first applicable solution when several clauses are given
*/
void
verify_cornerCases()
{
UNIMPLEMENTED ("cover some corner cases");
//-------------------------------------------------------------Test-Fixture
GenNodeLocationQuery tree{MakeRec()
.set("win"
, MakeRec()
.type("A")
.set ("thePanel"
, MakeRec()
.set ("theView"
, MakeRec()
.set ("#5"
, MakeRec()
.set ("down"
, MakeRec()
.set ("the"
, MakeRec()
.set ("kitchen"
, MakeRec()
.set ("sink", MakeRec())
)
)
)
)
)
)
)};
UILocationSolver solver{tree};
//--------------------------------------------------------------(End)Test-Fixture
/* === empty clause === */
LocationRule r1 = UICoord();
CHECK (isnil (solver.solve (r1, UIC_PATH, "to/salvation")));
/* === empty clause is neutral === */
r1.append (UICoord().path("down/to/hell"));
auto s1 = solver.solve(r1, UIC_PATH+2, "well");
CHECK ("UI:win[A]-thePanel.theView.#5/down/to/hell" == string(s1));
/* === clause too short === */

View file

@ -9923,6 +9923,20 @@
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518312817798" ID="ID_473624624" MODIFIED="1518312839006">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
Schreibweise f&#252;r <i>create Clauses</i>
</p>
</body>
</html>
</richcontent>
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1517505346701" ID="ID_1733459677" MODIFIED="1518219028843" TEXT="LocationSolver einf&#xfc;hren">
<linktarget COLOR="#7999a3" DESTINATION="ID_1733459677" ENDARROW="Default" ENDINCLINATION="460;0;" ID="Arrow_ID_1447990036" SOURCE="ID_570287604" STARTARROW="None" STARTINCLINATION="-15;211;"/>
@ -10155,6 +10169,12 @@
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1517505737977" ID="ID_1981924615" MODIFIED="1517506790089" TEXT="Unit-Test">
<arrowlink COLOR="#465888" DESTINATION="ID_957265584" ENDARROW="Default" ENDINCLINATION="351;-62;" ID="Arrow_ID_1922023705" STARTARROW="None" STARTINCLINATION="-226;69;"/>
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1518312788963" ID="ID_1715641481" MODIFIED="1518312793227" TEXT="brauche Setup">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518312794346" ID="ID_98359518" MODIFIED="1518312805737" TEXT="Schreibweise f&#xfc;r create-Klauseln im Test">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
</node>
@ -10226,6 +10246,9 @@
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518312758758" ID="ID_675085959" MODIFIED="1518312769326" TEXT="Schreibweise f&#xfc;r create-Klauseln">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1515631675752" ID="ID_1586757410" MODIFIED="1515631712140" TEXT="Repr&#xe4;sentation als Liste von UICoord">
<icon BUILTIN="flag-yellow"/>
</node>
@ -10793,8 +10816,8 @@
<node CREATED="1518220764202" ID="ID_1551836374" MODIFIED="1518221675074" TEXT="geht nicht">
<icon BUILTIN="broken-line"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518220767426" ID="ID_1678897927" MODIFIED="1518221677895" TEXT="aber eine leere Klausel geht">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1518220767426" ID="ID_1678897927" MODIFIED="1518312514423" TEXT="aber eine leere Klausel geht">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1518221630349" ID="ID_748354557" MODIFIED="1518221679006" TEXT="leere Klausel plus andere">
<icon BUILTIN="flag-yellow"/>