Schwern did a testing tutorial at YAPC::Europe, and the subject of random
testing came up. The advantage of using random values for testing is that
your input tickles bugs that you weren't aware of, rather than just the
potential bugs you could think of, or people did find. The difficulty is
that tests aren't repeatable.

Except that I believe I have a way to solve that - take advantage of the fact
that rand is a pseudo random number generator. By default generate a random
seed, store it, call srand, test away.
If tests fail print out the seed before the test script exits, and you can
re-run the test with the failing random number sequence (locally) by
explicitly re-using that seed. I'm using this approach at $work, and it
performs very well. (For future experimentation, I think if it used an
external pure perl RNG then it could portably test sequences non-locally,
which is what David Hand wanted for testing a module of his)

I discussed the idea of doing this as a Test module which interface with
Test::Builder with Schwern in Munich, and he thought that it was sensible.

So I'm proposing to use the name Test::MonteCarlo, as it's somewhat like a
Monte Carlo simulation.

Is this a sensible name?

Nicholas Clark
-- 
INTERCAL better than perl?      http://www.perl.org/advocacy/spoofathon/

Reply via email to