Change 23206 by [EMAIL PROTECTED] on 2004/08/09 15:33:54
Subject: Patch for t/op/sleep.t
From: Andy Lester <[EMAIL PROTECTED]>
Date: Mon, 9 Aug 2004 00:11:51 -0500
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/t/op/sleep.t#7 edit
Differences ...
==== //depot/perl/t/op/sleep.t#7 (xtext) ====
Index: perl/t/op/sleep.t
--- perl/t/op/sleep.t#6~1575~ Sun Jul 19 18:27:14 1998
+++ perl/t/op/sleep.t Mon Aug 9 08:33:54 2004
@@ -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' );
End of Patch.