| 1 | package Data::Hash::Diff::Smart::Renderer::Test2; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | |||||||||||||||||||||||
| 6 | 47 | ▶ | sub render { | ||||||||||||||||||||
|
Subroutine
render: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||
| 7 | 47 | my ($changes) = @_; | |||||||||||||||||||||
| 8 | |||||||||||||||||||||||
| 9 | 47 | ▶ | return '' unless @$changes; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | 38 | my @out; | |||||||||||||||||||||
| 12 | |||||||||||||||||||||||
| 13 | 38 | for my $c (@$changes) { | |||||||||||||||||||||
| 14 | 47 | my $op = $c->{op}; | |||||||||||||||||||||
| 15 | 47 | my $path = $c->{path}; | |||||||||||||||||||||
| 16 | |||||||||||||||||||||||
| 17 | 47 | ▶ | if ($op eq 'change') { | ||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||
| 18 | push @out, | ||||||||||||||||||||||
| 19 | "Difference at $path", | ||||||||||||||||||||||
| 20 | ' - ' . ($c->{from} // ''), | ||||||||||||||||||||||
| 21 | 27 | ▶ | ' + ' . ($c->{to} // ''), | ||||||||||||||||||||
|
Condition75%3/4
$c->{"from"} // ""
$c->{"to"} // ""
MC/DC100%1/1
$c->{"from"} // ""
$c->{"from"}
MC/DC0%0/1
$c->{"to"} // ""
$c->{"to"}
Truth table100%2/2
A
A= $c->{"from"}
Truth table50%1/2
A
A= $c->{"to"}
| |||||||||||||||||||||||
| 22 | ''; | ||||||||||||||||||||||
| 23 | } elsif ($op eq 'add') { | ||||||||||||||||||||||
| 24 | push @out, | ||||||||||||||||||||||
| 25 | "Added at $path", | ||||||||||||||||||||||
| 26 | 10 | ▶ | ' + ' . ($c->{value} // ''), | ||||||||||||||||||||
|
Condition50%1/2
$c->{"value"} // ""
MC/DC0%0/1
$c->{"value"} // ""
$c->{"value"}
Truth table50%1/2
A
A= $c->{"value"}
| |||||||||||||||||||||||
| 27 | ''; | ||||||||||||||||||||||
| 28 | } elsif ($op eq 'remove') { | ||||||||||||||||||||||
| 29 | push @out, | ||||||||||||||||||||||
| 30 | "Removed at $path", | ||||||||||||||||||||||
| 31 | 8 | ▶ | ' - ' . ($c->{from} // ''), | ||||||||||||||||||||
|
Condition100%2/2
$c->{"from"} // ""
MC/DC100%1/1
$c->{"from"} // ""
$c->{"from"}
Truth table100%2/2
A
A= $c->{"from"}
| |||||||||||||||||||||||
| 32 | ''; | ||||||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||||
| 34 | 2 | push @out, "Unknown op '$op' at $path"; | |||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||
| 37 | |||||||||||||||||||||||
| 38 | # Prefix each line with '# ' so Test2::Diag displays it cleanly | ||||||||||||||||||||||
| 39 | 38 | return join("\n", map { "# $_" } @out) . "\n"; | |||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | 6 | 1; | |||||||||||||||||||||