40 using std::make_shared;
42 using LERR_(ITER_EXHAUST);
43 using LERR_(INDEX_BOUNDS);
48 const uint NUM_ELMS = 10;
50 using Numz = vector<uint>;
59 for (uint i=0; i<NUM_ELMS; ++i)
96 Numz numz{makeNumz()};
99 CHECK (not isnil(i1));
103 for (uint i=*i1 ; i1; ++i1, ++i)
108 auto sum =
explore(Iter{numz}).resultSum();
109 uint n = numz.size() - 1;
110 CHECK (sum == n*(n+1)/2);
112 for (
auto & i : Iter{numz})
114 CHECK (join(numz,
"◇") ==
"1◇2◇3◇4◇5◇6◇7◇8◇9◇10"_expect);
130 Numz numz{makeNumz()};
136 CHECK (not isnil(
iter));
137 CHECK (join(
iter) ==
"4, 5, 6, 7, 8, 9"_expect);
141 CHECK (4 ==
iter.getIDX());
143 CHECK (7 ==
iter.getIDX());
144 CHECK (not isnil(
iter));
149 CHECK (join(
iter) ==
"6, 7, 8, 9"_expect);
159 CHECK (not isnil(
iter));
163 CHECK (9 ==
iter.getIDX());
165 CHECK (9 ==
iter.getIDX());
168 CHECK (isnil (empty));
181 auto smartNumz = make_shared<Numz> (makeNumz());
182 Numz & numz{*smartNumz};
183 Numz
const& const_numz{numz};
186 for (Iter
iter{numz};
191 CHECK (
iter != Iter());
194 CHECK (*
iter == i-1);
198 for (CIter
iter{const_numz};
203 CHECK (
iter != CIter());
204 CHECK (*
iter == i-1);
211 CHECK (1 == smartNumz.use_count());
213 SMIter smIter{smartNumz};
214 CIter cIter{*smartNumz};
215 CHECK (*cIter == uint(-1));
216 for (i=0; smIter; ++smIter, ++i)
219 CHECK (smIter != SMIter());
220 CHECK (*smIter == i-1);
222 CHECK (*smIter == i);
224 CHECK (isnil (smIter));
225 CHECK (smIter == SMIter());
228 CHECK (*smIter == *cIter);
233 CHECK (2 == smartNumz.use_count());
235 CHECK (1 == smartNumz.use_count());
258 CHECK (i1 == i2); CHECK (i2 == i1);
259 CHECK (i1 != iN); CHECK (iN != i1);
260 CHECK (i2 != iN); CHECK (iN != i2);
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
void verify_randomAccess()
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Implementation namespace for support and library code.
void iterTypeVariations()
Simplistic test class runner.
Iterator-style access handle to a referred container with subscript index.
Subscript-index based access to a container, packaged as iterator.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
Building tree expanding and backtracking evaluations within hierarchical scopes.
void verifyComparisons(IT const &ii)