This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert t/op/die_except.t to test.pl, strict and warnings.
[perl5.git] / t / op / sleep.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = qw(. ../lib);
6 }
7
8 require "test.pl";
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' );