« blib/lib/Langertha/Holmgang/Sim/Linux/SshAccess.pm
↑ Summary
blib/lib/Langertha/Holmgang/Sim/Linux/Monitoring.pm »
| 1 | package Langertha::Holmgang::Lint; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: The self-check every case passes on every load | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 35 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 35 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 35 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 35 | ▶ | use Langertha::Holmgang::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 35 | ▶ | use Langertha::Holmgang::Expectation qw( filter_value ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 35 | ▶ | use Langertha::Holmgang::Grader; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 35 | ▶ | use Langertha::Holmgang::Template (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 35 | ▶ | use Langertha::Holmgang::World (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 35 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 35 | has grader => ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | builder => '_build_grader', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | ▶ | sub _build_grader { Langertha::Holmgang::Grader->new } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_grader: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 35 | has mock_runs => ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | predicate => 'has_mock_runs', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 21 | ▶ | sub _refuse { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_refuse: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | my ( $self, $field, $reason ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_refuse: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | Langertha::Holmgang::Error->throw( $field, $reason ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 336 | ▶ | sub lint { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lint: called CC=26 SCAR=48.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my ( $self, $case, $f ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lint: not called CC=26 SCAR=48.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | $f //= $case->id; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%1/6
$f //= $case->id
$f //= $case->id
MC/DC0%0/2
$f //= $case->id
$f
$case->id
MC/DC0%0/2
$f //= $case->id
$f
$case->id
Truth table33%1/3
A //= B
A= $fB= $case->id
Truth table0%0/3
A //= B
A= $fB= $case->id
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $g = $self->grader; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # 0. argument filters, where the world applies them (a where pattern takes {name} only) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | for my $t ( @{ $case->tools } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | my $hs = $t->{handlers} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$t->{'handlers'} || []
$t->{'handlers'} || []
MC/DC100%1/1
$t->{'handlers'} || []
$t->{'handlers'}
MC/DC0%0/1
$t->{'handlers'} || []
$t->{'handlers'}
Truth table100%2/2
A
A= $t->{'handlers'}
Truth table0%0/2
A
A= $t->{'handlers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | for my $j ( 0 .. $#$hs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $hf = $f.': tools.'.$t->{name}.'.handlers['.$j.']'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $self->_when_filters( $hs->[$j]{when}, $hf ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my $ap = $hs->[$j]{apply} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$hs->[$j]{'apply'} || []
$hs->[$j]{'apply'} || []
MC/DC100%1/1
$hs->[$j]{'apply'} || []
$hs->[$j]{'apply'}
MC/DC0%0/1
$hs->[$j]{'apply'} || []
$hs->[$j]{'apply'}
Truth table100%2/2
A
A= $hs->[$j]{'apply'}
Truth table0%0/2
A
A= $hs->[$j]{'apply'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | for my $k ( 0 .. $#$ap ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $op = $ap->[$k]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $self->_filters( $op->{$_}, $hf.'.apply['.$k.'].'.$_ ) for grep { exists $op->{$_} } @Langertha::Holmgang::World::OPS, qw( value at from to ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | my $obs = $case->observe || []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$case->observe || []
$case->observe || []
MC/DC100%1/1
$case->observe || []
$case->observe
MC/DC0%0/1
$case->observe || []
$case->observe
Truth table100%2/2
A
A= $case->observe
Truth table0%0/2
A
A= $case->observe
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $self->_when_filters( $obs->[$_]{when}, $f.': observe['.$_.']' ) for 0 .. $#$obs; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # 1. templates | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | for my $t ( @{ $case->tools } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my $hs = $t->{handlers} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$t->{'handlers'} || []
$t->{'handlers'} || []
MC/DC100%1/1
$t->{'handlers'} || []
$t->{'handlers'}
MC/DC0%0/1
$t->{'handlers'} || []
$t->{'handlers'}
Truth table100%2/2
A
A= $t->{'handlers'}
Truth table0%0/2
A
A= $t->{'handlers'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | for my $j ( 0 .. $#$hs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $self->_renders( $case, $hs->[$j]{output}, $f.': tools.'.$t->{name}.'.handlers['.$j.'].output' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | $self->_renders( $case, $obs->[$_]{output}, $f.': observe['.$_.'].output' ) for 0 .. $#$obs; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | ▶ | my $failed = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=10.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | my ( $r ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=10.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | return join '; ', map { '"'.$_->{title}.'": '.$_->{reason} } grep { $_->{required} && !$_->{passed} } @{ $r->{rules} }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$_->{'required'} && !$_->{'passed'}
$_->{'required'} && !$_->{'passed'}
MC/DC50%1/2
$_->{'required'} && !$_->{'passed'}
$_->{'required'}
!$_->{'passed'}
MC/DC0%0/2
$_->{'required'} && !$_->{'passed'}
$_->{'required'}
!$_->{'passed'}
Truth table66%2/3
A && not(B)
A= $_->{'required'}B= !$_->{'passed'}
Truth table0%0/3
A && not(B)
A= $_->{'required'}B= !$_->{'passed'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # 5. a check command runs without a gap after every path | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1346 | ▶ | my $check_gap = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | my ( $r, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | my ( $rule ) = grep { defined $_->{sim_gap} } @{ $r->{rules} } or return; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $self->_refuse( $f.': '.$field, 'check command "'.$rule->{title}.'" hits a gap of the simulation: '.$rule->{sim_gap} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # 2. doing nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my $noop = $g->grade( $case, { state => $case->initial_state, calls => [] } ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $check_gap->( $noop, 'rules' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | $self->_refuse( $f.': rules', 'doing nothing passes already — the rules check no change' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | if $noop->{status} eq 'passed' && !$case->no_tool; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$noop->{"status"} eq "passed" and not $case->no_tool
$noop->{"status"} eq "passed" and not $case->no_tool
MC/DC100%2/2
$noop->{"status"} eq "passed" and not $case->no_tool
$noop->{"status"} eq "passed"
not $case->no_tool
MC/DC0%0/2
$noop->{"status"} eq "passed" and not $case->no_tool
$noop->{"status"} eq "passed"
not $case->no_tool
Truth table100%3/3
A and not(B)
A= $noop->{"status"} eq "passed"B= not $case->no_tool
Truth table0%0/3
A and not(B)
A= $noop->{"status"} eq "passed"B= not $case->no_tool
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # 3. the right paths | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my @alt = @{ $case->alternatives || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$case->alternatives || []
$case->alternatives || []
MC/DC100%1/1
$case->alternatives || []
$case->alternatives
MC/DC0%0/1
$case->alternatives || []
$case->alternatives
Truth table100%2/2
A
A= $case->alternatives
Truth table0%0/2
A
A= $case->alternatives
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | my @right = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | [ solution => 'the reference solution', $case->solution ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | map { [ 'alternatives['.$_.']', 'alternative "'.$alt[$_]{title}.'"', $alt[$_]{calls} ] } 0 .. $#alt, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | for my $r ( @right ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my ( $field, $name, $calls ) = @$r; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my $sol = $g->replay( $case, $calls ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if ( @{ $sol->{failed_calls} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $n = $sol->{failed_calls}[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | $self->_refuse( $f.': '.$field.'['.$n.']', 'call fails: '.( $sol->{outputs}[$n] // '' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$sol->{"outputs"}[$n] // ""
$sol->{"outputs"}[$n] // ""
MC/DC0%0/1
$sol->{"outputs"}[$n] // ""
$sol->{"outputs"}[$n]
MC/DC0%0/1
$sol->{"outputs"}[$n] // ""
$sol->{"outputs"}[$n]
Truth table50%1/2
A
A= $sol->{"outputs"}[$n]
Truth table0%0/2
A
A= $sol->{"outputs"}[$n]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if ( @{ $sol->{sim_gaps} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->_refuse( $f.': '.$field.'['.$sol->{sim_gaps}[0]{call}.']', 'gap of the simulation: '.$sol->{sim_gaps}[0]{gap} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $check_gap->( $sol, $field ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $self->_refuse( $f.': '.$field, $name.' does not pass: '.$failed->($sol) ) unless $sol->{status} eq 'passed'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # 4. the wrong solutions | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | my $wrong = $case->wrong_solutions || []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$case->wrong_solutions || []
$case->wrong_solutions || []
MC/DC0%0/1
$case->wrong_solutions || []
$case->wrong_solutions
MC/DC0%0/1
$case->wrong_solutions || []
$case->wrong_solutions
Truth table50%1/2
A
A= $case->wrong_solutions
Truth table0%0/2
A
A= $case->wrong_solutions
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | for my $j ( 0 .. $#$wrong ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $w = $wrong->[$j]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $r = $g->replay( $case, $w->{calls} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | $self->_refuse( $f.': wrong_solutions['.$j.']', 'wrong solution "'.$w->{title}.'" passes' ) if $r->{status} eq 'passed'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $check_gap->( $r, 'wrong_solutions['.$j.']' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | $self->mock_runs->( $self, $case, $f ) if $self->has_mock_runs; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 333 | ▶ | sub _when_filters { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_when_filters: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | my ( $self, $when, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_when_filters: not called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | $when ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$when ||= []
$when ||= []
MC/DC100%1/1
$when ||= []
$when
MC/DC0%0/1
$when ||= []
$when
Truth table100%2/2
A
A= $when
Truth table0%0/2
A
A= $when
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $self->_filters( $when->[$_]{path}, $field.'.when['.$_.'].path' ) for 0 .. $#$when; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # the {name|filter} the world's value and interp_text replace; a filter is known when | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # filter_value takes it | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 656 | ▶ | sub _filters { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filters: called CC=9 SCAR=33.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | my ( $self, $v, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_filters: not called CC=9 SCAR=33.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | if ( ref $v eq 'HASH' ) { $self->_filters( $v->{$_}, $field.'.'.$_ ) for sort keys %$v; return } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if ( ref $v eq 'ARRAY' ) { $self->_filters( $v->[$_], $field.'['.$_.']' ) for 0 .. $#$v; return } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | return if !defined $v || ref $v; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
not defined $v or ref $v
not defined $v or ref $v
MC/DC0%0/2
not defined $v or ref $v
not defined $v
ref $v
MC/DC0%0/2
not defined $v or ref $v
not defined $v
ref $v
Truth table33%1/3
not(A) or B
A= not defined $vB= ref $v
Truth table0%0/3
not(A) or B
A= not defined $vB= ref $v
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | while ( $v =~ /\{[A-Za-z_][A-Za-z0-9_]*\|([a-z]+)\}/g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my $name = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | eval { filter_value( 'x', $name ); 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | or $self->_refuse( $field, "unknown filter '".$name."' (known: split, int, lc)" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 324 | ▶ | sub _renders { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_renders: called CC=3 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | my ( $self, $case, $tmpl, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_renders: not called CC=3 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | return unless defined $tmpl; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | eval { Langertha::Holmgang::Template::render( $tmpl, $case->initial_state, {}, $self->grader->simulators ); 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | or $self->_refuse( $field, 'output template (Kolon) broken: '.( $@ =~ s/\s+\z//r ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 35 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||