Lite/Util/t/hasbits.t

filter: Statementstmt 100% 19 / 19 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 93.1% 27 / 29 CC 2 SCAR 3.8
CC
2
Cov
92%
END
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Lite/t/pathological.t ↑ Summary Lite/Util/t/mode.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 1 $| = 1;
8 1 ▶END {print "1..1\nnot ok 1\n" unless $test;}
Subroutine END: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $test 0 1 1
9  
10 1 ▶use NetAddr::IP::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
11 ipv6_aton
12 ipv6_n2x
13 hasbits
14 1 );
15  
16 1 $test = 1;
17  
18 109 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
19 109 print "ok $test\n";
20 109 ++$test;
21 }
22  
23 1 my @num = qw # input
24 (
25 ::
26 8000::
27 4000::
28 2000::
29 1000::
30 800::
31 400::
32 200::
33 100::
34 80::
35 40::
36 20::
37 10::
38 1::
39 0:8000::
40 0:4000::
41 0:2000::
42 0:1000::
43 0:800::
44 0:400::
45 0:200::
46 0:100::
47 0:80::
48 0:40::
49 0:20::
50 0:10::
51 0:1::
52 0:0:8000::
53 0:0:4000::
54 0:0:2000::
55 0:0:1000::
56 0:0:800::
57 0:0:400::
58 0:0:200::
59 0:0:100::
60 0:0:80::
61 0:0:40::
62 0:0:20::
63 0:0:10::
64 0:0:1::
65 0:0:0:8000::
66 0:0:0:4000::
67 0:0:0:2000::
68 0:0:0:1000::
69 0:0:0:800::
70 0:0:0:400::
71 0:0:0:200::
72 0:0:0:100::
73 0:0:0:80::
74 0:0:0:40::
75 0:0:0:20::
76 0:0:0:10::
77 0:0:0:1::
78 ::8000:0:0:0
79 ::4000:0:0:0
80 ::2000:0:0:0
81 ::1000:0:0:0
82 ::800:0:0:0
83 ::400:0:0:0
84 ::200:0:0:0
85 ::100:0:0:0
86 ::80:0:0:0
87 ::40:0:0:0
88 ::20:0:0:0
89 ::10:0:0:0
90 ::1:0:0:0
91 ::8000:0:0
92 ::4000:0:0
93 ::2000:0:0
94 ::1000:0:0
95 ::800:0:0
96 ::400:0:0
97 ::200:0:0
98 ::100:0:0
99 ::80:0:0
100 ::40:0:0
101 ::20:0:0
102 ::10:0:0
103 ::1:0:0
104 ::8000:0
105 ::4000:0
106 ::2000:0
107 ::1000:0
108 ::800:0
109 ::400:0
110 ::200:0
111 ::100:0
112 ::80:0
113 ::40:0
114 ::20:0
115 ::10:0
116 ::1:0
117 ::8000
118 ::4000
119 ::2000
120 ::1000
121 ::800
122 ::400
123 ::200
124 ::100
125 ::80
126 ::40
127 ::20
128 ::10
129 ::1
130 ::8000:0:0:0:0
131 ::8000:0:0:0:0:0
132 ::8000:0:0:0:0:0:0
133 8000:0:0:0:0:0:0:0
134 );
135 # Insert your test code below (better if it prints "ok 13"
136 # (correspondingly "not ok 13") depending on the success of chunk 13
137 # of the test code):
138 1 print '1..',(scalar @num), "\n";
139  
140 1 foreach (@num) {
141 109 my $bstr = ipv6_aton($_);
142 109 my $rv = hasbits($bstr);
143 109 ▶ my $exp = ($_ eq '::') ? 0:1;
Branch: 1 branch
BranchTrueFalseTotal
$_ eq '::' ? : 1 108 109
144 109 ▶ print "got: $rv, exp: $exp for ", ipv6_n2x($bstr), "\nnot "
Branch: 1 branch
BranchTrueFalseTotal
unless $rv eq $exp 0 109 109
145 unless $rv eq $exp;
146 109 &ok;
147 }
« Lite/t/pathological.t ↑ Summary Lite/Util/t/mode.t »