This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sync with libnet 1.18
[perl5.git] / lib / Net / t / libnet_t.pl
1
2 my $number = 0;
3 sub ok {
4         my ($condition, $name) = @_;
5
6         my $message = $condition ? "ok " : "not ok ";
7         $message .= ++$number;
8         $message .= " # $name" if defined $name;
9         print $message, "\n";
10         return $condition;
11 }
12
13 sub is {
14         my ($got, $expected, $name) = @_;
15
16         for ($got, $expected) {
17                 $_ = 'undef' unless defined $_;
18         }
19
20         unless (ok($got eq $expected, $name)) {
21                 warn "Got: '$got'\nExpected: '$expected'\n" . join(' ', caller) . "\n";
22         }
23 }
24
25 sub skip {
26         my ($reason, $num) = @_;
27         $reason ||= '';
28         $number ||= 1;
29
30         for (1 .. $num) {
31                 $number++;
32                 print "ok $number # skip $reason\n";
33         }
34 }
35
36 1;
37