TreeExplorer: unit test coverage for injected custom layer
This commit is contained in:
parent
09d923db06
commit
767156e912
2 changed files with 61 additions and 10 deletions
|
|
@ -275,6 +275,7 @@ namespace test{
|
|||
verify_expand_rootCurrent();
|
||||
verify_transformOperation();
|
||||
verify_combinedExpandTransform();
|
||||
verify_customProcessingLayer();
|
||||
verify_scheduledExpansion();
|
||||
verify_FilterIterator();
|
||||
verify_FilterChanges();
|
||||
|
|
@ -720,6 +721,50 @@ namespace test{
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* demo of a custom processing layer
|
||||
* interacting directly with the iteration mechanism.
|
||||
* @note we can assume `SRC` is itself a Lumiera Iterator
|
||||
*/
|
||||
template<class SRC>
|
||||
struct MagicTestRubbish
|
||||
: public SRC
|
||||
{
|
||||
using SRC::SRC;
|
||||
|
||||
void
|
||||
iterNext()
|
||||
{
|
||||
++(*this);
|
||||
if (*this)
|
||||
++(*this);
|
||||
}
|
||||
};
|
||||
|
||||
/** @test extension point to inject a client-defined custom processing layer
|
||||
* This special builder function allows to install a template, which needs to wrap
|
||||
* a source iterator and expose a _state core like_ interface. We demonstrate this
|
||||
* extension mechanism here by defining a processing layer which skips each other element.
|
||||
*/
|
||||
void
|
||||
verify_customProcessingLayer()
|
||||
{
|
||||
CHECK (materialise(
|
||||
treeExplore(CountDown{7})
|
||||
.processingLayer<MagicTestRubbish>()
|
||||
)
|
||||
== "7-5-3-1");
|
||||
|
||||
CHECK (materialise(
|
||||
treeExplore(CountDown{7})
|
||||
.transform([](uint v){ return 2*v; })
|
||||
.processingLayer<MagicTestRubbish>()
|
||||
.filter([](int v){ return v % 3; })
|
||||
)
|
||||
== "14-10-2");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test child expansion can be scheduled to happen on next iteration.
|
||||
* As such, _"child expansion"_ happens right away, thereby consuming a node
|
||||
|
|
|
|||
|
|
@ -31144,10 +31144,10 @@
|
|||
<node CREATED="1536713969931" ID="ID_1439776917" MODIFIED="1536714013625" TEXT="verwirft damit auch die ursprüngliche Root-Sequenz"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536958962984" ID="ID_686602920" MODIFIED="1536959121719" TEXT="custom Layer ermöglichen">
|
||||
<node COLOR="#338800" CREATED="1536958962984" FOLDED="true" ID="ID_686602920" MODIFIED="1537052569433" TEXT="custom Layer ermöglichen">
|
||||
<linktarget COLOR="#61afb3" DESTINATION="ID_686602920" ENDARROW="Default" ENDINCLINATION="-230;613;" ID="Arrow_ID_1710661685" SOURCE="ID_519507996" STARTARROW="None" STARTINCLINATION="1241;-1305;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536958972703" ID="ID_661166644" MODIFIED="1536959071081" TEXT="generische Builder-Funktion">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1536958972703" ID="ID_661166644" MODIFIED="1537050781115" TEXT="generische Builder-Funktion">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
|
|
@ -31162,16 +31162,22 @@
|
|||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536958979046" ID="ID_700334374" MODIFIED="1536959005539" TEXT="Typ per Template-Parameter übergeben">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1536958979046" ID="ID_700334374" MODIFIED="1537050782627" TEXT="Typ per Template-Parameter übergeben">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536958994212" ID="ID_1735239890" MODIFIED="1536959004851" TEXT="flexible zusätzliche Argumente">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1536958994212" ID="ID_1735239890" MODIFIED="1537050791509" TEXT="flexible zusätzliche Argumente">
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536973178765" ID="ID_1098421095" MODIFIED="1537052565699" TEXT="Unit-Test">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1536959023376" ID="ID_928142688" MODIFIED="1536973192247" TEXT="Test implizit durch IterChainSearch">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536973293197" ID="ID_858941900" MODIFIED="1537052564048" TEXT="eigens abdecken">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1536959023376" ID="ID_928142688" MODIFIED="1536959037879" TEXT="Test: durch IterChainSearch">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue