Branch Coverage

blib/lib/MIDI/SoundFont.pm
Criterion Covered Total %
branch 118 278 42.4


line true false branch
106 0 2 if ($_[0] eq '-') { }
0 2 elsif ($_[0] =~ m[^[a-z]+:/]) { }
0 2 elsif (ref $_[0] eq 'GLOB') { }
110 0 0 if ($@)
114 0 0 unless (defined $bytes)
121 0 2 unless (open F, '<:raw', $_[0])
141 0 0 unless (open P, '<', \$bytes)
156 0 2 unless (open P, '<', \$bytes)
170 2 18 unless (defined $chunk)
173 2 16 if ($id eq 'ifil' or $id eq 'iver') { }
184 2 18 unless (defined $chunk)
190 0 2 unless ($pdta{'phdr'})
191 0 2 if ($len % 38)
221 0 2 unless ($pdta{'pbag'})
222 0 2 if ($len % 4)
238 0 2 unless ($pdta{'pmod'})
239 0 2 if ($len % 10)
259 0 2 unless ($pdta{'inst'})
260 0 2 if ($len % 22)
284 0 2 unless ($pdta{'ibag'})
285 0 2 if ($len % 4)
311 0 2 unless ($pdta{'imod'})
312 0 2 if ($len % 10)
332 0 2 unless ($pdta{'shdr'})
333 0 2 if ($len % 46)
355 332 2 if ($achSampleName ne 'EOS')
376 0 2 unless ($pdta{'igen'})
377 0 2 if ($len % 4)
386 0 8186 unless (defined $type)
389 0 8186 if ($sfGenOper == 41) { }
792 7394 elsif ($sfGenOper == 53) { }
0 7394 elsif ($type eq 'x') { }
772 6622 elsif ($type eq 'C2') { }
417 0 2 unless ($pdta{'pgen'})
418 0 2 if ($len % 4)
427 0 7416 unless (defined $type)
430 2 7414 if ($OnlyValidInInstr{$sfGenOper}) { }
1550 5864 elsif ($sfGenOper == 41) { }
0 5864 elsif ($type eq 'x') { }
1010 4854 elsif ($type eq 'C2') { }
458 7414 0 if (defined $pgen_list[$j]{'shAmount'})
521 2 0 if ($phdr_list[$#phdr_list]{'achPresetName'} eq 'EOP')
523 2 0 if ($inst_list[$#inst_list]{'achInstName'} eq 'EOI')
543 0 2 if ($debug)
618 0 0 unless ($file)
620 0 0 if (ref $file eq 'GLOB') { }
0 0 elsif ($file eq '-') { }
623 0 0 unless (open F, '>', $file)
652 0 1 if ($sf{'irom'})
659 0 1 if ($sf{'iver'} and $sf{'iver'} =~ /^(\d+)\.(\d+)$/)
666 1 0 if ($sf{'ICRD'})
673 1 0 if ($sf{'IENG'})
680 1 0 if ($sf{'IPRD'})
687 1 0 if ($sf{'ICOP'})
694 1 0 if ($sf{'ICMT'})
703 1 0 if ($sf{'ISFT'}) { }
761 775 2932 if ($$g_ref[0] == 41)
763 693 82 if (defined $inst_name2index{$inst_name}) { }
836 396 3696 if ($$g_ref[0] == 53)
838 230 166 if (defined $smpl_name2index{$samplename}) { }
916 0 1 unless (open P, '>', \$bytes)
931 0 7818 unless (defined $type)
934 0 7818 if ($sfGenOper == 41 and $is_p_or_i eq 'i')
937 0 7818 if ($sfGenOper == 53 and $is_p_or_i eq 'p')
940 0 7818 if ($OnlyValidInInstr{$sfGenOper} and $is_p_or_i eq 'p')
945 0 7818 if ($type eq 'x') { }
892 6926 elsif ($type eq 'C2') { }
1172 5754 elsif ($sfGenOper == 41 or $sfGenOper == 53) { }
948 892 0 if ($sfGenOper == 43) { }
960 1172 278 if ($last_item)
974 0 0 unless (defined $data)
979 0 0 if ($SampleName{$sample_name})
984 0 0 unless ($SampleName{$sample_name})
988 0 0 if ($opt{'noloop'}) { }
1008 0 0 unless (-e $file)
1009 0 0 unless (-f $file)
1010 0 0 unless (-r $file)
1014 0 0 unless (open P, '-|', 'soxi', $file)
1019 0 0 if (/^Channels\s+:\s*(\d+)/)
1020 0 0 if (/^Sample Rate\s+:\s*(\d+)/)
1024 0 0 if ($channels == 1) { }
1025 0 0 unless (open P, '-|', "sox '${file}' -t raw -c 1 -b 16 -e signed -")
1029 0 0 unless (open P, "sox '${file}' -t raw -c 1 -b 16 -e signed - remix 1,2 |")
1090 0 0 if (defined $$sr{'dwStart'}) { }
0 0 elsif (defined $$sr{'mode'}) { }
1106 0 0 if ($MODES_UNSIGNED and $$sr{'data'}) { }
1132 0 0 if ($data[$i] == 0) { }
0 0 elsif ($data[$i - 1] > 0 and $data[$i] < 0) { }
0 0 elsif ($data[$i - 1] < 0 and $data[$i] > 0) { }
1133 0 0 if ($data[$i - 1] > 0 and $data[$i + 1] < 0) { }
0 0 elsif ($data[$i - 1] < 0 and $data[$i + 1] > 0) { }
1150 0 0 if ($goodness > $best_goodness)
1158 0 0 if ($goodness > $best_goodness)
1201 0 0 if ($x > 0)
1202 0 0 if ($x < 0)
1210 1 1 if ($file_type eq 'pat') { }
1 0 elsif ($file_type eq 'zip') { }
1213 0 1 if ($@)
1219 0 1 if ($@)
1225 0 1 if ($zip->read($file) != 0)
1231 1 60 unless ($memberName =~ /\.pat$/)
1243 0 0 if ($@)
1396 0 0 unless ($file)
1398 0 0 unless (%gravis)
1400 0 0 if ($@)
1405 0 0 if ($n_pat_names != 1 and $file =~ /\.pat/)
1408 0 0 if ($file =~ /\.pat/) { }
0 0 elsif ($file =~ /\.zip/) { }
1410 0 0 unless ($bytes)
1411 0 0 unless (open F, '>', $file)
1414 0 0 if ($@)
1420 0 0 if (0 == length $bytes)
1421 0 0 if ($bytes)
1423 0 0 if ($zip->overwriteAs($file) != 0)
1481 0 3 if ($@)
1485 1 2 if ($sf_or_gr{'ifil'}) { }
1495 2 202 if ($bank != $current_bank)
1504 1 1 if (1 == scalar @patnames) { }
1513 0 1 if ($@) { }
1517 0 1 if ($@) { }
1555 0 61 unless (@unpaired_gm_pnums)
1557 1 60 unless (@unpaired_barenames)
1559 0 5910 if ($gm_pn2barename{$gm_pnum})
1562 845 5065 if ($pat2gmtarget{$suitrs[0]} > $most_targets)
1567 0 60 if ($most_targets == 0)
1568 60 0 if ($most_targets > 1.5)
1573 845 5065 if ($suitrs[0] eq $pat_with_most_gmtargets)
1574 194 651 if ($suitrs[1] < $closest_gm_dist)
1589 5841 4623 if ($unpaired_barename{$suitrs[0]})
1607 0 1 if (%unpaired_barename)
1615 0 0 if ($patch >= 127)
1630 4 4 if (length($str) % 2) { }
1633 0 2 unless (open F, $f)
1636 0 2 if ($s =~ /^RIFF....sfbk/)
1637 1 1 if ($s =~ /^PK/)
1638 1 0 if ($s =~ /^GF1PATCH/)
1639 0 0 if ($f =~ /.sf2$/)
1640 0 0 if ($f =~ /.zip$/)
1641 0 0 if ($f =~ /.pat$/)