X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fsleep.t;h=c2684ad37c0a7dc92541a95bcdd60ece65570d08;hb=1c509eb921569425706e6fe39ea7cb2f11e99d1b;hp=c26d397d2f3255fe3efd15b073dadfcdc0428322;hpb=fe14fcc35f78a371a174a1d14256c2f35ae4262b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/sleep.t b/t/op/sleep.t old mode 100644 new mode 100755 index c26d397..c2684ad --- a/t/op/sleep.t +++ b/t/op/sleep.t @@ -1,8 +1,15 @@ #!./perl -# $Header: sleep.t,v 4.0 91/03/20 01:54:34 lwall Locked $ +use strict; +use warnings; +use Test::More tests=>4; -print "1..1\n"; +my $start = time; +my $sleep_says = sleep 3; +my $diff = time - $start; -$x = sleep 2; -if ($x >= 2 && $x <= 10) {print "ok 1\n";} else {print "not ok 1 $x\n";} +cmp_ok( $sleep_says, '>=', 2, 'Sleep says it slept at least 2 seconds' ); +cmp_ok( $sleep_says, '<=', 10, '... and no more than 10' ); + +cmp_ok( $diff, '>=', 2, 'Actual time diff is at least 2 seconds' ); +cmp_ok( $diff, '<=', 10, '... and no more than 10' );