source: trunk/essentials/dev-lang/perl/t/op/sleep.t

Last change on this file was 3181, checked in by bird, 18 years ago

perl 5.8.8

File size: 468 bytes
Line 
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = qw(. ../lib);
6}
7
8require "test.pl";
9plan( tests => 4 );
10
11use strict;
12use warnings;
13
14my $start = time;
15my $sleep_says = sleep 3;
16my $diff = time - $start;
17
18cmp_ok( $sleep_says, '>=', 2, 'Sleep says it slept at least 2 seconds' );
19cmp_ok( $sleep_says, '<=', 10, '... and no more than 10' );
20
21cmp_ok( $diff, '>=', 2, 'Actual time diff is at least 2 seconds' );
22cmp_ok( $diff, '<=', 10, '... and no more than 10' );
Note: See TracBrowser for help on using the repository browser.