summaryrefslogtreecommitdiff
path: root/t/op/sleep.t
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2004-08-08 19:11:51 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-08-09 15:33:54 +0000
commit642c4ad7e6ff8efaa5b06b11273bd071b3f3f7f8 (patch)
tree465cf8e2cead4e66c7e9ecc243b70881ee46abfa /t/op/sleep.t
parent80b46460027bf2bee58a37ec48620576b7519f26 (diff)
downloadperl-642c4ad7e6ff8efaa5b06b11273bd071b3f3f7f8.tar.gz
Patch for t/op/sleep.t
Message-ID: <20040809051151.GA13872@petdance.com> p4raw-id: //depot/perl@23206
Diffstat (limited to 't/op/sleep.t')
-rwxr-xr-xt/op/sleep.t15
1 files changed, 11 insertions, 4 deletions
diff --git a/t/op/sleep.t b/t/op/sleep.t
index 5f6c4c0bbb..c2684ad37c 100755
--- a/t/op/sleep.t
+++ b/t/op/sleep.t
@@ -1,8 +1,15 @@
#!./perl
-# $RCSfile: sleep.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:23 $
+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 3;
-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' );