| 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..9\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::Util qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | simple_pack | ||||||||||
| 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 | 8 | ▶ | sub ok { | ||||||||
|
Subroutine
ok: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 8 | print "ok $test\n"; | |||||||||
| 27 | 8 | ++$test; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 1 | my @num2 = qw( | |||||||||
| 31 | 0 | ||||||||||
| 32 | 2147483648 | ||||||||||
| 33 | 140737488355328 | ||||||||||
| 34 | 9223372036854775808 | ||||||||||
| 35 | 604462909807314587353088 | ||||||||||
| 36 | 39614081257132168796771975168 | ||||||||||
| 37 | 2596148429267413814265248164610048 | ||||||||||
| 38 | 170141183460469231731687303715884105728 | ||||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | ## tests 2 - 9 check pack correct | ||||||||||
| 42 | |||||||||||
| 43 | 1 | ▶ | for (my $i=0;$i<@num2;$i++) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 8 | my $len = length($num2[$i]); | |||||||||
| 45 | 8 | my $pkd = simple_pack($num2[$i]); | |||||||||
| 46 | 8 | my $rv = unpack("H40",$pkd); | |||||||||
| 47 | 8 | $rv =~ s/^0+(\d)/$1/g; | |||||||||
| 48 | 8 | ▶ | print "got: $rv\nexp: $num2[$i]\nnot " | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | unless $rv eq $num2[$i]; | ||||||||||
| 50 | 8 | &ok; | |||||||||
| 51 | } | ||||||||||