Branch Coverage

blib/lib/Mock/Data/Regex.pm
Criterion Covered Total %
branch 139 198 70.2


line true false branch
20 0 2 @_ == 1 ? :
20 2 @_ == 1 && (!ref($_[0]) || ref $_[0] eq 'Regexp') ? :
24 0 22 if (ref $class)
27 0 0 if ($self{'regex'} == $class->{'regex'} xor $self{'regex_parse_tree'} == $class->{'regex_parse_tree'})
28 0 0 if $self{'regex_parse_tree'} == $class->{'regex_parse_tree'}
29 0 0 if $self{'regex'} == $class->{'regex'}
34 0 22 unless defined $self{'regex'}
35 0 22 unless ref $self{'regex'} eq 'Regexp'
38 3 19 if $self{'regex_parse_tree'}->flags->{'a'}
40 0 22 if defined $self{'prefix'}
41 0 22 if defined $self{'suffix'}
59 205 0 unless $_[0]{'max_repetition'}
63 0 0 if (@_ > 1)
70 0 0 if (@_ > 1)
79 23 182 ref $_[0] eq 'HASH' ? :
86 0 205 unless $self->regex_parse_tree->generate($out) and !$out->next_req || grep(($_ eq ''), @{$out->next_req;})
90 186 19 unless defined $prefix or defined $suffix
95 19 0 if ($prefix and !$out->start || $out->start eq 'LF')
97 1 18 if $out->start
102 18 1 if ($suffix and !$out->next_req || grep(($_ eq "\n"), @{$out->next_req;}) && !$out->require->[1])
103 2 16 if $out->next_req
118 0 0 &Scalar::Util::blessed($p) && $p->isa('Mock::Data::Charset') ? :
136 51 169 if (/\G \( (\?)? /cgx)
138 40 11 if (defined $1)
140 0 40 unless /\G \^ ( \w* )? : /cgx
142 40 0 if (defined $1)
149 0 51 unless /\G \) /cgx
153 56 164 if (/\G ( [|)] ) /cgx) { }
25 139 elsif (/\G ( \[ | \\w | \\W | \\s | \\S | \\d | \\D | \\N | \\Z | \. | \^ | \$ ) /cgx) { }
24 115 elsif (/\G ( \? | \* \?? | \+ \?? | \{ ([0-9]+)? (,)? ([0-9]+)? \} ) /cgx) { }
0 115 elsif ($flags->{'x'} and /\G ( \s | [#].* ) /cgx) { }
75 40 elsif (/\G (\\)? (.) /cgsx) { }
155 51 5 if ($1 eq ')')
166 5 20 if ($1 eq '[') { }
5 15 elsif (ord $1 == 92) { }
2 13 elsif ($1 eq '.') { }
7 6 elsif ($1 eq '$') { }
6 0 elsif ($1 eq '^') { }
172 1 4 if ($1 eq '\\Z') { }
180 0 2 $flags->{'s'} ? :
183 4 3 $flags->{'m'} ? :
186 4 2 $flags->{'m'} ? :
192 1 23 if ($1 eq '?') { }
5 18 elsif (ord $1 == 42) { }
13 5 elsif (ord $1 == 43) { }
202 3 2 $3 ? :
205 0 24 if (not @$expr) { }
6 18 elsif (not ref $expr->[-1]) { }
211 2 4 if (length $expr->[-1] > 1) { }
227 0 75 if $_regex_syntax_unsupported{$1 or ''}{$2}
229 5 70 if ($1 and defined(my $equiv = $_parse_regex_backslash{$2})) { }
230 3 2 ref $equiv ? :
234 3 72 if ($flags->{'i'} and uc $ch ne lc $ch) { }
22 50 elsif (@$expr and not ref $expr->[-1]) { }
248 3 0 if @$expr
35 53 @$expr > 1 || !ref($expr->[0]) ? :
3 88 @or ? :
267 9 5 @_ > 1 ? :
304 24 424 if (@_ > 1)
309 0 24 if (my $rep = $_[0]{'repetition'}) { }
311 0 0 defined $rep->[$_] && defined $val->[$_] ? :
320 0 0 $_[0]{'repetition'} ? :
323 0 0 $_[0]{'repetition'} ? :
328 81 260 if (my $rep = $self->repetition) { }
331 269 66 $_ > $min ? :
335 20 335 ref $_ ? :
337 319 16 if $success
339 16 0 if ($origin)
349 171 261 ref $_ ? :
19 413 unless ref $_ ? $_->generate($out) : $out->append($_)
367 30 0 if (my $rep = $self->{'repetition'})
379 122 0 ref $pick ? :
103 19 if ref $pick ? $pick->generate($out) : $out->append($pick)
385 19 0 ref $_ ? :
19 0 if ref $_ ? $_->generate($out) : $out->append($_)
388 0 0 if ($_ > $min)
409 14 0 if (ref $self->{'pattern'} eq 'HASH')
410 3 11 if $self->{'flags'}{'a'}
419 0 76 if (my $req = $out->next_req)
422 0 0 unless (ref $_)
424 0 0 if length $_ == 0 and $self->min_repetition == 0
425 0 0 if length $_ == 1 and $self->pattern->has_member($_) or length $_ > 1 and not grep((!$self->pattern->has_member($_)), split(//, $_, 0))
449 51 39 if ($self->{'start'})
452 19 13 unless length $out->str == 0 or $self->{'start'} eq 'LF' and substr($out->str, -1) eq "\n"
455 19 13 if length $out->str == 0 and not $out->start
457 39 32 if ($self->{'end'})
460 39 0 unless $self->{'end'} eq 1
462 19 20 unless $self->{'end'} eq 'LF'
486 19 449 if @_ > 1
490 40 147 unless defined $rep
491 26 121 if defined $rep->[1]
494 121 0 if ord $range == 43
497 0 0 $range > 0 ? :
501 58 3 if @_ > 1
509 16 656 if (my $req = $self->next_req)
514 32 0 if (not ref $_) { }
515 0 32 if (length $_ and $content eq $_)
535 16 375 $req ? :
541 0 35 unless \$self->{'str'} == $origin->[0]