28#include <boost/lexical_cast.hpp>
37 using boost::lexical_cast;
42 using LERR_(ITER_EXHAUST);
55 data_.push_back(num--);
84 typedef TestSource::iterator
Iter;
101 Iter ii (source.begin());
121 cout <<
"::" << *
iter;
128 static bool takeOdd (
int i) {
return 0 != i % 2; }
129 static bool takeEve (
int i) {
return 0 == i % 2; }
130 static bool takeTrd (
int i) {
return 0 == i % 3; }
144 while (++all && ++odd)
167 typedef vector<uint64_t> Src;
168 typedef Src::iterator SrcIter;
176 SeqIter completeSequence (src.begin(), src.end());
177 FilteredSeq filterIter (completeSequence,
takeAll);
179 CHECK (!isnil (filterIter));
180 CHECK (0 == *filterIter);
182 CHECK (1 == *filterIter);
185 CHECK (!isnil (filterIter));
186 CHECK (2 == *filterIter);
188 CHECK (4 == *filterIter);
192 CHECK (!isnil (filterIter));
193 CHECK (6 == *filterIter);
195 CHECK (12 == *filterIter);
201 filterIter = {completeSequence,
takeTrd};
202 CHECK (!isnil (filterIter));
203 CHECK (0 == *filterIter);
205 CHECK (3 == *filterIter);
208 CHECK (3 == *filterIter);
210 CHECK (4 == *filterIter);
212 CHECK (6 == *filterIter);
216 filterIter.flipFilter();
217 CHECK (7 == *filterIter);
219 CHECK (11 == *filterIter);
221 CHECK (13 == *filterIter);
235 vector<uint> numberz;
239 do numberz.push_back(i);
242 CHECK (
NUM_ELMS < numberz.size(),
"no repetition in test data??");
244 typedef vector<uint>::iterator SrcIter;
248 SeqIter completeSequence (numberz.begin(), numberz.end());
252 for (; num<
NUM_ELMS and not isnil(filtered);
256 CHECK (num == *filtered);
258 CHECK (num ==
NUM_ELMS and isnil(filtered));
273 CHECK (not isnil(i1));
274 CHECK (not isnil(i2));
275 CHECK (not isnil(i3));
327 CHECK (!idi and !neg);
348 CHECK (i1 == i2); CHECK (i2 == i1);
349 CHECK (i1 != iN); CHECK (iN != i1);
350 CHECK (i2 != iN); CHECK (iN != i2);
376 Iter::value_type lastElm =
pull_last (ii);
377 CHECK (1 == lastElm);
380 CHECK (isnil (emptyIterator));
Additional capabilities for FilterIter, allowing to extend the filter condition underway.
Iterator tool filtering pulled data according to a predicate.
Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapte...
Pseudo-Iterator to yield just a single value.
Implementation namespace for support and library code.
auto filterRepetitions(IT const &source)
filters away repeated values emitted by source iterator
int rani(uint bound=_iBOUND())
IT::value_type pull_last(IT iter)
auto transformIterator(IT const &src, FUN processingFunc)
Build a TransformIter: convenience free function shortcut, picking up the involved types automaticall...
auto filterIterator(IT const &src, PRED filterPredicate)
Build a FilterIter: convenience free function shortcut, picking up the involved types automatically.
auto singleValIterator(VAL &&something)
Build a SingleValIter: convenience free function shortcut, to pick up just any value and wrap it as L...
Test runner and basic definitions for tests.
disable_if< can_IterForEach< Container >, FUN > for_each(Container const &coll, FUN doIt)
operate on all elements of a STL container.
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.
Perform operations "for each element" of a collection.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...