Am Sat, 27 Oct 2012 12:20:51 +0200
schrieb "Peter Alexander" <[email protected]>:
> On Friday, 26 October 2012 at 22:43:44 UTC, H. S. Teoh wrote:
> > I'm getting a bit frustrated with the Phobos bugs related to
> > ranges and
> > std.algorithm. I think we need to increase the number of
> > unittests. And
> > by that I mean, GREATLY increase the number of unittests. Most
> > of the
> > current tests are merely sanity tests for the most common usage
> > patterns, most basic types, or tests added as a result of fixed
> > bugs.
> >
> > This is inadequate.
>
> Unit tests are not the solution to this. There are too many range
> combinations and types to effectively unit test everything.
Yes and no. We can't test all possible combinations, but we should try
to at least test all code paths:
------------------
void test(R)(R range)
{
static if(isInputRange!R)
r.popFront();
else if(isForwardRange!R)
r.saev();
}
unittest
{
//Should test at least with InputRange & ForwardRange
}
-------------------
We sometimes even have templates that are not used in phobos at all
(and don't have unittests). Those are really evil as they can break
silently if some typo is introduced.