| 1 | # Before `make install' is performed this script should be runnable with | ||||||||||||||||||||
| 2 | # `make test'. After `make install' it should work as `perl test.pl' | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | ######################### We start with some black magic to print on failure. | ||||||||||||||||||||
| 5 | # Change 1..1 below to 1..last_test_to_print . | ||||||||||||||||||||
| 6 | # (It may become useful if the test is moved to ./t subdirectory.) | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 1 | ▶ | BEGIN { $| = 1; print "1..3\n"; } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | END {print "not ok 1\n" unless $loaded;} | ||||||||||||||||||
|
Subroutine
END: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | #use diagnostics; | ||||||||||||||||||||
| 12 | 1 | ▶ | use NetAddr::IP::Util qw( | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | :noSock6 | ||||||||||||||||||||
| 14 | naip_gethostbyname | ||||||||||||||||||||
| 15 | havegethostbyname2 | ||||||||||||||||||||
| 16 | ipv6_n2x | ||||||||||||||||||||
| 17 | inet_aton | ||||||||||||||||||||
| 18 | 1 | ); | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 1 | $loaded = 1; | |||||||||||||||||||
| 21 | 1 | print "ok 1\n"; | |||||||||||||||||||
| 22 | ######################### End of black magic. | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | # Insert your test code below (better if it prints "ok 13" | ||||||||||||||||||||
| 25 | # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||||||||||||||||||
| 26 | # of the test code): | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 1 | $test = 2; | |||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 2 | ▶ | sub ok { | ||||||||||||||||||
|
Subroutine
ok: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | 2 | print "ok $test\n"; | |||||||||||||||||||
| 32 | 2 | ++$test; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 1 | my $exp = '0:0:0:0:0:FFFF:7F00:1'; | |||||||||||||||||||
| 36 | 1 | my $host = '127.1'; | |||||||||||||||||||
| 37 | 1 | my $got = ipv6_n2x( scalar naip_gethostbyname($host)); | |||||||||||||||||||
| 38 | 1 | ▶ | print "got: $got\nexp: $exp\nnot " | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | unless $got eq $exp; | ||||||||||||||||||||
| 40 | 1 | &ok; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 1 | $exp = '0:0:0:0:0:0:0:1'; | |||||||||||||||||||
| 43 | 1 | $host = $exp; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 1 | ▶ | if (havegethostbyname2()) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 46 | 0 | $got = ipv6_n2x(scalar naip_gethostbyname($host)); | |||||||||||||||||||
| 47 | 0 | ▶ | print "got: $got\nexp: $exp\nnot " | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | unless $got eq $exp; | ||||||||||||||||||||
| 49 | } else { | ||||||||||||||||||||
| 50 | 1 | $got = scalar naip_gethostbyname($host); | |||||||||||||||||||
| 51 | 1 | ▶ | if ($got) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 52 | 0 | $got = eval{ inet_ntoa($got) } || | |||||||||||||||||||
| 53 | 0 | ▶ | eval{ ipv6_n2x($got) }; | ||||||||||||||||||
|
Condition0%0/3
eval {
do {
inet_ntoa($got)
}
} || eval {
do {
ipv6_n2x($got)
}
}
MC/DC0%0/2
eval {
do {
inet_ntoa($got)
}
} || eval {
do {
ipv6_n2x($got)
}
}
eval {
do {
inet_ntoa($got)
}
}
eval {
do {
ipv6_n2x($got)
}
}
Truth table0%0/3
A || B
A= eval {
do {
inet_ntoa($got)
}
}B= eval {
do {
ipv6_n2x($got)
}
}
| |||||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | 1 | ▶ | print "unexpected return value got: $got\nnot " | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 56 | if $got; | ||||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | 1 | &ok; | |||||||||||||||||||