44 using LERR_(ITER_EXHAUST);
49 using Spam = vector<string>;
68 return util::join (std::forward<II> (ii),
"-");
116 CHECK (not isnil(search));
117 CHECK (
"tomato" == *search);
118 CHECK (isSameObject (*search, SPAM[6]));
120 search.clearFilter();
121 CHECK (
"tomato" == *search);
123 CHECK (
"and" == *search);
124 search.search(
"spam");
125 CHECK (
"spam" == *search);
126 CHECK (isSameObject (*search, SPAM[8]));
130 CHECK (isnil (search));
147 .search([](
string const& str){
return startsWith (str,
"s"); });
149 CHECK (materialise (search) ==
"spam-sausage-spam-spam-spam-spam");
150 CHECK (
"spam" == *search);
152 search.addStep([](
auto& filter)
154 string currVal = *filter;
155 filter.setNewFilter ([=](
string const& val)
157 return val != currVal;
161 CHECK (
"sausage" == *search);
162 CHECK (materialise (search)
163 ==
"sausage-bacon-tomato-and-"
164 "spam-spam-bacon-spam-tomato-and-spam-"
184 using Cursor =
IterCursor<
decltype(SPAM.begin())>;
186 auto search =
chainSearch(Cursor{SPAM.begin(), SPAM.end()})
188 .addStep([](
auto& filter)
190 filter.switchBackwards();
193 .addStep([](
auto& filter)
198 CHECK (materialise (search)
204 "tomato-bacon-sausage-"
A cursor-like iterator with the ability to switch iteration direction.
Evaluation mechanism to apply a sequence of conditions onto a linear search.
An iterator with the ability to switch direction.
auto chainSearch(SRC &&srcData)
setup a chain search configuration by suitably wrapping the given container.
Implementation namespace for support and library code.
Test runner and basic definitions for tests.
bool startsWith(string const &str, string const &prefix)
check if string starts with a given prefix
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities.
string join(COLL &&coll, string const &delim=", ")
enumerate a collection's contents, separated by delimiter.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
A collection of frequently used helper functions to support unit testing.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...