36 using Extents = ExtentFamily<int, 10>;
37 using Extent = Extents::Extent;
70 Extent& extent = *extents.begin();
71 CHECK (10 == extent.size());
76 CHECK (num == extent[2]);
77 CHECK (num+5 == extent[5]);
88 CHECK ( 0 == watch(extents).first());
89 CHECK ( 0 == watch(extents).last());
90 CHECK ( 0 == watch(extents).active());
91 CHECK ( 5 == watch(extents).size());
94 CHECK ( 0 == watch(extents).first());
95 CHECK ( 3 == watch(extents).last());
96 CHECK ( 3 == watch(extents).active());
97 CHECK ( 5 == watch(extents).size());
100 CHECK ( 2 == watch(extents).first());
101 CHECK ( 3 == watch(extents).last());
102 CHECK ( 1 == watch(extents).active());
103 CHECK ( 5 == watch(extents).size());
115 CHECK (isnil (extents));
116 Iter it = extents.begin();
121 CHECK (0 == it.getIndex());
122 CHECK (isSameObject(*it, *extents.begin()));
125 CHECK (10 == extent.size());
127 int num =
rani(1000);
129 CHECK (num == extent[2]);
133 CHECK (1 == it.getIndex());
135 CHECK (not isSameObject(extent, nextEx));
136 CHECK (isSameObject(nextEx, *extents.last()));
137 nextEx[5] = extent[2] + 1;
138 CHECK (num == extent[2]);
139 CHECK (num+1 == nextEx[5]);
142 CHECK (it == extents.end());
148 it = extents.begin();
149 CHECK (isSameObject(*it, extent));
150 CHECK ((*it)[2] == num);
152 CHECK (isSameObject(*it, nextEx));
153 CHECK ((*it)[5] == num+1);
167 Probe() : val(1 +
rani(1000)) { }
168 ~Probe() { val = 0; }
173 SpecialExtents spex{3};
175 CHECK ( 0 == watch(spex).first());
176 CHECK ( 2 == watch(spex).last());
179 auto& extent = *spex.begin();
180 for (Probe& probe : extent)
183 auto calcChecksum = [](SpecialExtents::Extent& extent) ->
size_t 186 for (Probe& probe : extent)
191 size_t checksum = calcChecksum (*spex.begin());
197 CHECK ( 1 == watch(spex).first());
198 CHECK ( 2 == watch(spex).last());
201 CHECK (not isSameObject (extent, *spex.begin()));
202 size_t checkSecond = calcChecksum (*spex.begin());
203 CHECK (checkSecond != checksum);
206 CHECK (checksum == calcChecksum (extent));
210 CHECK ( 2 == watch(spex).first());
211 CHECK ( 2 == watch(spex).last());
213 CHECK ( 2 == watch(spex).first());
214 CHECK ( 1 == watch(spex).last());
216 auto iter = spex.begin();
217 CHECK ( 2 ==
iter.getIndex());
219 CHECK ( 0 == iter.getIndex());
220 CHECK (isSameObject(*iter, extent));
224 CHECK (checksum == calcChecksum (extent));
241 auto snapshotAdr = [](
Extents& extents)
243 auto takeAdr = [](
auto& x){
return &*x; };
244 return explore(extents).transform(takeAdr).effuse();
246 auto verifyAdr = [](
auto snapshot,
auto it)
248 for (
auto oldAddr : snapshot)
250 if (not isSameObject(*oldAddr, *it))
259 CHECK ( extents.empty());
260 CHECK ( 0 == watch(extents).first());
261 CHECK ( 0 == watch(extents).last());
262 CHECK ( 0 == watch(extents).active());
263 CHECK ( 5 == watch(extents).size());
266 CHECK ( 0 == watch(extents).first());
267 CHECK ( 4 == watch(extents).last());
268 CHECK ( 4 == watch(extents).active());
269 CHECK ( 5 == watch(extents).size());
271 auto snapshot = snapshotAdr(extents);
272 CHECK (4 == snapshot.size());
275 CHECK ( 0 == watch(extents).first());
276 CHECK ( 5 == watch(extents).last());
277 CHECK ( 5 == watch(extents).active());
278 CHECK (10 == watch(extents).size());
279 CHECK (verifyAdr (snapshot, extents.begin()));
282 CHECK ( 3 == watch(extents).first());
283 CHECK ( 5 == watch(extents).last());
284 CHECK ( 2 == watch(extents).active());
285 CHECK (10 == watch(extents).size());
286 CHECK (isSameObject (*extents.begin(), *snapshot.back()));
289 CHECK ( 3 == watch(extents).first());
290 CHECK ( 1 == watch(extents).last());
291 CHECK ( 8 == watch(extents).active());
292 CHECK (10 == watch(extents).size());
293 snapshot = snapshotAdr (extents);
294 CHECK (8 == snapshot.size());
297 CHECK ( 8 == watch(extents).first());
298 CHECK ( 3 == watch(extents).last());
299 CHECK (10 == watch(extents).active());
300 CHECK (15 == watch(extents).size());
301 CHECK (verifyAdr (snapshot, extents.begin()));
304 CHECK ( 3 == watch(extents).first());
305 CHECK ( 3 == watch(extents).last());
306 CHECK ( 0 == watch(extents).active());
307 CHECK (15 == watch(extents).size());
310 CHECK ( 3 == watch(extents).first());
311 CHECK ( 0 == watch(extents).last());
312 CHECK (12 == watch(extents).active());
313 CHECK (15 == watch(extents).size());
316 CHECK (14 == watch(extents).first());
317 CHECK ( 0 == watch(extents).last());
318 CHECK ( 1 == watch(extents).active());
319 CHECK (15 == watch(extents).size());
321 CHECK (14 == extents.begin().getIndex());
322 snapshot = snapshotAdr (extents);
323 CHECK (1 == snapshot.size());
324 CHECK (isSameObject (*extents.begin(), *snapshot.front()));
327 CHECK (19 == watch(extents).first());
328 CHECK (14 == watch(extents).last());
329 CHECK (15 == watch(extents).active());
330 CHECK (20 == watch(extents).size());
332 CHECK (19 == extents.begin().getIndex());
333 CHECK (isSameObject (*extents.begin(), *snapshot.front()));
logical structure of a memory Extent
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
void openNew(size_t cnt=1)
claim next cnt extents, possibly allocate.
int rani(uint bound=_iBOUND())
Abstract Base Class for all testcases.
Simplistic test class runner.
void seedRand()
draw a new random seed from a common nucleus, and re-seed the default-Gen.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
lib::IterableDecorator< IdxLink > iterator
allow transparent iteration of Extents, with the ability to expand storage
Memory manager to provide a sequence of Extents for cyclic usage.
Memory management scheme for cyclically used memory extents.
Decorator-Adapter to make a »*State Core*« iterable as Lumiera Forward Iterator.
Building tree expanding and backtracking evaluations within hierarchical scopes.
Vault-Layer implementation namespace root.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...