ChainSearch: verify proper interplay of two dynamic search conditions
This commit is contained in:
parent
84c30fe802
commit
84399aa407
2 changed files with 34 additions and 26 deletions
|
|
@ -68,7 +68,15 @@ namespace test{
|
|||
,"spam"
|
||||
};
|
||||
|
||||
} // (END)fixture
|
||||
|
||||
/** Diagnostic helper: join all the elements from a _copy_ of the iterator */
|
||||
template<class II>
|
||||
inline string
|
||||
materialise (II&& ii)
|
||||
{
|
||||
return util::join (std::forward<II> (ii), "-");
|
||||
}
|
||||
}// (END)fixture
|
||||
|
||||
|
||||
|
||||
|
|
@ -77,14 +85,6 @@ namespace test{
|
|||
cout << "typeof( " << STRINGIFY(_TY_) << " )= " << lib::meta::typeStr<_TY_>() <<endl;
|
||||
#define SHOW_EXPR(_XX_) \
|
||||
cout << "Probe " << STRINGIFY(_XX_) << " ? = " << _XX_ <<endl;
|
||||
|
||||
/** Diagnostic helper: join all the elements from a _copy_ of the iterator */
|
||||
template<class II>
|
||||
inline string
|
||||
materialise (II&& ii)
|
||||
{
|
||||
return util::join (std::forward<II> (ii), "-");
|
||||
}
|
||||
///////////////////////////////////////////////////TODO WIP
|
||||
|
||||
|
||||
|
|
@ -148,22 +148,30 @@ namespace test{
|
|||
void
|
||||
chainedIteration ()
|
||||
{
|
||||
auto search = chainSearch(SPAM)
|
||||
auto search = chainSearch(SPAM) // Note: 1st filter step picks all s-words
|
||||
.search([](string const& str){ return startsWith (str, "s"); });
|
||||
///////////////////////////////////////////////////TODO WIP
|
||||
cout << materialise (search) <<endl;
|
||||
///////////////////////////////////////////////////TODO WIP
|
||||
CHECK (search);
|
||||
|
||||
CHECK (materialise (search) =="spam-sausage-spam-spam-spam-spam");
|
||||
CHECK ("spam" == *search);
|
||||
|
||||
search.addStep([](auto& filter)
|
||||
{
|
||||
string currVal = *filter;
|
||||
filter.setNewFilter ([=](string const& val){
|
||||
return val != currVal; });
|
||||
{ // Note: pick the current value at the point
|
||||
string currVal = *filter; // where the 2nd filter step is (re)applied
|
||||
filter.setNewFilter ([=](string const& val) // ...and bake this value into the lambda closure
|
||||
{
|
||||
return val != currVal;
|
||||
});
|
||||
});
|
||||
///////////////////////////////////////////////////TODO WIP
|
||||
cout << materialise (search) <<endl;
|
||||
///////////////////////////////////////////////////TODO WIP
|
||||
|
||||
CHECK ("sausage" == *search);
|
||||
CHECK (materialise (search)
|
||||
== "sausage-bacon-tomato-and-" // everything in the rest, which is not "spam"
|
||||
"spam-spam-bacon-spam-tomato-and-spam-" // everything starting at "sausage" which is not "sausage"
|
||||
"bacon-tomato-and-" // any non-spam behind the 2nd spam
|
||||
"bacon-tomato-and-" // any non-spam behind the 3rd spam
|
||||
"tomato-and" // any non-spam behind the 4th spam
|
||||
""); // and any non-spam behind the final spam
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32336,7 +32336,7 @@
|
|||
<node COLOR="#338800" CREATED="1536958668327" ID="ID_392267635" MODIFIED="1536977591699" TEXT="keine geheimnisvollen Lambda-Closures mehr">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536958680150" ID="ID_1572201908" MODIFIED="1537022157726" TEXT="zwei Layer verwenden">
|
||||
<node COLOR="#338800" CREATED="1536958680150" FOLDED="true" ID="ID_1572201908" MODIFIED="1537043844149" TEXT="zwei Layer verwenden">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1536958702987" ID="ID_1313964418" MODIFIED="1536977597184" TEXT="Basis == trivialer Explorer">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -32345,12 +32345,12 @@
|
|||
</node>
|
||||
<node CREATED="1536958727368" ID="ID_1206856632" MODIFIED="1536958732419" TEXT="nichts mehr automatisch"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536958733950" ID="ID_374374485" MODIFIED="1537022159071" TEXT="Dekorator == Steuer-Logik">
|
||||
<node COLOR="#338800" CREATED="1536958733950" ID="ID_374374485" MODIFIED="1537043822570" TEXT="Dekorator == Steuer-Logik">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1536958744325" ID="ID_151094681" MODIFIED="1536977615339" TEXT="hält den stepChain_">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1536958772594" ID="ID_365283571" MODIFIED="1537022146845" TEXT="klinkt sich in iterNext ein">
|
||||
<node COLOR="#338800" CREATED="1536958772594" FOLDED="true" ID="ID_365283571" MODIFIED="1537043830287" TEXT="klinkt sich in iterNext ein">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1536958792215" ID="ID_519507996" MODIFIED="1536973216960" TEXT="TreeExplorer: custom-Layer">
|
||||
<arrowlink COLOR="#61afb3" DESTINATION="ID_686602920" ENDARROW="Default" ENDINCLINATION="-230;613;" ID="Arrow_ID_1710661685" STARTARROW="None" STARTINCLINATION="1241;-1305;"/>
|
||||
|
|
@ -32464,8 +32464,8 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537022195013" ID="ID_1801625619" MODIFIED="1537022214939" TEXT="Korrektheit der Auswertungs-Logik">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537022206627" ID="ID_983878679" MODIFIED="1537022215843" TEXT="mit komplexem Funktor">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1537022206627" ID="ID_983878679" MODIFIED="1537043798684" TEXT="mit komplexem Funktor">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1537022226504" ID="ID_1825074472" MODIFIED="1537024319743" TEXT="faul?">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
|
|
|||
Loading…
Reference in a new issue