xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Harness/t/sample-tests/delayed (revision b39c515898423c8d899e35282f4b395f7cad3298)
1*b39c5158Smillert# Used to test Process.pm
2*b39c5158Smillertuse Time::HiRes qw(sleep);
3*b39c5158Smillert
4*b39c5158Smillertmy $delay = 0.01;
5*b39c5158Smillert
6*b39c5158Smillert$| = 1;
7*b39c5158Smillert
8*b39c5158Smillertmy @parts = (
9*b39c5158Smillert    "1.",
10*b39c5158Smillert    ".5\n",
11*b39c5158Smillert    "ok 1 00000\n",
12*b39c5158Smillert    "ok 2\nnot",
13*b39c5158Smillert    " ok 3",
14*b39c5158Smillert    "\nok 4\nok ",
15*b39c5158Smillert    "5 00000",
16*b39c5158Smillert    ""
17*b39c5158Smillert);
18*b39c5158Smillert
19*b39c5158Smillertmy $delay_at = shift || 0;
20*b39c5158Smillert
21*b39c5158Smillertwhile (@parts) {
22*b39c5158Smillert    sleep $delay if ( $delay_at & 1 );
23*b39c5158Smillert    $delay_at >>= 1;
24*b39c5158Smillert    print shift @parts;
25*b39c5158Smillert}
26*b39c5158Smillertsleep $delay if ( $delay_at & 1 );
27