[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Random testing

From: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2000-09-30 19:51:15 CEST

> In general, I think tests driven by random number generators used in
> a non-deterministic way are not a great idea, because it means that
> your test results aren't reproducible. Suppose the test catches
> some rare bug --- you can't re-run it to make the bug happen again.

Sure you can. The test displays what seed it used if you don't give
it a seed. (I admit I haven't familiarized myself with the testing
framework yet, so I don't know if we have a good way to make sure this
seed is presented when there's a failure.)

Random input testing is a very valuble strategy for discovering bugs a
person wouldn't find through deterministic input. You can do a google
search on "random input testing" and find a variety of articles on the
topic.

> I'm also not sure whether every system's rand () function uses the
> same algorithm.

They do, for exactly the reasons you talked about. I don't think this
is guaranteed by the ANSI standard, but I'm pretty sure it's true.
And if you're really worried about this, we can certainly stop using
rand() in favor of our own trivial PRNG.
Received on Sat Oct 21 14:36:09 2006

This is an archived mail posted to the Subversion Dev mailing list.