xref: /openbsd/gnu/usr.bin/perl/t/op/sleep.t (revision 17df1aa7)
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' );
23