Feasible Idea?: Range Tester

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 22 11:32:40 PDT 2013


On Thursday, March 21, 2013 22:03:25 Nick Sabalausky wrote:
> On Thu, 21 Mar 2013 21:55:10 -0400
> 
> "Jonathan M Davis" <jmdavisProg at gmx.com> wrote:
> > Anything else would be a change that would
> > have to be discussed, so specifically testing that a conformant range
> > throws a RangeError from popFront when it's empty (as Nick was
> > suggesting) would not be correct at this point.
> 
> I wasn't suggesting that, merely trying to list a bunch of examples of
> testable things. Clearly I got a few of the examples wrong ;)

You were suggesting it in the sense that you listed it as something to test 
for, not that you were proposing it.

> But that does kinda speak to the usefulness of having something
> standard that can be expected to actually do the *correct* tests,
> instead of all range authors just winging it on their own and
> potentially misunderstanding the rules.

Yes, though some of those are really undefined behavior (e.g. what happens when 
you call popFront on an empty range), so it wouldn't really make sense to test 
them. But having ways to test for standard behavior would make it easier to 
ensure that that behavior is actually standard.

- Jonathan M Davis


More information about the Digitalmars-d mailing list