| 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..6\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 | 1 | ▶ | use NetAddr::IP::InetBase qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | :upper | ||||||||||
| 13 | ipv6_aton | ||||||||||
| 14 | inet_any2n | ||||||||||
| 15 | inet_n2dx | ||||||||||
| 16 | 1 | ); | |||||||||
| 17 | |||||||||||
| 18 | 1 | $loaded = 1; | |||||||||
| 19 | 1 | print "ok 1\n"; | |||||||||
| 20 | ######################### End of black magic. | ||||||||||
| 21 | |||||||||||
| 22 | # Insert your test code below (better if it prints "ok 13" | ||||||||||
| 23 | # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||||||||
| 24 | # of the test code): | ||||||||||
| 25 | |||||||||||
| 26 | 1 | $test = 2; | |||||||||
| 27 | |||||||||||
| 28 | 5 | ▶ | sub ok { | ||||||||
|
Subroutine
ok: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 5 | print "ok $test\n"; | |||||||||
| 30 | 5 | ++$test; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 1 | my @num = qw # input expected | |||||||||
| 34 | ( a1b2:c3d4:e5d6:f7e8:08f9:190a:2a1b:3b4c A1B2:C3D4:E5D6:F7E8:8F9:190A:2A1B:3B4C | ||||||||||
| 35 | 1.2.3.4 1.2.3.4 | ||||||||||
| 36 | A1B2:C3D4:E5D6:F7E8:08F9:190A:1.2.3.4 A1B2:C3D4:E5D6:F7E8:8F9:190A:102:304 | ||||||||||
| 37 | ::1.2.3.4 1.2.3.4 | ||||||||||
| 38 | ::FFFF:1.2.3.4 1.2.3.4 | ||||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | 1 | my $ff = ipv6_aton($num[1]); | |||||||||
| 42 | 1 | ▶ | for(my $i=0;$i<@num;$i+=2) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 5 | my $num = $num[$i]; | |||||||||
| 44 | 5 | my $bstr = inet_any2n($num); | |||||||||
| 45 | 5 | my $rv = inet_n2dx($bstr); | |||||||||
| 46 | 5 | my $exp = $num[$i +1]; | |||||||||
| 47 | 5 | ▶ | print "got: $rv\nexp: $exp\nnot " | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | unless $rv eq $exp; | ||||||||||
| 49 | 5 | &ok; | |||||||||
| 50 | } | ||||||||||