Branch Coverage

blib/lib/FusionInventory/Agent/Tools.pm
Criterion Covered Total %
branch 105 152 69.0


line true false branch
60 0 0 unless $time
92 1 75 unless $manufacturer
103 16 59 if (exists $manufacturers{$manufacturer}) { }
15 44 elsif ($manufacturer =~ /( maxtor | sony | compaq | ibm | toshiba | fujitsu | lg | samsung | nec | transcend | matshita | hitachi | pioneer )/xi) { }
3 41 elsif ($manufacturer =~ /^(hp|HP|(?i)hewlett[ -]packard)/) { }
6 35 elsif ($manufacturer =~ /^(WDC|(?i)western)/) { }
14 21 elsif ($manufacturer =~ /^(ST|(?i)seagate)/) { }
5 16 elsif ($manufacturer =~ /^(HD|IC|HU|HGST)/) { }
139 1 29 unless $speed
141 0 29 if $speed =~ /^PC3200U/
143 17 12 unless $speed =~ /^([,.\d]+) \s? (\S+)$/x
148 8 0 $unit eq 'mhz' ? :
4 8 $unit eq 'ghz' ? :
159 0 7 unless $speed
161 1 6 unless $speed =~ /^([,.\d]+) \s? (\S\S)\S*$/x
166 0 0 $unit eq 'kb' ? :
0 0 $unit eq 'mb' ? :
6 0 $unit eq 'gb' ? :
178 1 356 unless $size
180 2 354 if $size =~ /^\d+$/
184 13 341 unless $size =~ /^([,.\d]+) (\S+)$/x
189 3 0 $unit eq 'bytes' ? :
0 3 $unit eq 'kb' ? :
278 3 $unit eq 'mb' ? :
55 281 $unit eq 'gb' ? :
5 336 $unit eq 'tb' ? :
200 3 3 unless $major
201 2 4 unless $minor
202 2 4 unless $min_major
203 4 2 unless $min_minor
218 0 24098 unless defined $string
224 4 23185 unless (&Encode::is_utf8($string) or $string =~ /\A( [\x09\x0A\x0D\x20-\x7E] # ASCII | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 )*\z/x)
251 0 0 unless $params{'directory'}
255 0 0 unless (opendir $handle, $params{'directory'})
257 0 0 if $params{'logger'}
270 650 12 if ($params{'file'})
271 5 645 unless (open $handle, '<', $params{'file'})
274 0 5 if $params{'logger'}
279 10 2 if ($params{'command'})
282 2 8 if $params{'logger'}
287 0 10 if $FusionInventory::Agent::Tools::OSNAME eq 'solaris'
288 0 10 unless (open $handle, '-|', $params{'command'} . " 2>$nowhere")
291 0 0 if $params{'logger'}
296 2 0 if ($params{'string'})
297 0 2 unless open $handle, '<', \$params{'string'}
310 0 10 unless $handle
315 10 0 if $result
323 0 2 unless $handle
331 2 0 if $result
338 0 21 unless $params{'pattern'}
340 0 21 unless $handle
345 20 54 if @results
349 5 16 wantarray ? :
356 0 73 unless $handle
358 2 71 if (wantarray) { }
374 0 2 unless $handle
397 2 7 unless $value
398 5 2 unless $value =~ /^0x/
408 1194 83 unless $value
409 1 82 unless $value =~ /^0x/
418 0 24 unless $value
419 1 23 if $value =~ /^0x/
428 31 69 if &$f()
436 4 217 unless &$f()
444 0 0 if &$f()
474 1 2 if ($params{'load'})
476 0 1 if ($FusionInventory::Agent::Tools::EVAL_ERROR)
477 0 0 if $logger
487 1 2 if $params{'timeout'}
494 0 3 ref $params{'params'} eq 'ARRAY' ? :
0 3 ref $params{'params'} eq 'HASH' ? :
498 2 1 if ($FusionInventory::Agent::Tools::EVAL_ERROR)
499 1 1 $FusionInventory::Agent::Tools::EVAL_ERROR eq "alarm\n" ? :
502 0 2 if $logger
511 0 0 if ($FusionInventory::Agent::Tools::OSNAME eq 'MSWin32') { }
523 0 0 unless open $handler, '<', $file