Branch Coverage

blib/lib/Subtitles.pm
Criterion Covered Total %
branch 88 176 50.0


line true false branch
22 0 8 if $#_ == 1
24 0 8 if $time < 0
31 0 0 if $#_ == 1
34 0 0 if ($time < 0) { }
46 0 8 if $#_ == 4
54 0 0 if $#_ == 1
57 0 0 if $time < 0
86 0 4 if ($content =~ s/^(\xff\xfe|\xfe\xff)//) { }
0 4 elsif ($content =~ s/^\xef\xbb\xbf//) { }
88 0 0 $1 eq "\377\376" ? :
99 4 0 unless (defined $codec)
103 267 8 unless $_->match($line)
108 0 4 unless (defined $codec)
116 0 4 if $@ or not defined $ret
118 0 4 if (@{$$self{'from'};} == 0)
122 0 4 if (@{$$self{'from'};} != @{$$self{'to'};})
123 0 0 if (@{$$self{'from'};} == @{$$self{'to'};} + 1) { }
132 0 4 if (@{$$self{'from'};} != @{$$self{'text'};})
133 0 0 if (@{$$self{'from'};} == @{$$self{'text'};} + 1) { }
148 0 4 unless $#_
151 0 4 unless exists $c{$codec}
152 0 4 if defined $$self{'codec'} and $$self{'codec'} eq $codec
153 3 1 if defined $$self{'codec'}
159 0 0 unless $#_
160 0 0 if defined $_[1] and $_[1] <= 0
175 0 0 if $time =~ s/^-//
176 0 0 if ($time =~ /^(?:(\d{1,2}):)?(?:(\d{1,2}):)?(\d{1,2})(?:[\,\.\:](\d{1,3}))?$/) { }
0 0 elsif ($self and $$self{'codec'}) { }
178 0 0 if defined $h and not defined $m
179 0 0 unless defined $h
180 0 0 unless defined $m
181 0 0 unless defined $ms
186 0 0 if defined $t
200 0 1 if $a == 1 and $b == 0
201 1 0 unless defined $qfrom
202 1 0 unless defined $qto
208 0 1 if $$from[$i] > $qto or $$to[$i] < $qfrom
217 2 0 if ($clear) { }
245 0 1 unless defined $time_between
265 1 1 if $$t[$i] <= $where
271 1 0 if (defined $end and $end >= 0)
276 1 0 if (defined $begin and $begin < $n)
288 9 0 @{$$self{'to'};} ? :
297 0 4 unless defined $content and @$content
300 0 4 if (&Encode::is_utf8($content))
302 0 0 unless print $fh "\357\273\277"
306 0 4 unless print $fh $content, "\n"
309 0 4 $@ ? :
360 2 5 if ($stage == 0) { }
2 3 elsif ($stage == 1) { }
2 1 elsif ($stage == 2) { }
361 0 2 unless length $_
362 0 2 unless /^\d+$/
366 0 2 unless /^(\d\d):(\d\d):(\d\d)[.,](\d\d\d)\s*-->\s*(\d\d):(\d\d):(\d\d)[.,](\d\d\d)/
372 2 0 if (length $_) { }
380 0 1 if (length $_) { }
430 0 1 $$sub{'rate'} ? :
437 0 2 unless (/^[{\[](\d+)[}\]][{\[](\d*)[}\]](.*)$/)
442 2 0 length $2 ? :
454 0 1 $$sub{'rate'} ? :
481 54 1 unless $_[1] =~ /^\[(SUBTITLE|COLF)\]/i
515 13 4 if ($read_header) { }
516 1 12 if (/^(\d\d):(\d\d):(\d\d)\.(\d\d)\,(\d\d):(\d\d):(\d\d)\.(\d\d)/)
523 3 2 if ($state == 0) { }
524 1 2 unless length $_
525 0 2 unless /^(\d\d):(\d\d):(\d\d)\.(\d\d)\,(\d\d):(\d\d):(\d\d)\.(\d\d)/
549 0 1 if ($$sub{'sub2'}{'header'}) { }
633 19 10 if ($read_header) { }
1 9 elsif ($read_footer) { }
634 1 18 if (//i)
641 1 8 if (m[])
654 8 5 if (defined $2 and length $2) { }
4 1 elsif (defined $3 and length $3) { }
657 4 4 if (/^sync\s+start\s*=\s*(\d+)/i) { }
4 0 elsif (/^p\s+class\s*\=\s*(\S+)/i) { }
0 0 elsif (/^\s*br\s*/i) { }
658 1 3 unless defined $$sub{'smi'}{'s1gap'}
661 0 4 if $s < $sync
663 3 1 unless ($line =~ /^[\n\s]*$/s)
672 1 3 unless defined $$sub{'smi'}{'s2gap'}
674 1 3 unless defined $$sub{'smi'}{'class'}
702 0 1 defined $$sub{'smi'}{'class'} ? :
703 0 1 if ($$sub{'smi'}{'header'}) { }
739 2 0 if $i == $n - 1 or int $$from[$i + 1] * 1000 + 0.5 != $t
745 0 1 if ($$sub{'smi'}{'footer'}) { }
855 0 0 if (/^\s*timestamp\:\s*(\d\d)\:(\d\d)\:(\d\d)\:(\d+).*?filepos\:\s*(.*)$/) { }
867 0 0 if @$from
878 0 0 unless $$sub{'idx'}{'comments'}