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

Random testing

From: Jim Blandy <jimb_at_savonarola.red-bean.com>
Date: 2000-09-30 18:55:42 CEST

subversion/libsvn_delta/tests/random-test.c uses the C library's srand
function, seeded by the value returned by `apr_now ()', to generate
random files to push through the text delta generators.

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.

Essentially: tests that can't be repeated are annoying. They'll tease
you, but they won't help you.

I'm also not sure whether every system's rand () function uses the
same algorithm. So even if you used constant seeds, you might get
failure reports from someone on the net that you couldn't reproduce on
your own machine. For something like text delta generation, which is
a totally deterministic process, this kind of instability is
unnecessary.
Received on Sat Oct 21 14:36:09 2006

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