Lite/Util/t/bipv6func.t

filter: Statementstmt 100% 35 / 35 Branchbran 57.1% 8 / 14 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 78.1% 50 / 64 CC 2 SCAR 3.2
CC
2
Cov
82%
END
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Lite/Util/t/4to6.t ↑ Summary Lite/Util/t/ipv6func.t »
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..27\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
BranchTrueFalseTotal
unless $loaded 0 1 1
10  
11 1 ▶use NetAddr::IP::InetBase qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
12 :upper
13 ipv6_aton
14 ipv6_n2x
15 ipv6_n2d
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 26 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
29 26 print "ok $test\n";
30 26 ++$test;
31 }
32  
33 1 my @num = # in exphex expd
34 qw(
35 :: 0:0:0:0:0:0:0:0 0:0:0:0:0:0:0.0.0.0
36 43:: 43:0:0:0:0:0:0:0 43:0:0:0:0:0:0.0.0.0
37 ::21 0:0:0:0:0:0:0:21 0:0:0:0:0:0:0.0.0.33
38 ::1:2:3:4:5:6:7 0:1:2:3:4:5:6:7 0:1:2:3:4:5:0.6.0.7
39 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:0 1:2:3:4:5:6:0.7.0.0
40 1::8 1:0:0:0:0:0:0:8 1:0:0:0:0:0:0.0.0.8
41 FF00::FFFF FF00:0:0:0:0:0:0:FFFF FF00:0:0:0:0:0:0.0.255.255
42 FFFF::FFFF:FFFF FFFF:0:0:0:0:0:FFFF:FFFF FFFF:0:0:0:0:0:255.255.255.255
43 );
44  
45 1 ▶for (my $i=0;$i<@num;$i+=3) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @num) 8 1 9
46 8 my $bits = ipv6_aton($num[$i]);
47 8 my $len = length($bits);
48 8 ▶ print "bad len = $len, exp: 16\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $len == 16 0 8 8
49 unless $len == 16; # 16 bytes x 8 bits
50 8 &ok;
51 8 my $ipv6x = ipv6_n2x($bits);
52 8 ▶ print "got: $ipv6x\nexp: $num[$i +1]\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $ipv6x eq $num[$i + 1] 0 8 8
53 unless $ipv6x eq $num[$i +1];
54 8 &ok;
55 8 my $ipv6d = ipv6_n2d($bits);
56 8 ▶ print "got: $ipv6d\nexp: $num[$i +2]\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $ipv6d eq $num[$i + 2] 0 8 8
57 unless $ipv6d eq $num[$i +2];
58 8 &ok;
59 }
60  
61 ## test 26 check bad length n2x
62 1 my $try = '1234';
63 1 my $notempty = eval {
64 1 ipv6_n2x($try);
65 };
66 1 ▶print "failed bad argument length test for ipv6_n2x\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $@ and $@ =~ /Bad arg/ 0 1 1
Condition33%1/3
$@ and $@ =~ /Bad arg/
!ll&&!rl&&r
001
MC/DC0%0/2
$@ and $@ =~ /Bad arg/
$@ $@ =~ /Bad arg/
Truth table33%1/3
A and B
A= $@B= $@ =~ /Bad arg/
ABresult
0X0
100
111
67 unless $@ && $@ =~ /Bad arg/;
68 1 &ok;
69  
70 ## test 27 check bad length n2d
71 1 $notempty = eval {
72 1 ipv6_n2d($try);
73 };
74 1 ▶print "failed bad argument length test for ipv6_n2d\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $@ and $@ =~ /Bad arg/ 0 1 1
Condition33%1/3
$@ and $@ =~ /Bad arg/
!ll&&!rl&&r
001
MC/DC0%0/2
$@ and $@ =~ /Bad arg/
$@ $@ =~ /Bad arg/
Truth table33%1/3
A and B
A= $@B= $@ =~ /Bad arg/
ABresult
0X0
100
111
75 unless $@ && $@ =~ /Bad arg/;
76 1 &ok;
« Lite/Util/t/4to6.t ↑ Summary Lite/Util/t/ipv6func.t »