in reply to Re: TDD: a test drive and a confession
in thread TDD: a test drive and a confession
As an alternative for the rand example, you could use the other function in the rand API.
srand( 17 ); print rand, $/ for 1 .. 5;
Since, by definition, all random numbers produced by rand are deterministic, this simplifies your test.
Of course, this approach falls down if the implementation of rand is different on different platforms. (I don't know if Perl has one internally or just bases the code on the rand provided by the C compiler.)
|
|---|