This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
split ' ', $foo: don't check end byte
[perl5.git] / t / op / sleep.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     require "./test.pl";
6     set_up_inc( qw(. ../lib) );
7 }
8
9 plan( tests => 4 );
10
11 use strict;
12 use warnings;
13
14 my $start = time;
15 my $sleep_says = sleep 3;
16 my $diff = time - $start;
17
18 cmp_ok( $sleep_says, '>=', 2,  'Sleep says it slept at least 2 seconds' );
19 cmp_ok( $sleep_says, '<=', 10, '... and no more than 10' );
20
21 cmp_ok( $diff, '>=', 2,  'Actual time diff is at least 2 seconds' );
22 cmp_ok( $diff, '<=', 10, '... and no more than 10' );