Condition Coverage

lib/ChordPro/Song.pm
Criterion Covered Total %
condition 266 514 51.7


and 3 conditions

line !l l&&!r l&&r condition
159 107 0 107 not $main::options->{'nosongconfig'} and $diag->{'file'}
168 0 107 0 $meta and $meta->{'__config'}
201 0 0 0 @$c and $c->[0] eq "append"
341 2201 0 0 /\\\Z/ and @$lines
370 2201 1887 314 $pp eq "env-$in_context" and /^\s*\{(\w+)\}\s*$/
4088 217 97 $pp eq "env-$in_context" and /^\s*\{(\w+)\}\s*$/ and $self->parse_directive($1)->{'name'} eq "end_of_$in_context"
420 54 0 3 /^##(image|asset|include)(?:-(.+))?:\s+(.*)/i and $self->selected($2)
439 1 1 9 @$lines and $lines->[0] =~ /^# (.+)/
490 1 0 3 @$lines and $lines->[0] =~ /^# (.+)/
521 0 0 0 $uri and CP()->is_here($uri)
547 9 6 39 exists $$main::config{lc $self->{'generate'}} and exists $$main::config{lc $self->{'generate'}}{'comments'}
6 0 39 exists $$main::config{lc $self->{'generate'}} and exists $$main::config{lc $self->{'generate'}}{'comments'} and $$main::config{lc $self->{'generate'}}{'comments'} eq "retain"
589 2 0 0 $opts->{'align'} and $opts->{'x'}
0 0 0 $opts->{'align'} and $opts->{'x'} and $opts->{'x'} =~ /\%$/
619 1 0 0 $label and $label ne ""
629 0 0 0 $in_context eq "chorus" and not $main::config->{'settings'}{'choruslabels'}
637 0 0 9 $self->{'body'} and @{$self->{'body'};}
0 0 9 $self->{'body'} and @{$self->{'body'};} and $self->{'body'}[-1]{'context'} eq $in_context
0 0 9 $self->{'body'} and @{$self->{'body'};} and $self->{'body'}[-1]{'context'} eq $in_context and $self->{'body'}[-1]{'open'}
666 302 0 513 /\S/ and not $fragment
302 513 0 /\S/ and not $fragment and not exists $self->{'title'}
683 776 0 0 $in_context eq "grille" and @grille
695 474 0 0 $main::config->{'settings'}{'flowtext'} and @{$self->{'body'} // [];}
699 0 0 0 $prev->{'type'} eq "songline" and not $prev->{'chords'}
0 0 0 $prev->{'type'} eq "songline" and not $prev->{'chords'} and not $this->{'chords'}
759 4 0 2 $diagrams &&= $main::config->{'diagrams'}{'show'} || 'all'
765 84 130 0 $diagrams =~ /^(user|all)$/ and not "ChordPro::Chords::Parser"->get_parser($target, 1)->has_diagrams
774 0 0 0 $self->{'define'} and @{$self->{'define'};}
975 10 34 1040 $chord =~ s/^\[(.*)\]$/$1/ and $chord ne "^"
7 0 37 $memchords and $in_context
7 0 37 $memchords and $in_context and not $chord =~ /^\*/
977 734 84 222 $memchords and not $dummy
818 0 222 $memchords and not $dummy and not $chord =~ /^\*/
993 29 7 1 $memcrdinx == 0 and @$memchords == 0
1073 0 0 0 m[\] and not m[\.*?\
1085 0 39 0 @tokens and uc($tokens[0]) =~ /^\|.*S/i
1092 118 0 0 &is_gridstrum($grid_type) and is_strum($c)
1135 0 0 0 $memchords and $p1
1146 0 0 0 $memchords and $p1
1180 0 0 117 $memchords and not &is_gridstrum($grid_type)
1299 1772 0 0 $main::options->{'reference'} and $d =~ s/^\s*:[: ]*//
1333 1486 169 4 $dir =~ /^start_of_(.*)/ and exists $main::config->{'delegates'}{$1}
169 4 0 $dir =~ /^start_of_(.*)/ and exists $main::config->{'delegates'}{$1} and $main::config->{'delegates'}{$1}{'type'} eq "omit"
1396 69 0 0 $in_context eq "grille" and not exists $main::config->{'delegates'}{$in_context}
1481 2 0 0 $in_context eq "chorus" and not $main::config->{'settings'}{'choruslabels'}
1541 95 0 0 $in_context eq "grille" and @grille > 1
1545 0 0 0 $opts->{'align'} and $opts->{'x'}
0 0 0 $opts->{'align'} and $opts->{'x'} and $opts->{'x'} =~ /\%$/
1584 0 0 0 $label and $label ne ""
1594 0 0 0 $in_context eq "chorus" and not $main::config->{'settings'}{'choruslabels'}
1631 0 12 0 not $main::options->{'reference'} and $d =~ /^([-+])([-\w.]+)$/i
1642 0 1 11 not $main::options->{'reference'} and $dir =~ /^\+([-\w.]+(?:\.[<>])?)$/
1659 0 1 0 $main::config->{'settings'}{'strict'} and not $d =~ /^x_/
1674 2 29 0 @$chorus and $arg
31 0 0 @$chorus and $arg and $arg ne ""
1677 0 0 0 $chorus->[0]{'type'} eq "set" and $chorus->[0]{'name'} eq "label"
1751 14 120 0 exists $res{'text'} and $res{'text'} =~ /^[ \t]*$/
1757 0 6 1 $main::running_under_test and not $arg
1762 0 4 2 @words and not $words[0] =~ /\w+=/
1776 19 0 1 $k =~ /^(title)$/i and $v ne ""
15 0 4 $k =~ /^(border|spread|center|persist|omit)$/i and $v =~ /^(\d+)$/
13 0 2 $k =~ /^(width|height)$/i and $v =~ /^(\d+(?:\.\d+)?\%?)$/
11 0 2 $k =~ /^(x|y)$/i and $v =~ /^(?:base[+-])?([-+]?\d+(?:\.\d+)?\%?)$/
8 0 3 $k =~ /^(scale)$/ and $v =~ /^(\d+(?:\.\d+)?)(%)?(?:,(\d+(?:\.\d+)?)(%)?)?$/
6 0 2 $k =~ /^(src|uri)$/i and $v ne ""
2 0 4 $k =~ /^(id)$/i and $v ne ""
2 0 0 $k =~ /^(chord)$/i and $v ne ""
2 0 0 $k =~ /^(type)$/i and $v ne ""
2 0 0 $k =~ /^(label|href)$/i and $v ne ""
0 0 2 $k =~ /^(anchor)$/i and $v =~ /^(paper|page|allpages|column|float|line)$/
0 0 0 $k =~ /^(align)$/i and $v =~ /^(center|left|right)$/
0 0 0 $k =~ /^(bordertrbl)$/i and $v =~ /^[trbl]*$/
1781 3 0 1 $k eq "center" and $v
1852 5 1 0 $opts{'align'} and $opts{'x'}
1 0 0 $opts{'align'} and $opts{'x'} and $opts{'x'} =~ /\%$/
1860 4 0 2 $uri and CP()->is_here($uri)
1898 2 0 0 $id and %opts
1906 0 2 0 $uri =~ /\.(\w+)$/ and exists $main::config->{'delegates'}{$1}
2014 157 1 9 $key eq "duration" and $val
2019 1 0 16 $capo and $m->{'key'}
2044 0 184 0 $main::config->{'metadata'}{'strict'} and not &any(sub { $_ eq $key; } , @{$$main::config{"metadata"}{"keys"};})
2054 160 24 0 $self->{'meta'}{$key} and not is_arrayref($self->{'meta'}{$key})
2089 20 0 0 ref $main::config->{'settings'}{'columns'} eq "ARRAY" and $arg == @{$main::config->{'settings'}{'columns'};}
2175 13 2 0 $capo and $decapo
2203 2 0 0 $prop eq "font" and $old =~ /\s(\d+(?:\.\d+)?)$/
2253 61 24 0 $prop eq "font" and $value =~ /\s(\d+(?:\.\d+)?)$/
2302 149 0 2 $a eq "display" and @a
140 0 9 $a eq "format" and @a
0 0 13 $a eq "diagram" and @a > 0
2343 39 18 342 @a and $a[0] =~ /^(?:-?[0-9]+|[-xXN])$/
57 0 342 @a and $a[0] =~ /^(?:-?[0-9]+|[-xXN])$/ and @f < $strings
2361 8 8 96 @a and @f < $strings
2391 1 7 24 @a and $a[0] =~ /^[0-9]+$/
2405 13 0 0 $show and not is_true($a[0])
2494 0 7 2 defined $self->{'body'} and $self->{'body'}[-1]{'type'} eq "diagrams"
2578 1155 10 4 $capo and $decapo
2598 30 258 0 $info and $debug > 1
2602 22 0 230 $info && $info->is_xpxc
910 230 22 $def || $xp || $xc and not $info && $info->is_xpxc
2609 9 0 1153 $info and $info->is_xpxc
8 0 1 $def and not $xc || $xp
2619 1004 0 158 $xp and $info
158 0 0 $xc && ($xc eq 'nashville' || $xc eq 'roman')
1004 0 158 $xp and $info and not $xc && ($xc eq 'nashville' || $xc eq 'roman')
2637 274 0 0 $main::config->{'instrument'}{'type'} eq "keyboard" and my $k = ChordPro::Chords::get_keys($info)
2662 1142 0 20 $xc and $info
2666 20 0 0 $xcmov and not defined $key_ord
2736 183 0 56 $item->{'type'} eq "empty" and $item->{'context'} eq $def_context
2740 68 79 36 $item->{'type'} eq "songline" and $item->{'context'} eq ""

or 2 conditions

line l !l condition
242 0 0 $main::config->{'instrument'} //= "guitar"
260 214 0 $meta->{$_} //= []
402 34 0 $dir->{'arg'} // ""
452 1 1 $self->{'assets'} //= {}
496 1 0 $self->{'assets'} //= {}
696 0 0 $self->{'body'} // []
752 2 452 $v->{'diagram'} // 1
759 1 1 $main::config->{'diagrams'}{'show'} || 'all'
795 0 214 $self->{'meta'}{'chords'} //= [@used_chords]
1400 26 0 $kv->{'shape'} // ""
1415 22 0 $3 // 1
22 0 $1 // 0
1 21 $4 // 0
1428 0 26 $kv->{'label'} // ""
1436 0 26 $kv->{'cc'} //= "grid"
1438 13 13 $memchords{$cctag} //= []
1453 0 0 $main::config->{'settings'}{'transpose'} // 0
1456 2 0 $kv->{'label'} // ""
1530 19 50 $memchords{$cctag // $in_context} //= []
1904 0 2 $self->{'assets'} //= {}
2018 16 1 $val || undef
2132 31 24 $propstack{'transpose'} //= []
2194 25 62 $propstack{$name} //= []
2434 764 159 $info->{$_} // ""
2485 61 11 $res->{'base'} ||= 1
2759 0 0 $full ||= 0

or 3 conditions

line l !l&&r !l&&!r condition
88 0 214 2 $opts->{'filesource'} || $opts->{'_filesource'}
104 0 216 0 $opts->{'diagformat'} // $main::config->{'diagnostics'}{'format'}
253 0 0 856 not $v or $v->{'type'} eq "none"
309 2 212 0 $target //= $self->{'system'}
549 39 0 0 exists $self->{'title'} or $fragment
595 1 1 0 $id //= '_Image' . $assetid++
689 302 0 0 exists $self->{'title'} or $fragment
866 3 0 988 $orig =~ /^\*(.+)/ or $orig =~ /^(\||\s+)$/
902 4 2 1 $markup =~ s/\>\Q$c\E\%{formatted}\(\Q$c\E\)\(%{formatted})
920 8 6 966 $info->is_nc or $info->is_note
922 0 0 0 $info->is_rootless || $info->has_diagram || !$info->parser->has_diagrams
1051 0 0 0 $in_context eq "grille" or $grid_cells->[2]
1057 0 0 0 $in_context eq "grille" or $grid_cells->[1]
1103 0 0 663 $_ eq "|:" or $_ eq "{"
0 0 663 $_ eq ":|" or $_ eq "}"
0 0 663 $_ eq ":|:" or $_ eq "}{"
1173 0 0 2 $_ eq '.' || $_ eq ''
1319 50 179 0 $abbrevs{$1} // $1
1330 269 1274 0 $abbrevs{$dir} // $dir
1351 5 109 115 $sel eq lc $main::config->{'instrument'}{'type'} || ($sel eq lc $main::config->{'user'}{'name'} || $self->{'meta'}{lc $sel} && is_true($self->{'meta'}{lc $sel}[0]))
1396 26 0 69 $in_context eq "grid" or $in_context eq "grille" and not exists $main::config->{'delegates'}{$in_context}
1451 0 0 2 $xpose or $main::config->{'settings'}{'transpose'}
1530 0 69 0 $cctag // $in_context
1551 0 0 0 $id //= '_Image' . $assetid++
1848 2 4 0 $uri or $id
6 0 0 $uri or $id or $chord
1862 2 0 0 CP()->siblingres($diag->{'file'}, $uri, 'class', 'images') || CP()->siblingres($diag->{'file'}, $uri, 'class', 'icons')
1873 4 2 0 $id || '_Image' . $assetid++
1930 0 0 2 $id or defined $opts{'spread'}
1979 0 0 277 $key eq "user" or $key eq "instrument"
2302 11 0 151 $a eq "copy" or $a eq "copyall"
2434 0 396 527 $res->{$_} //= $info->{$_} // ""
2440 0 16 20 $res->{$_} //= $info->{$_}
2448 0 11 61 $kv{'copyall'} // $kv{'copy'}
2453 0 44 0 $res->{$_} //= $orig->{$_}
2456 0 0 0 $res->{$_} //= $orig->{$_}
2488 72 0 0 $res->{'parser'} //= ChordPro::Chords::get_parser()
2602 232 20 910 $def || $xp || $xc
2609 0 0 1 $xc || $xp
1153 1 8 $info and $info->is_xpxc or $def and not $xc || $xp
2616 0 0 8 $xp or $xc
0 0 8 $xp or $xc or $main::config->{'debug'}{'chords'}
2622 118 39 1 $xpose_dir // $global_dir
2697 1153 1 8 $info or $def
2698 0 1 7 $main::config->{'debug'}{'chords'} or not $warned_chords{$chord}++