| 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..13\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 | packzeros | ||||||||||
| 13 | 1 | ); | |||||||||
| 14 | |||||||||||
| 15 | 1 | $loaded = 1; | |||||||||
| 16 | 1 | print "ok 1\n"; | |||||||||
| 17 | ######################### End of black magic. | ||||||||||
| 18 | |||||||||||
| 19 | # Insert your test code below (better if it prints "ok 13" | ||||||||||
| 20 | # (correspondingly "not ok 13") depending on the success of chunk 13 | ||||||||||
| 21 | # of the test code): | ||||||||||
| 22 | |||||||||||
| 23 | 1 | $test = 2; | |||||||||
| 24 | |||||||||||
| 25 | 12 | ▶ | sub ok { | ||||||||
|
Subroutine
ok: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 12 | print "ok $test\n"; | |||||||||
| 27 | 12 | ++$test; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 1 | my @addr = qw # input expected | |||||||||
| 31 | ( D0:00:0000:0000:000:b00:0000:000 d0::b00:0:0 | ||||||||||
| 32 | 0d0:00:0000:0000:000:0b00:: d0::b00:0:0 | ||||||||||
| 33 | ::c3D4:E5d6:0:0:0:0 0:0:c3d4:e5d6:: | ||||||||||
| 34 | 0:0000:c3D4:e5d6:0:0:0:0 0:0:c3d4:e5d6:: | ||||||||||
| 35 | 0:0:0:0:0:0:0:0 :: | ||||||||||
| 36 | 0:0:: :: | ||||||||||
| 37 | ::0:000:0 :: | ||||||||||
| 38 | 0:0::1.2.3.4 ::1.2.3.4 | ||||||||||
| 39 | ::1.2.3.4 ::1.2.3.4 | ||||||||||
| 40 | ::01b2:c3D4:0:0:0:1.2.3.4 0:1b2:c3d4::1.2.3.4 | ||||||||||
| 41 | 0:0:0:0:a1B2:c3d4:: ::a1b2:c3d4:0:0 | ||||||||||
| 42 | 12:0:0:0:34:0:00:000 12::34:0:0:0 | ||||||||||
| 43 | ); | ||||||||||
| 44 | |||||||||||
| 45 | 1 | ▶ | for(my $i=0;$i<@addr;$i+=2) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 12 | my $addr = $addr[$i]; | |||||||||
| 47 | 12 | my $rv = packzeros($addr); | |||||||||
| 48 | 12 | my $exp = $addr[$i +1]; | |||||||||
| 49 | 12 | ▶ | print "got: $rv\nexp: $exp\nnot " | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | unless $rv eq $exp; | ||||||||||
| 51 | 12 | &ok; | |||||||||
| 52 | } | ||||||||||