Testing lazy ranges in post-conditions
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 24 03:31:08 PST 2014
If a function returns a lazy range, I can't verify its
correctness in the function post-condition because inside the
post-condition such range is const.
An example of the problem:
import std.range, std.algorithm;
auto foo()
out(result) {
assert(result.all!(x => x < 10));
} body {
return iota(5);
}
void main() {}
This limits the usefulness of post-conditions in my code. Do you
have ideas to solve this problem?
Bye,
bearophile
More information about the Digitalmars-d
mailing list