X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fsrand.t;h=5753a5d0eb8a7d79def425872d82bc4576fa95d8;hb=e081bb54e0eecfb962e7f0cfd84fcbdb2683d54d;hp=bbd0e5484503050d4deda0c9d465dccf645edb44;hpb=97458a6ff67bc5a554449c1abcbdf1ad7278b72f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/srand.t b/t/op/srand.t index bbd0e54..5753a5d 100644 --- a/t/op/srand.t +++ b/t/op/srand.t @@ -1,9 +1,16 @@ #!./perl -w +BEGIN { + chdir "t" if -d "t"; + @INC = qw(. ../lib); +} + # Test srand. use strict; -use Test::More tests => 4; + +require "test.pl"; +plan(tests => 4); # Generate a load of random numbers. # int() avoids possible floating point error. @@ -46,6 +53,7 @@ ok( !eq_array(\@first_run, \@second_run), # This test checks whether Perl called srand for you. @first_run = `$^X -le "print int rand 100 for 1..100"`; +sleep(1); # in case our srand() is too time-dependent @second_run = `$^X -le "print int rand 100 for 1..100"`; ok( !eq_array(\@first_run, \@second_run), 'srand() called automatically');