Branch Coverage

blib/lib/FusionInventory/Agent/Tools.pm
Criterion Covered Total %
branch 104 152 68.4


line true false branch
61 0 0 unless $time
93 1 67 unless $manufacturer
104 8 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)/) { }
140 1 29 unless $speed
142 0 29 if $speed =~ /^PC3200U/
144 17 12 unless $speed =~ /^([,.\d]+) \s? (\S+)$/x
149 8 0 $unit eq 'mhz' ? :
4 8 $unit eq 'ghz' ? :
160 0 7 unless $speed
162 1 6 unless $speed =~ /^([,.\d]+) \s? (\S\S)\S*$/x
167 0 0 $unit eq 'kb' ? :
0 0 $unit eq 'mb' ? :
6 0 $unit eq 'gb' ? :
179 1 356 unless $size
181 2 354 if $size =~ /^\d+$/
185 13 341 unless $size =~ /^([,.\d]+) (\S+)$/x
190 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' ? :
201 3 3 unless $major
202 2 4 unless $minor
203 2 4 unless $min_major
204 4 2 unless $min_minor
219 0 20050 unless defined $string
225 4 20046 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)
252 0 0 unless $params{'directory'}
256 0 0 unless (opendir $handle, $params{'directory'})
258 0 0 if $params{'logger'}
271 649 12 if ($params{'file'})
272 5 644 unless (open $handle, '<', $params{'file'})
275 0 5 if $params{'logger'}
280 10 2 if ($params{'command'})
283 2 8 if $params{'logger'}
288 0 10 if $FusionInventory::Agent::Tools::OSNAME eq 'solaris'
289 0 10 unless (open $handle, '-|', $params{'command'} . " 2>$nowhere")
292 0 0 if $params{'logger'}
297 2 0 if ($params{'string'})
298 0 2 unless open $handle, '<', \$params{'string'}
311 0 10 unless $handle
316 10 0 if $result
324 0 2 unless $handle
332 2 0 if $result
339 0 22 unless $params{'pattern'}
341 0 22 unless $handle
346 21 55 if @results
350 5 17 wantarray ? :
357 0 73 unless $handle
359 2 71 if (wantarray) { }
375 0 2 unless $handle
398 2 7 unless $value
399 5 2 unless $value =~ /^0x/
409 0 2 unless $value
410 1 1 unless $value =~ /^0x/
419 0 24 unless $value
420 1 23 if $value =~ /^0x/
429 31 53 if &$f()
437 2 219 unless &$f()
445 0 0 if &$f()
475 1 2 if ($params{'load'})
477 0 1 if ($FusionInventory::Agent::Tools::EVAL_ERROR)
478 0 0 if $logger
488 1 2 if $params{'timeout'}
495 0 3 ref $params{'params'} eq 'ARRAY' ? :
0 3 ref $params{'params'} eq 'HASH' ? :
499 2 1 if ($FusionInventory::Agent::Tools::EVAL_ERROR)
500 1 1 $FusionInventory::Agent::Tools::EVAL_ERROR eq "alarm\n" ? :
503 0 2 if $logger
512 0 0 if ($FusionInventory::Agent::Tools::OSNAME eq 'MSWin32') { }
524 0 0 unless open $handler, '<', $file