Some more tests for \N
[p5sagit/p5-mst-13.2.git] / t / op / kill0.t
CommitLineData
b84cdbe2 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
9BEGIN {
10 if ($^O eq 'riscos') {
11 skip_all("kill() not implemented on this platform");
12 }
13}
14
15use strict;
16
17plan tests => 2;
18
19ok( kill(0, $$), 'kill(0, $pid) returns true if $pid exists' );
20
21# It's not easy to come up with an individual PID that is known not to exist,
22# so just check that at least some PIDs in a large range are reported not to
23# exist.
24my $count = 0;
25my $total = 30_000;
26for my $pid (1 .. $total) {
27 ++$count if kill(0, $pid);
28}
29# It is highly unlikely that all of the above PIDs are genuinely in use,
30# so $count should be less than $total.
31ok( $count < $total, 'kill(0, $pid) returns false if $pid does not exist' );