Branch Coverage

blib/lib/Crypt/ASN1.pm
Criterion Covered Total %
branch 160 212 75.4


line true false branch
25 0 4 unless my $der = pem_to_der($pem)
43 0 69 unless ref $tree eq "ARRAY"
50 0 2 unless defined $header
73 0 4 unless ref $tree eq "ARRAY"
97 58 0 defined $node->{'type'} ? :
99 58 0 defined $node->{'format'} ? :
102 18 40 if ($type eq "SEQUENCE" or $type eq "SET")
103 18 0 ref $val eq 'ARRAY' ? :
105 18 0 if $n
109 3 37 if ($type eq "CUSTOM")
110 3 0 defined $node->{'class'} ? :
111 3 0 defined $node->{'tag'} ? :
114 3 0 if ($cons and ref $val eq 'ARRAY') { }
124 37 0 exists $_LABEL{$type} ? :
131 4 33 if $type eq "NULL"
133 2 31 if ($type eq "BOOLEAN")
134 1 1 $val ? :
136 4 27 if ($type eq "INTEGER")
137 0 4 if $fmt eq "bytes"
138 4 0 defined $val ? :
139 0 4 length $s > 64 ? :
141 10 17 if ($type eq "OID")
142 10 0 defined $val ? :
143 1 9 if defined $node->{'name'}
146 2 11 if ($type eq "UTF8_STRING" or $type eq "PRINTABLE_STRING" or $type eq "IA5_STRING" or $type eq "TELETEX_STRING")
148 6 0 defined $val ? :
149 0 6 length $s > 64 ? :
151 4 7 if ($type eq "UTCTIME" or $type eq "GENERALIZEDTIME")
152 4 0 defined $val ? :
154 7 0 if ($type eq "OCTET_STRING" or $type eq "BIT_STRING")
156 3 4 if ($type eq "BIT_STRING" and defined $node->{'bits'})
161 0 0 defined $val ? :
166 0 7 unless defined $val and length $val
168 0 7 if ($fmt eq 'hex') { }
5 2 elsif ($fmt eq 'base64') { }
175 2 5 length $hex > 64 ? :
186 0 221 unless ref $node eq "HASH"
187 221 0 defined $node->{'type'} ? :
188 166 55 defined $node->{'format'} ? :
192 63 158 if ($type eq "SEQUENCE" or $type eq "SET")
193 0 63 unless ref $val eq "ARRAY"
197 25 133 if ($type eq "INTEGER")
198 0 25 unless defined $val
199 5 20 if ($fmt eq 'hex') { }
3 17 elsif ($fmt eq 'bytes') { }
204 2 3 if $neg
217 4 129 if ($type eq "BOOLEAN")
218 2 2 $val ? :
221 11 118 if ($type eq "NULL")
225 32 86 if ($type eq "OID")
226 0 32 unless defined $val
230 21 65 if ($type eq "OCTET_STRING")
235 14 51 if ($type eq "BIT_STRING")
238 13 1 exists $node->{'bits'} ? :
243 8 43 if ($type eq "UTF8_STRING")
244 8 0 defined $val ? :
246 3 38 if ($type eq "IA5_STRING" or $type eq "PRINTABLE_STRING" or $type eq "TELETEX_STRING")
247 5 0 defined $val ? :
250 16 22 if ($type eq "UTCTIME")
253 3 19 if ($type eq "GENERALIZEDTIME")
257 19 0 if ($type eq "CUSTOM")
258 19 0 defined $node->{'class'} ? :
260 2 17 unless exists $_CLASS_MAP{$class_name}
262 11 6 $node->{'constructed'} ? :
263 17 0 defined $node->{'tag'} ? :
265 11 2 if ($constr) { }
266 1 10 unless ref $val eq "ARRAY"
271 1 1 if ref $val
283 0 36 unless defined $val
284 0 36 unless defined $fmt
285 8 28 if ($fmt eq "hex")
286 2 6 unless $val =~ /\A(?:[0-9A-Fa-f]{2})*\z/
290 8 20 if ($fmt eq "base64")
291 2 6 unless $val =~ m[\A(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\z]
302 2 30 unless $oid =~ /\A\d+(?:\.\d+)+\z/
306 0 30 unless @arc >= 2
308 0 30 unless $arc[0] >= 0 and $arc[0] <= 2
310 0 30 if $arc[0] < 2 and $arc[1] > 39
312 0 30 if @arc > 64
316 18 94 $i == 1 && $arc[0] == 2 ? :
317 2 110 unless _decimal_fits_limit($arc[$i], $limit)
328 0 13 unless defined $bits
332 2 11 unless $raw =~ /\A\d+\z/
336 1 10 if $bits > $max_bits
346 3 14 unless $raw =~ /\A\d+\z/
348 1 13 unless _decimal_fits_limit($raw, $_MAX_ULONG_DEC)
358 123 3 if length $value < length $limit
359 1 2 if length $value > length $limit
365 0 2 if $bytes == 4
366 2 0 if $bytes == 8
374 0 2 if $bytes == 4
375 2 0 if $bytes == 8
384 0 19 unless defined $val
385 16 3 $kind eq 'utc' ? :
388 5 14 if ($fmt eq "epoch" or $fmt eq "" and $val =~ /^-?\d+$/)
391 5 0 if ($kind eq "utc")
392 1 4 if $year < 1950 or $year > 2049
395 4 0 $kind eq 'utc' ? :
401 10 4 if ($fmt eq "rfc3339" or $val =~ /^\d{4}-/)
402 0 10 unless $val =~ /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|([+-])(\d{2}):(\d{2}))$/
406 9 1 if ($kind eq 'utc') { }
407 1 8 if defined $fs and length $fs
409 2 6 if $YYYY < 1950 or $YYYY > 2049
411 6 0 $YYYY >= 2000 ? :
416 1 0 if defined $fs and $fs > 0
418 7 0 $tz eq 'Z' ? :