« blib/lib/Langertha/Holmgang/Sim/Linux.pm
↑ Summary
blib/lib/Langertha/Holmgang/Sim/Linux/Backup.pm »
| 1 | package Langertha::Holmgang::Structure; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: The shape checks of suite format 2, shared by the loader and the DSL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 36 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 36 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 36 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 36 | ▶ | use Digest::SHA (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 36 | ▶ | use JSON::MaybeXS (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 36 | ▶ | use Path::Tiny qw( path ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 36 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 36 | ▶ | use Langertha::Holmgang::Case; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 36 | ▶ | use Langertha::Holmgang::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 36 | ▶ | use Langertha::Holmgang::Excerpt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 36 | ▶ | use Langertha::Holmgang::Expectation (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 36 | ▶ | use Langertha::Holmgang::Haystack; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 36 | ▶ | use Langertha::Holmgang::Simulators; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 36 | ▶ | use Langertha::Holmgang::Target (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 36 | ▶ | use Langertha::Holmgang::ToolSchema qw( check_schema ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 36 | ▶ | use Langertha::Holmgang::World; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 36 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # true constants: the vocabulary of format 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 36 | our @RULE_KINDS = qw( state unchanged_except calls not_called only_tools check packet login ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 36 | our @MATCHERS = @Langertha::Holmgang::Expectation::MATCHERS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 36 | our @MODIFIERS = @Langertha::Holmgang::Expectation::MODIFIERS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 36 | our @OPS = @Langertha::Holmgang::World::OPS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 36 | our @CASE_KEYS = qw( id title tags difficulty system messages state observe rules solution | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | alternatives wrong_solutions temperature max_tokens max_turns source weight ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 36 | our @SUITE_KEYS = qw( format id version title description license defaults source tools topic threshold repeat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # images on a user message (k27): at most this many per message, each at most | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # this many bytes; true constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 36 | our $IMAGES_PER_MESSAGE = 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 36 | our $IMAGE_MAX_BYTES = 2 * 1024 * 1024; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 36 | my %SIMULATOR_PARAMS = ( run_command => [qw( host command )], write_file => [qw( host path content )] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 36 | my %HOOK = map { $_ => 1 } qw( prerouting input forward output postrouting ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 36 | my %L4 = map { $_ => 1 } qw( tcp udp icmp icmpv6 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 36 | my $ID_RE = qr/\A[a-z0-9][a-z0-9-]{0,63}\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 36 | my $TOOL_RE = qr/\A[A-Za-z_][A-Za-z0-9_-]{0,63}\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 36 | has simulators => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | builder => '_build_simulators', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub _build_simulators { Langertha::Holmgang::Simulators->new } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_simulators: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 36 | has haystack => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | builder => '_build_haystack', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub _build_haystack { Langertha::Holmgang::Haystack->new } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_haystack: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 36 | has excerpt => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | builder => '_build_excerpt', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 71 | ▶ | sub _build_excerpt { Langertha::Holmgang::Excerpt->new } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_excerpt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 96 | ▶ | sub _refuse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_refuse: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | my ( $self, $field, $reason ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_refuse: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | Langertha::Holmgang::Error->throw( $field, $reason ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 909 | ▶ | sub valid_id { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valid_id: called CC=4 SCAR=21.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | my ( $self, $id ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valid_id: not called CC=4 SCAR=21.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | return defined $id && !ref $id && $id =~ $ID_RE ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%3/12
defined $id and not ref $id and $id =~ /$ID_RE/
defined $id and not ref $id
defined $id and not ref $id and $id =~ /$ID_RE/
defined $id and not ref $id
MC/DC33%1/3
defined $id and not ref $id and $id =~ /$ID_RE/
defined $id
not ref $id
$id =~ /$ID_RE/
MC/DC0%0/3
defined $id and not ref $id and $id =~ /$ID_RE/
defined $id
not ref $id
$id =~ /$ID_RE/
Truth table50%2/4
A and not(B) and C
A= defined $idB= not ref $idC= $id =~ /$ID_RE/
Truth table0%0/4
A and not(B) and C
A= defined $idB= not ref $idC= $id =~ /$ID_RE/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | #### Small checks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 5762 | ▶ | sub _keys_ok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_keys_ok: called CC=4 SCAR=18.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my ( $self, $h, $field, @ok ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_keys_ok: not called CC=4 SCAR=18.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $self->_refuse( $field, 'not a hash' ) unless ref $h eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my %ok = map { $_ => 1 } @ok; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | for my $k ( sort keys %$h ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | $self->_refuse( $field.'.'.$k, 'unknown key' ) unless $ok{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7160 | ▶ | sub _text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_text: called CC=6 SCAR=25.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | my ( $self, $v, $field, $optional ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_text: not called CC=6 SCAR=25.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | return undef if $optional && !defined $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$optional and not defined $v
$optional and not defined $v
MC/DC100%2/2
$optional and not defined $v
$optional
not defined $v
MC/DC0%0/2
$optional and not defined $v
$optional
not defined $v
Truth table100%3/3
A and not(B)
A= $optionalB= not defined $v
Truth table0%0/3
A and not(B)
A= $optionalB= not defined $v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | $self->_refuse( $field, 'text missing' ) if !defined $v || ref $v || !length $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%3/12
not defined $v or ref $v or not length $v
not defined $v or ref $v
not defined $v or ref $v or not length $v
not defined $v or ref $v
MC/DC33%1/3
not defined $v or ref $v or not length $v
not defined $v
ref $v
not length $v
MC/DC0%0/3
not defined $v or ref $v or not length $v
not defined $v
ref $v
not length $v
Truth table50%2/4
not(A) or B or not(C)
A= not defined $vB= ref $vC= not length $v
Truth table0%0/4
not(A) or B or not(C)
A= not defined $vB= ref $vC= not length $v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return "$v"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 286 | ▶ | sub _num { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num: called CC=7 SCAR=29.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | my ( $self, $v, $field, $min, $max ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_num: not called CC=7 SCAR=29.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | $self->_refuse( $field, 'not a number' ) if !defined $v || ref $v || $v !~ /\A-?(?:\d+\.?\d*|\.\d+)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%2/12
not defined $v or ref $v or not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
not defined $v or ref $v
not defined $v or ref $v or not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
not defined $v or ref $v
MC/DC0%0/3
not defined $v or ref $v or not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
not defined $v
ref $v
not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
MC/DC0%0/3
not defined $v or ref $v or not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
not defined $v
ref $v
not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
Truth table25%1/4
not(A) or B or not(C)
A= not defined $vB= ref $vC= not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
Truth table0%0/4
not(A) or B or not(C)
A= not defined $vB= ref $vC= not $v =~ /\A-?(?:\d+\.?\d*|\.\d+)\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | $self->_refuse( $field, 'outside '.$min.'..'.$max ) if $v < $min || defined $max && $v > $max; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%6/12
$v < $min or defined $max and $v > $max
defined $max and $v > $max
$v < $min or defined $max and $v > $max
defined $max and $v > $max
MC/DC100%3/3
$v < $min or defined $max and $v > $max
$v < $min
defined $max
$v > $max
MC/DC0%0/3
$v < $min or defined $max and $v > $max
$v < $min
defined $max
$v > $max
Truth table100%4/4
A or B and C
A= $v < $minB= defined $maxC= $v > $max
Truth table0%0/4
A or B and C
A= $v < $minB= defined $maxC= $v > $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return 0 + $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 98 | ▶ | sub _regex { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_regex: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | my ( $self, $v, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_regex: not called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $self->_text( $v, $field ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | $self->_refuse( $field, 'invalid regular expression' ) unless eval { qr/$v/; 1 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | return "$v"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # a mark true/false (missing = false) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 524 | ▶ | sub _flag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flag: called CC=5 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | my ( $self, $v, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flag: not called CC=5 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | return 0 unless defined $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $self->_refuse( $field, 'true or false' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ref $v ? !JSON::MaybeXS::is_bool($v) : !grep { $v eq $_ } '1', '0', ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | return $v ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 4052 | ▶ | sub _list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_list: called CC=4 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my ( $self, $v, $field, $nonempty ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_list: not called CC=4 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | $self->_refuse( $field, 'not a list' ) unless ref $v eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $self->_refuse( $field, 'empty list' ) if $nonempty && !@$v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$nonempty and not @$v
$nonempty and not @$v
MC/DC100%2/2
$nonempty and not @$v
$nonempty
not @$v
MC/DC0%0/2
$nonempty and not @$v
$nonempty
not @$v
Truth table100%3/3
A and not(B)
A= $nonemptyB= not @$v
Truth table0%0/3
A and not(B)
A= $nonemptyB= not @$v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 15 | ▶ | sub _scalars { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scalars: called CC=3 SCAR=17.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | my ( $self, $v, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scalars: not called CC=3 SCAR=17.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->_list( $v, $field, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | $self->_refuse( $field, 'list of values expected' ) if grep { !defined || ref } @$v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
!defined($_) || ref $_
!defined($_) || ref $_
MC/DC0%0/2
!defined($_) || ref $_
!defined($_)
ref $_
MC/DC0%0/2
!defined($_) || ref $_
!defined($_)
ref $_
Truth table33%1/3
not(A) || B
A= !defined($_)B= ref $_
Truth table0%0/3
not(A) || B
A= !defined($_)B= ref $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # a path: dotted text or a list of segments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 1012 | ▶ | sub _path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_path: called CC=7 SCAR=30.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | my ( $self, $p, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_path: not called CC=7 SCAR=30.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if ( ref $p eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | $self->_refuse( $field, 'empty path' ) unless @$p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | $self->_refuse( $field, 'segments must be text' ) if grep { !defined || ref || !length } @$p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%2/12
!defined($_) || ref $_ || !length($_)
not defined $_ or ref $_
!defined($_) || ref $_ || !length($_)
not defined $_ or ref $_
MC/DC0%0/3
!defined($_) || ref $_ || !length($_)
not defined $_
ref $_
!length($_)
MC/DC0%0/3
!defined($_) || ref $_ || !length($_)
not defined $_
ref $_
!length($_)
Truth table25%1/4
not(A) or B || not(C)
A= not defined $_B= ref $_C= !length($_)
Truth table0%0/4
not(A) or B || not(C)
A= not defined $_B= ref $_C= !length($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | return $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $self->_text( $p, $field ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | $self->_refuse( $field, 'path with an empty segment' ) if grep { !length } split /\./, $p, -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | return $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 308 | ▶ | sub _arg_patterns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_arg_patterns: called CC=3 SCAR=15.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my ( $self, $m, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_arg_patterns: not called CC=3 SCAR=15.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $self->_refuse( $field, 'not a hash' ) unless ref $m eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $self->_regex( $m->{$_}, $field.'.'.$_ ) for sort keys %$m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return $m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # a pattern for a list element: a regex (text) or a hash field -> regex | expectations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 8 | ▶ | sub _element { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_element: called CC=6 SCAR=28.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | my ( $self, $m, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_element: not called CC=6 SCAR=28.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | return $self->_regex( $m, $field ) unless ref $m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | $self->_refuse( $field, 'pattern (text) or hash field -> pattern expected' ) unless ref $m eq 'HASH' && %$m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
ref $m eq "HASH" and %$m
ref $m eq "HASH" and %$m
MC/DC0%0/2
ref $m eq "HASH" and %$m
ref $m eq "HASH"
%$m
MC/DC0%0/2
ref $m eq "HASH" and %$m
ref $m eq "HASH"
%$m
Truth table33%1/3
A and B
A= ref $m eq "HASH"B= %$m
Truth table0%0/3
A and B
A= ref $m eq "HASH"B= %$m
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | for my $f ( sort keys %$m ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | ref $m->{$f} ? $self->_matchers( $m->{$f}, $field.'.'.$f, 1 ) : $self->_regex( $m->{$f}, $field.'.'.$f ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | return $m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # expectations on a value (Expectation::condition); with $bare without path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 421 | ▶ | sub _matchers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_matchers: called CC=29 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | my ( $self, $c, $field, $bare ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_matchers: not called CC=29 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $self->_keys_ok( $c, $field, ( $bare ? () : 'path' ), @MATCHERS, @MODIFIERS ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $self->_path( $c->{path}, $field.'.path' ) unless $bare; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if ( exists $c->{tolerance} ) { # k49: qualifies a numeric equals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | $self->_refuse( $field.'.tolerance', 'needs equals' ) unless exists $c->{equals}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $num = qr/\A-?(?:\d+\.?\d*|\.\d+)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my ( $e, $t ) = @$c{qw( equals tolerance )}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $self->_refuse( $field.'.equals', 'number expected beside tolerance' ) if !defined $e || ref $e || $e !~ $num; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%3/12
not defined $e or ref $e or not $e =~ /$num/
not defined $e or ref $e
not defined $e or ref $e or not $e =~ /$num/
not defined $e or ref $e
MC/DC33%1/3
not defined $e or ref $e or not $e =~ /$num/
not defined $e
ref $e
not $e =~ /$num/
MC/DC0%0/3
not defined $e or ref $e or not $e =~ /$num/
not defined $e
ref $e
not $e =~ /$num/
Truth table50%2/4
not(A) or B or not(C)
A= not defined $eB= ref $eC= not $e =~ /$num/
Truth table0%0/4
not(A) or B or not(C)
A= not defined $eB= ref $eC= not $e =~ /$num/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $self->_refuse( $field.'.tolerance', 'number of 0 or more expected' ) if !defined $t || ref $t || $t !~ $num || $t < 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition44%8/18
not defined $t or ref $t or not $t =~ /$num/ or $t < 0
not defined $t or ref $t or not $t =~ /$num/
not defined $t or ref $t
not defined $t or ref $t or not $t =~ /$num/ or $t < 0
not defined $t or ref $t or not $t =~ /$num/
not defined $t or ref $t
MC/DC75%3/4
not defined $t or ref $t or not $t =~ /$num/ or $t < 0
not defined $t
ref $t
not $t =~ /$num/
$t < 0
MC/DC0%0/4
not defined $t or ref $t or not $t =~ /$num/ or $t < 0
not defined $t
ref $t
not $t =~ /$num/
$t < 0
Truth table80%4/5
not(A) or B or not(C) or D
A= not defined $tB= ref $tC= not $t =~ /$num/D= $t < 0
Truth table0%0/5
not(A) or B or not(C) or D
A= not defined $tB= ref $tC= not $t =~ /$num/D= $t < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | my @m = grep { exists $c->{$_} } @MATCHERS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $self->_refuse( $field, 'no expectation ('.join( ', ', @MATCHERS ).')' ) unless @m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | for my $k ( @m ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $v = $c->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | if ( $k eq 'exists' || $k eq 'absent' ) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 12 branches
Condition33%2/6
$k eq "exists" or $k eq "absent"
$k eq "exists" or $k eq "absent"
MC/DC50%1/2
$k eq "exists" or $k eq "absent"
$k eq "exists"
$k eq "absent"
MC/DC0%0/2
$k eq "exists" or $k eq "absent"
$k eq "exists"
$k eq "absent"
Truth table66%2/3
A or B
A= $k eq "exists"B= $k eq "absent"
Truth table0%0/3
A or B
A= $k eq "exists"B= $k eq "absent"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | elsif ( $k eq 'equals' ) { $self->_refuse( $field.'.equals', 'value expected' ) if !defined $v || ref $v } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
not defined $v or ref $v
not defined $v or ref $v
MC/DC50%1/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 table66%2/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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | elsif ( $k eq 'in' || $k eq 'contains' || $k eq 'excludes' ) { $self->_scalars( $v, $field.'.'.$k ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition41%5/12
$k eq "in" or $k eq "contains" or $k eq "excludes"
$k eq "in" or $k eq "contains"
$k eq "in" or $k eq "contains" or $k eq "excludes"
$k eq "in" or $k eq "contains"
MC/DC66%2/3
$k eq "in" or $k eq "contains" or $k eq "excludes"
$k eq "in"
$k eq "contains"
$k eq "excludes"
MC/DC0%0/3
$k eq "in" or $k eq "contains" or $k eq "excludes"
$k eq "in"
$k eq "contains"
$k eq "excludes"
Truth table75%3/4
A or B or C
A= $k eq "in"B= $k eq "contains"C= $k eq "excludes"
Truth table0%0/4
A or B or C
A= $k eq "in"B= $k eq "contains"C= $k eq "excludes"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | elsif ( $k eq 'regex' ) { $self->_regex( $v, $field.'.regex' ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | elsif ( $k eq 'length' ) { $self->_num( $v, $field.'.length', 0, 100_000 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | elsif ( $k eq 'any' || $k eq 'none' ) { $self->_element( $v, $field.'.'.$k ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$k eq "any" or $k eq "none"
$k eq "any" or $k eq "none"
MC/DC0%0/2
$k eq "any" or $k eq "none"
$k eq "any"
$k eq "none"
MC/DC0%0/2
$k eq "any" or $k eq "none"
$k eq "any"
$k eq "none"
Truth table66%2/3
A or B
A= $k eq "any"B= $k eq "none"
Truth table0%0/3
A or B
A= $k eq "any"B= $k eq "none"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | else { # before | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $self->_refuse( $field.'.before', 'exactly two patterns' ) unless ref $v eq 'ARRAY' && @$v == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
ref $v eq "ARRAY" and @$v == 2
ref $v eq "ARRAY" and @$v == 2
MC/DC0%0/2
ref $v eq "ARRAY" and @$v == 2
ref $v eq "ARRAY"
@$v == 2
MC/DC0%0/2
ref $v eq "ARRAY" and @$v == 2
ref $v eq "ARRAY"
@$v == 2
Truth table0%0/3
A and B
A= ref $v eq "ARRAY"B= @$v == 2
Truth table0%0/3
A and B
A= ref $v eq "ARRAY"B= @$v == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->_element( $v->[$_], $field.'.before['.$_.']' ) for 0, 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 273 | ▶ | sub _op { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_op: called CC=6 SCAR=26.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | my ( $self, $o, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_op: not called CC=6 SCAR=26.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $self->_refuse( $field, 'not a hash' ) unless ref $o eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | my @kind = grep { exists $o->{$_} } @OPS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $self->_refuse( $field, 'exactly one change ('.join( ', ', @OPS ).')' ) unless @kind == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $kind = $kind[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my %need = ( set => ['value'], push => ['value'], insert => [qw( at value )], delete => [], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | remove => ['where'], move => [qw( from to )] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $self->_keys_ok( $o, $field, $kind, @{ $need{$kind} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | exists $o->{$_} or $self->_refuse( $field.'.'.$_, 'missing' ) for @{ $need{$kind} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $self->_path( $o->{$kind}, $field.'.'.$kind ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | $self->_element( $o->{where}, $field.'.where' ) if exists $o->{where}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 286 | ▶ | sub _handler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handler: called CC=8 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | my ( $self, $h, $field, @keys ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handler: not called CC=8 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | $self->_keys_ok( $h, $field, @keys ? @keys : qw( match when apply output error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | $self->_arg_patterns( $h->{match} // {}, $field.'.match' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$h->{"match"} // {}
$$h{"match"} // {}
MC/DC100%1/1
$h->{"match"} // {}
$h->{"match"}
MC/DC0%0/1
$$h{"match"} // {}
$$h{"match"}
Truth table100%2/2
A
A= $h->{"match"}
Truth table0%0/2
A
A= $$h{"match"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | my $when = $self->_list( $h->{when} // [], $field.'.when' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$h->{"when"} // []
$$h{"when"} // []
MC/DC100%1/1
$h->{"when"} // []
$h->{"when"}
MC/DC0%0/1
$$h{"when"} // []
$$h{"when"}
Truth table100%2/2
A
A= $h->{"when"}
Truth table0%0/2
A
A= $$h{"when"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->_matchers( $when->[$_], $field.'.when['.$_.']' ) for 0 .. $#$when; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | my $apply = $self->_list( $h->{apply} // [], $field.'.apply' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$h->{"apply"} // []
$$h{"apply"} // []
MC/DC100%1/1
$h->{"apply"} // []
$h->{"apply"}
MC/DC0%0/1
$$h{"apply"} // []
$$h{"apply"}
Truth table100%2/2
A
A= $h->{"apply"}
Truth table0%0/2
A
A= $$h{"apply"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->_op( $apply->[$_], $field.'.apply['.$_.']' ) for 0 .. $#$apply; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $self->_text( $h->{output}, $field.'.output', 1 ) unless @keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | #### Suite head and tools | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 531 | ▶ | sub tool { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tool: called CC=22 SCAR=47.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | my ( $self, $t, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tool: not called CC=22 SCAR=47.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $self->_keys_ok( $t, $field, qw( name description parameters handlers simulator ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $name = $t->{name} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$t->{"name"} // ""
$$t{"name"} // ""
MC/DC0%0/1
$t->{"name"} // ""
$t->{"name"}
MC/DC0%0/1
$$t{"name"} // ""
$$t{"name"}
Truth table50%1/2
A
A= $t->{"name"}
Truth table0%0/2
A
A= $$t{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | $self->_refuse( $field.'.name', 'invalid tool name' ) unless !ref $name && $name =~ $TOOL_RE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
not ref $name and $name =~ /$TOOL_RE/
not ref $name and $name =~ /$TOOL_RE/
MC/DC0%0/2
not ref $name and $name =~ /$TOOL_RE/
not ref $name
$name =~ /$TOOL_RE/
MC/DC0%0/2
not ref $name and $name =~ /$TOOL_RE/
not ref $name
$name =~ /$TOOL_RE/
Truth table33%1/3
not(A) and B
A= not ref $nameB= $name =~ /$TOOL_RE/
Truth table0%0/3
not(A) and B
A= not ref $nameB= $name =~ /$TOOL_RE/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | my $params = $t->{parameters} // { type => 'object', properties => {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$t->{"parameters"} // {"type", "object", "properties", {}}
$$t{"parameters"} // {"type", "object", "properties", {}}
MC/DC100%1/1
$t->{"parameters"} // {"type", "object", "properties", {}}
$t->{"parameters"}
MC/DC0%0/1
$$t{"parameters"} // {"type", "object", "properties", {}}
$$t{"parameters"}
Truth table100%2/2
A
A= $t->{"parameters"}
Truth table0%0/2
A
A= $$t{"parameters"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | $self->_refuse( $field.'.parameters', 'JSON Schema (type: object) expected' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | unless ref $params eq 'HASH' && ( $params->{type} // '' ) eq 'object'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition20%2/10
ref $params eq "HASH" and ($params->{"type"} // "") eq "object"
$params->{"type"} // ""
ref $params eq "HASH" and ($$params{"type"} // "") eq "object"
$$params{"type"} // ""
MC/DC0%0/2
ref $params eq "HASH" and ($params->{"type"} // "") eq "object"
ref $params eq "HASH"
$params->{"type"}
MC/DC0%0/2
ref $params eq "HASH" and ($$params{"type"} // "") eq "object"
ref $params eq "HASH"
$$params{"type"}
Truth table33%1/3
A and B
A= ref $params eq "HASH"B= $params->{"type"}
Truth table0%0/3
A and B
A= ref $params eq "HASH"B= $$params{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | check_schema( $params, $field.'.parameters' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $self->_text( $t->{description}, $field.'.description' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ( defined( my $sim = $t->{simulator} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $sims = $self->simulators; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $world = !ref $sim && !$SIMULATOR_PARAMS{$sim} ? $sims->world_tools($sim) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
ref $sim || $SIMULATOR_PARAMS{$sim}
ref $sim || $SIMULATOR_PARAMS{$sim}
MC/DC50%1/2
ref $sim || $SIMULATOR_PARAMS{$sim}
ref $sim
$SIMULATOR_PARAMS{$sim}
MC/DC0%0/2
ref $sim || $SIMULATOR_PARAMS{$sim}
ref $sim
$SIMULATOR_PARAMS{$sim}
Truth table66%2/3
A || B
A= ref $simB= $SIMULATOR_PARAMS{$sim}
Truth table0%0/3
A || B
A= ref $simB= $SIMULATOR_PARAMS{$sim}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | $self->_refuse( $field.'.simulator', 'run_command, write_file or an answer world (' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | .join( ', ', grep { $sims->world_tools($_) } $sims->types ).')' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | unless !ref $sim && ( $SIMULATOR_PARAMS{$sim} || $world ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition41%5/12
not ref $sim and $SIMULATOR_PARAMS{$sim} || $world
$SIMULATOR_PARAMS{$sim} or $world
not ref $sim and $SIMULATOR_PARAMS{$sim} || $world
$SIMULATOR_PARAMS{$sim} or $world
MC/DC66%2/3
not ref $sim and $SIMULATOR_PARAMS{$sim} || $world
not ref $sim
$SIMULATOR_PARAMS{$sim}
$world
MC/DC0%0/3
not ref $sim and $SIMULATOR_PARAMS{$sim} || $world
not ref $sim
$SIMULATOR_PARAMS{$sim}
$world
Truth table75%3/4
not(A) and B or C
A= not ref $simB= $SIMULATOR_PARAMS{$sim}C= $world
Truth table0%0/4
not(A) and B or C
A= not ref $simB= $SIMULATOR_PARAMS{$sim}C= $world
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | $self->_refuse( $field.'.handlers', 'simulator or handlers, not both' ) if exists $t->{handlers}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | $self->_refuse( $field.'.name', 'the world '.$sim.' has no tool '.$name.' ('.join( ', ', sort keys %$world ).')' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | if $world && !$world->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$world and not $world->{$name}
$world and not $$world{$name}
MC/DC100%2/2
$world and not $world->{$name}
$world
not $world->{$name}
MC/DC0%0/2
$world and not $$world{$name}
$world
not $$world{$name}
Truth table100%3/3
A and not(B)
A= $worldB= not $world->{$name}
Truth table0%0/3
A and not(B)
A= $worldB= not $$world{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | for my $p ( @{ $world ? $world->{$name} : $SIMULATOR_PARAMS{$sim} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | $self->_refuse( $field.'.parameters', 'required parameter '.$p.' missing' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | unless grep { $_ eq $p } @{ $params->{required} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%1/4
$params->{'required'} || []
$$params{'required'} || []
MC/DC0%0/1
$params->{'required'} || []
$params->{'required'}
MC/DC0%0/1
$$params{'required'} || []
$$params{'required'}
Truth table50%1/2
A
A= $params->{'required'}
Truth table0%0/2
A
A= $$params{'required'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my $hs = $self->_list( $t->{handlers}, $field.'.handlers', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $self->_handler( $hs->[$_], $field.'.handlers['.$_.']' ) for 0 .. $#$hs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | return $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 314 | ▶ | sub suite_head { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
suite_head: called CC=33 SCAR=53.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | my ( $self, $head, %o ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
suite_head: not called CC=33 SCAR=53.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | $self->_refuse( 'suite.yaml', 'not a hash' ) unless ref $head eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if ( exists $o{format} || exists $head->{format} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
exists $o{"format"} or exists $head->{"format"}
exists $o{"format"} or exists $$head{"format"}
MC/DC50%1/2
exists $o{"format"} or exists $head->{"format"}
exists $o{"format"}
exists $head->{"format"}
MC/DC0%0/2
exists $o{"format"} or exists $$head{"format"}
exists $o{"format"}
exists $$head{"format"}
Truth table66%2/3
A or B
A= exists $o{"format"}B= exists $head->{"format"}
Truth table0%0/3
A or B
A= exists $o{"format"}B= exists $$head{"format"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my $format = $head->{format} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$head->{"format"} // ""
$$head{"format"} // ""
MC/DC100%1/1
$head->{"format"} // ""
$head->{"format"}
MC/DC0%0/1
$$head{"format"} // ""
$$head{"format"}
Truth table100%2/2
A
A= $head->{"format"}
Truth table0%0/2
A
A= $$head{"format"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | $self->_refuse( 'format', 'format 1 (judge and rubric) is not read any more — format 2: end state and rules' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | if $format eq '1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | $self->_refuse( 'format', 'only format 2 is known' ) unless $format eq '2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $self->_keys_ok( $head, 'suite.yaml', @SUITE_KEYS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my %out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | if ( defined( my $t = $head->{threshold} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $self->_keys_ok( $t, 'threshold', qw( pass_rate pass_k ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | $self->_refuse( 'threshold', 'pass_rate or pass_k (0..1) expected' ) unless exists $t->{pass_rate} || exists $t->{pass_k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
exists $t->{"pass_rate"} or exists $t->{"pass_k"}
exists $$t{"pass_rate"} or exists $$t{"pass_k"}
MC/DC100%2/2
exists $t->{"pass_rate"} or exists $t->{"pass_k"}
exists $t->{"pass_rate"}
exists $t->{"pass_k"}
MC/DC0%0/2
exists $$t{"pass_rate"} or exists $$t{"pass_k"}
exists $$t{"pass_rate"}
exists $$t{"pass_k"}
Truth table100%3/3
A or B
A= exists $t->{"pass_rate"}B= exists $t->{"pass_k"}
Truth table0%0/3
A or B
A= exists $$t{"pass_rate"}B= exists $$t{"pass_k"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | $self->_num( $t->{$_}, 'threshold.'.$_, 0, 1 ) for grep { exists $t->{$_} } qw( pass_rate pass_k ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $out{threshold} = { map { $_ => 0 + $t->{$_} } grep { exists $t->{$_} } qw( pass_rate pass_k ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $repeat = $head->{repeat}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | $self->_refuse( 'repeat', 'integer 1..100 (runs per suite)' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition44%8/18
defined $repeat and ref $repeat || !($repeat =~ /\A[1-9]\d{0,2}\z/) || $repeat > 100
ref $repeat or not $repeat =~ /\A[1-9]\d{0,2}\z/ or $repeat > 100
ref $repeat or not $repeat =~ /\A[1-9]\d{0,2}\z/
defined $repeat and ref $repeat || !($repeat =~ /\A[1-9]\d{0,2}\z/) || $repeat > 100
ref $repeat or not $repeat =~ /\A[1-9]\d{0,2}\z/ or $repeat > 100
ref $repeat or not $repeat =~ /\A[1-9]\d{0,2}\z/
MC/DC75%3/4
defined $repeat and ref $repeat || !($repeat =~ /\A[1-9]\d{0,2}\z/) || $repeat > 100
defined $repeat
ref $repeat
not $repeat =~ /\A[1-9]\d{0,2}\z/
$repeat > 100
MC/DC0%0/4
defined $repeat and ref $repeat || !($repeat =~ /\A[1-9]\d{0,2}\z/) || $repeat > 100
defined $repeat
ref $repeat
not $repeat =~ /\A[1-9]\d{0,2}\z/
$repeat > 100
Truth table80%4/5
A and B or not(C) or D
A= defined $repeatB= ref $repeatC= not $repeat =~ /\A[1-9]\d{0,2}\z/D= $repeat > 100
Truth table0%0/5
A and B or not(C) or D
A= defined $repeatB= ref $repeatC= not $repeat =~ /\A[1-9]\d{0,2}\z/D= $repeat > 100
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | if defined $repeat && ( ref $repeat || $repeat !~ /\A[1-9]\d{0,2}\z/ || $repeat > 100 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | $out{repeat} = 0 + $repeat if defined $repeat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | if ( defined $head->{topic} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | $self->_refuse( 'topic', 'topic as an id ([a-z0-9-])' ) unless $self->valid_id( $head->{topic} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $out{topic} = $head->{topic}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my @tools; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if ( defined $head->{tools} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $l = $self->_list( $head->{tools}, 'suite.yaml: tools' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | for my $i ( 0 .. $#$l ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $tool = $self->tool( $l->[$i], 'suite.yaml: tools['.$i.']' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | $self->_refuse( 'suite.yaml: tools', 'tool '.$tool->{name}.' twice' ) if $seen{ $tool->{name} }++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | push @tools, $tool; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $id = $head->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | if ( defined $o{dirname} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | $self->_refuse( 'id', "must be '".$o{dirname}."' (the directory)" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | unless !ref $id && ( $id // '' ) eq $o{dirname} && $self->valid_id( $o{dirname} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition31%5/16
not ref $id and ($id // "") eq $o{"dirname"} and $self->valid_id($o{"dirname"})
not ref $id and ($id // "") eq $o{"dirname"}
$id // ""
not ref $id and ($id // "") eq $o{"dirname"} and $self->valid_id($o{"dirname"})
not ref $id and ($id // "") eq $o{"dirname"}
$id // ""
MC/DC0%0/3
not ref $id and ($id // "") eq $o{"dirname"} and $self->valid_id($o{"dirname"})
not ref $id
$id
$self->valid_id($o{"dirname"})
MC/DC0%0/3
not ref $id and ($id // "") eq $o{"dirname"} and $self->valid_id($o{"dirname"})
not ref $id
$id
$self->valid_id($o{"dirname"})
Truth table25%1/4
not(A) and B and C
A= not ref $idB= $idC= $self->valid_id($o{"dirname"})
Truth table0%0/4
not(A) and B and C
A= not ref $idB= $idC= $self->valid_id($o{"dirname"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | $self->_refuse( 'id', 'invalid id' ) unless $self->valid_id($id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my $version = $head->{version}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | $self->_refuse( 'version', 'integer >= 1' ) unless defined $version && !ref $version && $version =~ /\A[1-9]\d{0,5}\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%4/12
defined $version and not ref $version and $version =~ /\A[1-9]\d{0,5}\z/
defined $version and not ref $version
defined $version and not ref $version and $version =~ /\A[1-9]\d{0,5}\z/
defined $version and not ref $version
MC/DC33%1/3
defined $version and not ref $version and $version =~ /\A[1-9]\d{0,5}\z/
defined $version
not ref $version
$version =~ /\A[1-9]\d{0,5}\z/
MC/DC0%0/3
defined $version and not ref $version and $version =~ /\A[1-9]\d{0,5}\z/
defined $version
not ref $version
$version =~ /\A[1-9]\d{0,5}\z/
Truth table50%2/4
A and not(B) and C
A= defined $versionB= not ref $versionC= $version =~ /\A[1-9]\d{0,5}\z/
Truth table0%0/4
A and not(B) and C
A= defined $versionB= not ref $versionC= $version =~ /\A[1-9]\d{0,5}\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | my $defaults = $head->{defaults} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$head->{"defaults"} // {}
$$head{"defaults"} // {}
MC/DC100%1/1
$head->{"defaults"} // {}
$head->{"defaults"}
MC/DC0%0/1
$$head{"defaults"} // {}
$$head{"defaults"}
Truth table100%2/2
A
A= $head->{"defaults"}
Truth table0%0/2
A
A= $$head{"defaults"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $self->_keys_ok( $defaults, 'defaults', qw( system temperature max_tokens max_turns ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->_text( $head->{title}, 'title' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $self->_text( $head->{$_}, $_, 1 ) for qw( description license ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | $self->_source( $head->{source}, 'source' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | %out, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | version => 0 + $version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | title => $head->{title}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | defaults => $defaults, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | tools => \@tools, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | ( map { defined $head->{$_} ? ( $_ => $head->{$_} ) : () } qw( description license source ) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 627 | ▶ | sub _source { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_source: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | my ( $self, $src, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_source: not called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | return unless defined $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $self->_keys_ok( $src, $field, qw( title authors license url location ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $self->_text( $src->{title}, $field.'.title' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $self->_text( $src->{$_}, $field.'.'.$_, 1 ) for qw( authors license url location ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | return $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | #### Generated content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 403 | ▶ | sub generated { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generated: called CC=11 SCAR=34.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | my ( $self, $data, $f, %o ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generated: not called CC=11 SCAR=34.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | return @out unless ref $data eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 449 | ▶ | my $put = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | my ( $v, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | return unless ref $v eq 'HASH' || ref $v eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
ref $v eq "HASH" or ref $v eq "ARRAY"
ref $v eq "HASH" or ref $v eq "ARRAY"
MC/DC100%2/2
ref $v eq "HASH" or ref $v eq "ARRAY"
ref $v eq "HASH"
ref $v eq "ARRAY"
MC/DC0%0/2
ref $v eq "HASH" or ref $v eq "ARRAY"
ref $v eq "HASH"
ref $v eq "ARRAY"
Truth table100%3/3
A or B
A= ref $v eq "HASH"B= ref $v eq "ARRAY"
Truth table0%0/3
A or B
A= ref $v eq "HASH"B= ref $v eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | push @out, [ $field, $self->haystack->resolve( $v, $field ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ( ref $data->{messages} eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | for my $m ( @{ $data->{messages} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my $field = $f.': messages['.$i.'].content'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | $put->( $self->excerpt->expand( $m->{content}, $field, $o{dir} ), $field ) if ref $m eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | return @out unless ref $data->{state} eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | for my $dev ( sort keys %{ $data->{state} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | my $files = ref $data->{state}{$dev} eq 'HASH' ? $data->{state}{$dev}{files} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | next unless ref $files eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | for my $p ( sort keys %$files ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | $put->( $files->{$p}{content}, $f.': state.'.$dev.'.files.'.$p.'.content' ) if ref $files->{$p} eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | #### Cases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 412 | ▶ | sub case { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
case: called CC=52 SCAR=62.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | my ( $self, $data, %o ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
case: not called CC=52 SCAR=62.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | my $f = defined $o{file} ? 'cases/'.$o{file} : $o{field} // 'case'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%2/4
$o{"field"} // "case"
$o{"field"} // "case"
MC/DC100%1/1
$o{"field"} // "case"
$o{"field"}
MC/DC0%0/1
$o{"field"} // "case"
$o{"field"}
Truth table100%2/2
A
A= $o{"field"}
Truth table0%0/2
A
A= $o{"field"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $self->_keys_ok( $data, $f, @CASE_KEYS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | my $id = $data->{id} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$data->{"id"} // ""
$$data{"id"} // ""
MC/DC0%0/1
$data->{"id"} // ""
$data->{"id"}
MC/DC0%0/1
$$data{"id"} // ""
$$data{"id"}
Truth table50%1/2
A
A= $data->{"id"}
Truth table0%0/2
A
A= $$data{"id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if ( defined $o{file} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ( my $want = $o{file} ) =~ s/\.yaml\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | $self->_refuse( $f.': id', "must be '".$want."' (the file name)" ) unless !ref $id && $id eq $want; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
not ref $id and $id eq $want
not ref $id and $id eq $want
MC/DC50%1/2
not ref $id and $id eq $want
not ref $id
$id eq $want
MC/DC0%0/2
not ref $id and $id eq $want
not ref $id
$id eq $want
Truth table66%2/3
not(A) and B
A= not ref $idB= $id eq $want
Truth table0%0/3
not(A) and B
A= not ref $idB= $id eq $want
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | $self->_refuse( $f.': id', 'invalid id' ) unless $self->valid_id($id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # messages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | $self->_refuse( $f.': messages', 'list missing' ) unless ref $data->{messages} eq 'ARRAY' && @{ $data->{messages} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
ref $data->{"messages"} eq "ARRAY" and @{$data->{"messages"};}
ref $$data{"messages"} eq "ARRAY" and @{$$data{"messages"};}
MC/DC0%0/2
ref $data->{"messages"} eq "ARRAY" and @{$data->{"messages"};}
ref $data->{"messages"} eq "ARRAY"
@{$data->{"messages"};}
MC/DC0%0/2
ref $$data{"messages"} eq "ARRAY" and @{$$data{"messages"};}
ref $$data{"messages"} eq "ARRAY"
@{$$data{"messages"};}
Truth table33%1/3
A and B
A= ref $data->{"messages"} eq "ARRAY"B= @{$data->{"messages"};}
Truth table0%0/3
A and B
A= ref $$data{"messages"} eq "ARRAY"B= @{$$data{"messages"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my ( @prompt, %images ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | for my $m ( @{ $data->{messages} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $mf = $f.': messages['.$i.']'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $self->_keys_ok( $m, $mf, qw( role content untrusted images ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $self->_flag( $m->{untrusted}, $mf.'.untrusted' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | my $role = $m->{role} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$m->{"role"} // ""
$$m{"role"} // ""
MC/DC0%0/1
$m->{"role"} // ""
$m->{"role"}
MC/DC0%0/1
$$m{"role"} // ""
$$m{"role"}
Truth table50%1/2
A
A= $m->{"role"}
Truth table0%0/2
A
A= $$m{"role"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | $self->_refuse( $mf.'.role', 'user or assistant (the system prompt goes under system:)' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$role eq "user" or $role eq "assistant"
$role eq "user" or $role eq "assistant"
MC/DC100%2/2
$role eq "user" or $role eq "assistant"
$role eq "user"
$role eq "assistant"
MC/DC0%0/2
$role eq "user" or $role eq "assistant"
$role eq "user"
$role eq "assistant"
Truth table100%3/3
A or B
A= $role eq "user"B= $role eq "assistant"
Truth table0%0/3
A or B
A= $role eq "user"B= $role eq "assistant"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | unless $role eq 'user' || $role eq 'assistant'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my $content = $self->excerpt->expand( $m->{content}, $mf.'.content', $o{dir} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | $content = $self->haystack->resolve( $content, $mf.'.content' ) if ref $content; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $content = $self->_text( $content, $mf.'.content' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ( exists $m->{images} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | $self->_refuse( $mf.'.images', 'only on a user message' ) unless $role eq 'user'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my @parts = map { $self->_image( $_, $o{dir}, \%images ) } $self->_image_list( $m->{images}, $mf.'.images' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $content = [ { type => 'text', text => $content }, @parts ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | push @prompt, { role => $role, content => $content }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | $self->_refuse( $f.': messages', 'the last message must be from the user' ) unless $prompt[-1]{role} eq 'user'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # state, prepared once to check it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $initial = $self->_state( $data->{state}, $f.': state' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | my @tools = sort { $a->{name} cmp $b->{name} } @{ $o{tools} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$o{'tools'} || []
$o{'tools'} || []
MC/DC0%0/1
$o{'tools'} || []
$o{'tools'}
MC/DC0%0/1
$o{'tools'} || []
$o{'tools'}
Truth table50%1/2
A
A= $o{'tools'}
Truth table0%0/2
A
A= $o{'tools'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | $self->_refuse( $f.': tools', 'the suite offers no tools (suite.yaml: tools)' ) unless @tools; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my %tools = map { $_->{name} => 1 } @tools; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | my $ol = $self->_list( $data->{observe} // [], $f.': observe' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$data->{"observe"} // []
$$data{"observe"} // []
MC/DC100%1/1
$data->{"observe"} // []
$data->{"observe"}
MC/DC0%0/1
$$data{"observe"} // []
$$data{"observe"}
Truth table100%2/2
A
A= $data->{"observe"}
Truth table0%0/2
A
A= $$data{"observe"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | $self->_observe( $ol->[$_], $f.': observe['.$_.']' ) for 0 .. $#$ol; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $rl = $self->_list( $data->{rules}, $f.': rules', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my @kinds = map { $self->_rule( $rl->[$_], $f.': rules['.$_.']', \%tools, $data->{state} ) } 0 .. $#$rl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my @required = map { $kinds[$_] } grep { _required( $rl->[$_] ) } 0 .. $#$rl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | $self->_refuse( $f.': rules', 'at least one required rule' ) unless @required; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | # the "no tool" family: doing nothing is right. An empty solution only with the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # required rule only_tools: [] — then lint checks that every wrong solution fails. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | my $nothing = ref $data->{solution} eq 'ARRAY' && !@{ $data->{solution} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
ref $data->{'solution'} eq 'ARRAY' && !@{$data->{'solution'};}
ref $$data{'solution'} eq 'ARRAY' && !@{$$data{'solution'};}
MC/DC50%1/2
ref $data->{'solution'} eq 'ARRAY' && !@{$data->{'solution'};}
ref $data->{'solution'} eq 'ARRAY'
!@{$data->{'solution'};}
MC/DC0%0/2
ref $$data{'solution'} eq 'ARRAY' && !@{$$data{'solution'};}
ref $$data{'solution'} eq 'ARRAY'
!@{$$data{'solution'};}
Truth table66%2/3
A && not(B)
A= ref $data->{'solution'} eq 'ARRAY'B= !@{$data->{'solution'};}
Truth table0%0/3
A && not(B)
A= ref $$data{'solution'} eq 'ARRAY'B= !@{$$data{'solution'};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | $self->_refuse( $f.': solution', 'empty only with the required rule only_tools: [] (the "no tool" family)' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | if $nothing && !grep { _required( $_ ) && exists $_->{only_tools} && ref $_->{only_tools} eq 'ARRAY' && !@{ $_->{only_tools} } } @$rl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition41%10/24
$nothing and not grep({_required($_) and exists $_->{"only_tools"} and ref $_->{"only_tools"} eq "ARRAY" and not @{$_->{"only_tools"};};} @$rl)
_required($_) && exists $_->{'only_tools'} && ref $_->{'only_tools'} eq 'ARRAY' && !@{$_->{'only_tools'};}
_required($_) and exists $_->{"only_tools"} and ref $_->{"only_tools"} eq "ARRAY"
_required($_) and exists $_->{"only_tools"}
$nothing and not grep({_required($_) and exists $$_{"only_tools"} and ref $$_{"only_tools"} eq "ARRAY" and not @{$$_{"only_tools"};};} @$rl)
_required($_) && exists $$_{'only_tools'} && ref $$_{'only_tools'} eq 'ARRAY' && !@{$$_{'only_tools'};}
_required($_) and exists $$_{"only_tools"} and ref $$_{"only_tools"} eq "ARRAY"
_required($_) and exists $$_{"only_tools"}
MC/DC100%2/2
$nothing and not grep({_required($_) and exists $_->{"only_tools"} and ref $_->{"only_tools"} eq "ARRAY" and not @{$_->{"only_tools"};};} @$rl)
$nothing
not grep({_required($_) and exists $_->{"only_tools"} and ref $_->{"only_tools"} eq "ARRAY" and not @{$_->{"only_tools"};};} @$rl)
MC/DC50%2/4
_required($_) && exists $_->{'only_tools'} && ref $_->{'only_tools'} eq 'ARRAY' && !@{$_->{'only_tools'};}
_required($_)
exists $_->{"only_tools"}
ref $_->{"only_tools"} eq "ARRAY"
!@{$_->{'only_tools'};}
MC/DC0%0/2
$nothing and not grep({_required($_) and exists $$_{"only_tools"} and ref $$_{"only_tools"} eq "ARRAY" and not @{$$_{"only_tools"};};} @$rl)
$nothing
not grep({_required($_) and exists $$_{"only_tools"} and ref $$_{"only_tools"} eq "ARRAY" and not @{$$_{"only_tools"};};} @$rl)
MC/DC0%0/4
_required($_) && exists $$_{'only_tools'} && ref $$_{'only_tools'} eq 'ARRAY' && !@{$$_{'only_tools'};}
_required($_)
exists $$_{"only_tools"}
ref $$_{"only_tools"} eq "ARRAY"
!@{$$_{'only_tools'};}
Truth table100%3/3
A and not(B)
A= $nothingB= not grep({_required($_) and exists $_->{"only_tools"} and ref $_->{"only_tools"} eq "ARRAY" and not @{$_->{"only_tools"};};} @$rl)
Truth table60%3/5
A and B and C && not(D)
A= _required($_)B= exists $_->{"only_tools"}C= ref $_->{"only_tools"} eq "ARRAY"D= !@{$_->{'only_tools'};}
Truth table0%0/3
A and not(B)
A= $nothingB= not grep({_required($_) and exists $$_{"only_tools"} and ref $$_{"only_tools"} eq "ARRAY" and not @{$$_{"only_tools"};};} @$rl)
Truth table0%0/5
A and B and C && not(D)
A= _required($_)B= exists $$_{"only_tools"}C= ref $$_{"only_tools"} eq "ARRAY"D= !@{$$_{'only_tools'};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # a check command runs on the end state and so checks it too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | $self->_refuse( $f.': rules', 'at least one required rule on the end state (state, check, packet or login)' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | unless $nothing || grep { /\A(?:state|check|packet|login)\z/ } @required; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
$nothing or grep {/\A(?:state|check|packet|login)\z/;} @required
$nothing or grep {/\A(?:state|check|packet|login)\z/;} @required
MC/DC100%2/2
$nothing or grep {/\A(?:state|check|packet|login)\z/;} @required
$nothing
grep {/\A(?:state|check|packet|login)\z/;} @required
MC/DC0%0/2
$nothing or grep {/\A(?:state|check|packet|login)\z/;} @required
$nothing
grep {/\A(?:state|check|packet|login)\z/;} @required
Truth table100%3/3
A or B
A= $nothingB= grep {/\A(?:state|check|packet|login)\z/;} @required
Truth table0%0/3
A or B
A= $nothingB= grep {/\A(?:state|check|packet|login)\z/;} @required
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | for my $k (qw( alternatives wrong_solutions )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | next if $nothing && $k eq 'alternatives' && !exists $data->{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition41%5/12
$nothing and $k eq "alternatives" and not exists $data->{$k}
$nothing and $k eq "alternatives"
$nothing and $k eq "alternatives" and not exists $$data{$k}
$nothing and $k eq "alternatives"
MC/DC66%2/3
$nothing and $k eq "alternatives" and not exists $data->{$k}
$nothing
$k eq "alternatives"
not exists $data->{$k}
MC/DC0%0/3
$nothing and $k eq "alternatives" and not exists $$data{$k}
$nothing
$k eq "alternatives"
not exists $$data{$k}
Truth table75%3/4
A and B and not(C)
A= $nothingB= $k eq "alternatives"C= not exists $data->{$k}
Truth table0%0/4
A and B and not(C)
A= $nothingB= $k eq "alternatives"C= not exists $$data{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my $wl = $self->_list( $data->{$k}, $f.': '.$k, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | for my $j ( 0 .. $#$wl ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $wf = $f.': '.$k.'['.$j.']'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | $self->_keys_ok( $wl->[$j], $wf, qw( title calls ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $self->_text( $wl->[$j]{title}, $wf.'.title' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $self->_calls( $wl->[$j]{calls}, $wf.'.calls', \%tools ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | my $tags = $data->{tags} // []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$data->{"tags"} // []
$$data{"tags"} // []
MC/DC100%1/1
$data->{"tags"} // []
$data->{"tags"}
MC/DC0%0/1
$$data{"tags"} // []
$$data{"tags"}
Truth table100%2/2
A
A= $data->{"tags"}
Truth table0%0/2
A
A= $$data{"tags"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | $self->_refuse( $f.': tags', 'not a list of texts' ) unless ref $tags eq 'ARRAY' && !grep { ref } @$tags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
ref $tags eq "ARRAY" and not grep({ref $_;} @$tags)
ref $tags eq "ARRAY" and not grep({ref $_;} @$tags)
MC/DC0%0/2
ref $tags eq "ARRAY" and not grep({ref $_;} @$tags)
ref $tags eq "ARRAY"
not grep({ref $_;} @$tags)
MC/DC0%0/2
ref $tags eq "ARRAY" and not grep({ref $_;} @$tags)
ref $tags eq "ARRAY"
not grep({ref $_;} @$tags)
Truth table33%1/3
A and not(B)
A= ref $tags eq "ARRAY"B= not grep({ref $_;} @$tags)
Truth table0%0/3
A and not(B)
A= ref $tags eq "ARRAY"B= not grep({ref $_;} @$tags)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $difficulty = $data->{difficulty}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | $self->_refuse( $f.': difficulty', 'leicht, mittel or schwer' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | if defined $difficulty && !grep { $difficulty eq $_ } qw( leicht mittel schwer ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
defined $difficulty and not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
defined $difficulty and not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
MC/DC100%2/2
defined $difficulty and not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
defined $difficulty
not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
MC/DC0%0/2
defined $difficulty and not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
defined $difficulty
not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
Truth table100%3/3
A and not(B)
A= defined $difficultyB= not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
Truth table0%0/3
A and not(B)
A= defined $difficultyB= not grep({$difficulty eq $_;} "leicht", "mittel", "schwer")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | my $defaults = $o{defaults} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$o{'defaults'} || {}
$o{'defaults'} || {}
MC/DC0%0/1
$o{'defaults'} || {}
$o{'defaults'}
MC/DC0%0/1
$o{'defaults'} || {}
$o{'defaults'}
Truth table50%1/2
A
A= $o{'defaults'}
Truth table0%0/2
A
A= $o{'defaults'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my %range = ( temperature => [ 0, 2 ], max_tokens => [ 1, 200_000 ], max_turns => [ 1, 50 ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | for my $k ( sort keys %range ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | next unless exists $data->{$k} || exists $defaults->{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
exists $data->{$k} or exists $defaults->{$k}
exists $$data{$k} or exists $$defaults{$k}
MC/DC100%2/2
exists $data->{$k} or exists $defaults->{$k}
exists $data->{$k}
exists $defaults->{$k}
MC/DC0%0/2
exists $$data{$k} or exists $$defaults{$k}
exists $$data{$k}
exists $$defaults{$k}
Truth table100%3/3
A or B
A= exists $data->{$k}B= exists $defaults->{$k}
Truth table0%0/3
A or B
A= exists $$data{$k}B= exists $$defaults{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | $self->_num( exists $data->{$k} ? $data->{$k} : $defaults->{$k}, $f.': '.$k, @{ $range{$k} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $self->_num( $data->{weight}, $f.': weight', 0 ) if exists $data->{weight}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | $self->_refuse( $f.': weight', 'a positive number' ) if exists $data->{weight} && $data->{weight} <= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
exists $data->{"weight"} and $data->{"weight"} <= 0
exists $$data{"weight"} and $$data{"weight"} <= 0
MC/DC100%2/2
exists $data->{"weight"} and $data->{"weight"} <= 0
exists $data->{"weight"}
$data->{"weight"} <= 0
MC/DC0%0/2
exists $$data{"weight"} and $$data{"weight"} <= 0
exists $$data{"weight"}
$$data{"weight"} <= 0
Truth table100%3/3
A and B
A= exists $data->{"weight"}B= $data->{"weight"} <= 0
Truth table0%0/3
A and B
A= exists $$data{"weight"}B= $$data{"weight"} <= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $self->_text( $data->{title}, $f.': title' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | $self->_text( $data->{system} // $defaults->{system}, $f.': system', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$data->{"system"} // $defaults->{"system"}
$$data{"system"} // $$defaults{"system"}
MC/DC100%2/2
$data->{"system"} // $defaults->{"system"}
$data->{"system"}
$defaults->{"system"}
MC/DC0%0/2
$$data{"system"} // $$defaults{"system"}
$$data{"system"}
$$defaults{"system"}
Truth table100%3/3
A // B
A= $data->{"system"}B= $defaults->{"system"}
Truth table0%0/3
A // B
A= $$data{"system"}B= $$defaults{"system"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | $self->_calls( $data->{solution}, $f.': solution', \%tools ) unless $nothing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | $self->_source( $data->{source}, $f.': source' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | return Langertha::Holmgang::Case->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | ( map { exists $data->{$_} ? ( $_ => $data->{$_} ) : () } @CASE_KEYS ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | tools => \@tools, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | defaults => $defaults, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | simulators => $self->simulators, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | haystack => $self->haystack, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | initial_state => $initial, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | prompt_messages => \@prompt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | image_files => \%images, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | #### Images (k27) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 52 | ▶ | sub _image_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_image_list: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | my ( $self, $v, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_image_list: not called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $self->_list( $v, $field, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | $self->_refuse( $field, 'at most '.$IMAGES_PER_MESSAGE.' images per message' ) if @$v > $IMAGES_PER_MESSAGE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | return map { [ $v->[$_], $field.'['.$_.']' ] } 0 .. $#$v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # one image of a user message: checked, measured, recorded in %$seen by its | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # file; returns the placeholder that stands for it in the prompt messages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 69 | ▶ | sub _image { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_image: called CC=2 SCAR=9.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | ▶ | my ( $self, $entry, $dir, $seen ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_image: not called CC=2 SCAR=9.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | my ( $img, $field ) = @$entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | $self->_keys_ok( $img, $field, qw( file untrusted ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $self->_flag( $img->{untrusted}, $field.'.untrusted' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my $file = $self->_text( $img->{file}, $field.'.file' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | my $info = $seen->{$file} //= $self->image_file( $dir, $file, $field.'.file' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$seen->{$file} //= $self->image_file($dir, $file, $field . '.file')
$$seen{$file} //= $self->image_file($dir, $file, $field . '.file')
MC/DC0%0/2
$seen->{$file} //= $self->image_file($dir, $file, $field . '.file')
$seen->{$file}
$self->image_file($dir, $file, $field . '.file')
MC/DC0%0/2
$$seen{$file} //= $self->image_file($dir, $file, $field . '.file')
$$seen{$file}
$self->image_file($dir, $file, $field . '.file')
Truth table66%2/3
A //= B
A= $seen->{$file}B= $self->image_file($dir, $file, $field . '.file')
Truth table0%0/3
A //= B
A= $$seen{$file}B= $self->image_file($dir, $file, $field . '.file')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | return { image => $file, sha256 => $info->{sha256}, bytes => $info->{bytes} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 50 | ▶ | sub image_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
image_file: called CC=19 SCAR=44.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | my ( $self, $dir, $file, $field ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
image_file: not called CC=19 SCAR=44.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | $field //= 'image'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$field //= "image"
$field //= "image"
MC/DC0%0/1
$field //= "image"
$field
MC/DC0%0/1
$field //= "image"
$field
Truth table50%1/2
A
A= $field
Truth table0%0/2
A
A= $field
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | $self->_refuse( $field, 'an image needs the suite directory to be read from' ) unless defined $dir && length $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
defined $dir and length $dir
defined $dir and length $dir
MC/DC50%1/2
defined $dir and length $dir
defined $dir
length $dir
MC/DC0%0/2
defined $dir and length $dir
defined $dir
length $dir
Truth table66%2/3
A and B
A= defined $dirB= length $dir
Truth table0%0/3
A and B
A= defined $dirB= length $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | $self->_refuse( $field, 'a path relative to the suite directory, without .. or an empty segment' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | if $file =~ m{\A/|\\} || grep { $_ eq '..' || $_ eq '' } split m{/}, $file, -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition41%5/12
$file =~ m[\A/|\\] or grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
$_ eq '..' || $_ eq ''
$file =~ m[\A/|\\] or grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
$_ eq '..' || $_ eq ''
MC/DC100%2/2
$file =~ m[\A/|\\] or grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
$file =~ m[\A/|\\]
grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
MC/DC50%1/2
$_ eq '..' || $_ eq ''
$_ eq '..'
$_ eq ''
MC/DC0%0/2
$file =~ m[\A/|\\] or grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
$file =~ m[\A/|\\]
grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
MC/DC0%0/2
$_ eq '..' || $_ eq ''
$_ eq '..'
$_ eq ''
Truth table100%3/3
A or B
A= $file =~ m[\A/|\\]B= grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
Truth table66%2/3
A || B
A= $_ eq '..'B= $_ eq ''
Truth table0%0/3
A or B
A= $file =~ m[\A/|\\]B= grep {$_ eq ".." or $_ eq "";} split(m[/], $file, -1)
Truth table0%0/3
A || B
A= $_ eq '..'B= $_ eq ''
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | my $root = eval { path($dir)->realpath }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | $self->_refuse( $field, 'suite directory not readable: '.$dir ) unless $root && $root->is_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$root and $root->is_dir
$root and $root->is_dir
MC/DC0%0/2
$root and $root->is_dir
$root
$root->is_dir
MC/DC0%0/2
$root and $root->is_dir
$root
$root->is_dir
Truth table33%1/3
A and B
A= $rootB= $root->is_dir
Truth table0%0/3
A and B
A= $rootB= $root->is_dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | my $p = path( $root, $file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | $self->_refuse( $field, 'no such file in the suite' ) unless -e $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my $real = eval { $p->realpath }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | $self->_refuse( $field, 'outside the suite directory' ) unless $real && $root->subsumes($real); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$real and $root->subsumes($real)
$real and $root->subsumes($real)
MC/DC50%1/2
$real and $root->subsumes($real)
$real
$root->subsumes($real)
MC/DC0%0/2
$real and $root->subsumes($real)
$real
$root->subsumes($real)
Truth table66%2/3
A and B
A= $realB= $root->subsumes($real)
Truth table0%0/3
A and B
A= $realB= $root->subsumes($real)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | $self->_refuse( $field, 'not a plain file' ) unless -f $real; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $size = -s _; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | $self->_refuse( $field, 'larger than '.$IMAGE_MAX_BYTES.' bytes ('.$size.')' ) if $size > $IMAGE_MAX_BYTES; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $bytes = eval { $real->slurp_raw }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | $self->_refuse( $field, 'not readable' ) unless defined $bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | $self->_refuse( $field, 'larger than '.$IMAGE_MAX_BYTES.' bytes ('.length($bytes).')' ) if length $bytes > $IMAGE_MAX_BYTES; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my ( $type, $w, $h ) = image_measure($bytes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | $self->_refuse( $field, 'not a PNG or JPEG image (by its first bytes)' ) unless $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | $self->_refuse( $field, 'a '.$type.' whose width and height cannot be read' ) unless $w && $h; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$w and $h
$w and $h
MC/DC50%1/2
$w and $h
$w
$h
MC/DC0%0/2
$w and $h
$w
$h
Truth table66%2/3
A and B
A= $wB= $h
Truth table0%0/3
A and B
A= $wB= $h
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | file => $file, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | path => "$real", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | media_type => $type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | width => $w, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | height => $h, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | bytes => length $bytes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | sha256 => Digest::SHA::sha256_hex($bytes), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | # ( media type, width, height ) of PNG or JPEG bytes by their magic; the media | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | # type alone when the size cannot be read, the empty list for anything else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 48 | ▶ | sub image_measure { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
image_measure: called CC=19 SCAR=47.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | my ( $bytes ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
image_measure: not called CC=19 SCAR=47.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | if ( substr( $bytes, 0, 8 ) eq "\x89PNG\r\n\x1a\n" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | return ('image/png') unless length $bytes >= 24 && substr( $bytes, 12, 4 ) eq 'IHDR'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
length $bytes >= 24 and substr($bytes, 12, 4) eq "IHDR"
length $bytes >= 24 and substr($bytes, 12, 4) eq "IHDR"
MC/DC50%1/2
length $bytes >= 24 and substr($bytes, 12, 4) eq "IHDR"
length $bytes >= 24
substr($bytes, 12, 4) eq "IHDR"
MC/DC0%0/2
length $bytes >= 24 and substr($bytes, 12, 4) eq "IHDR"
length $bytes >= 24
substr($bytes, 12, 4) eq "IHDR"
Truth table66%2/3
A and B
A= length $bytes >= 24B= substr($bytes, 12, 4) eq "IHDR"
Truth table0%0/3
A and B
A= length $bytes >= 24B= substr($bytes, 12, 4) eq "IHDR"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | return ( 'image/png', unpack 'NN', substr( $bytes, 16, 8 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | if ( substr( $bytes, 0, 3 ) eq "\xFF\xD8\xFF" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my $at = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | my $n = length $bytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | while ( $at + 4 <= $n ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | return ('image/jpeg') unless substr( $bytes, $at, 1 ) eq "\xFF"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my $marker = ord substr( $bytes, $at + 1, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | if ( $marker == 0xFF ) { $at++; next } # fill byte | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | if ( $marker == 0x01 || ( $marker >= 0xD0 && $marker <= 0xD8 ) ) { $at += 2; next } # no length | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%3/12
$marker == 1 or $marker >= 208 and $marker <= 216
$marker >= 208 and $marker <= 216
$marker == 1 or $marker >= 208 and $marker <= 216
$marker >= 208 and $marker <= 216
MC/DC0%0/3
$marker == 1 or $marker >= 208 and $marker <= 216
$marker == 1
$marker >= 208
$marker <= 216
MC/DC0%0/3
$marker == 1 or $marker >= 208 and $marker <= 216
$marker == 1
$marker >= 208
$marker <= 216
Truth table50%2/4
A or B and C
A= $marker == 1B= $marker >= 208C= $marker <= 216
Truth table0%0/4
A or B and C
A= $marker == 1B= $marker >= 208C= $marker <= 216
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | last if $marker == 0xD9 || $marker == 0xDA; # end, scan data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$marker == 217 or $marker == 218
$marker == 217 or $marker == 218
MC/DC0%0/2
$marker == 217 or $marker == 218
$marker == 217
$marker == 218
MC/DC0%0/2
$marker == 217 or $marker == 218
$marker == 217
$marker == 218
Truth table33%1/3
A or B
A= $marker == 217B= $marker == 218
Truth table0%0/3
A or B
A= $marker == 217B= $marker == 218
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my $len = unpack 'n', substr( $bytes, $at + 2, 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | if ( $marker >= 0xC0 && $marker <= 0xCF && $marker != 0xC4 && $marker != 0xC8 && $marker != 0xCC ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%8/24
$marker >= 192 and $marker <= 207 and $marker != 196 and $marker != 200 and $marker != 204
$marker >= 192 and $marker <= 207 and $marker != 196 and $marker != 200
$marker >= 192 and $marker <= 207 and $marker != 196
$marker >= 192 and $marker <= 207
$marker >= 192 and $marker <= 207 and $marker != 196 and $marker != 200 and $marker != 204
$marker >= 192 and $marker <= 207 and $marker != 196 and $marker != 200
$marker >= 192 and $marker <= 207 and $marker != 196
$marker >= 192 and $marker <= 207
MC/DC20%1/5
$marker >= 192 and $marker <= 207 and $marker != 196 and $marker != 200 and $marker != 204
$marker >= 192
$marker <= 207
$marker != 196
$marker != 200
$marker != 204
MC/DC0%0/5
$marker >= 192 and $marker <= 207 and $marker != 196 and $marker != 200 and $marker != 204
$marker >= 192
$marker <= 207
$marker != 196
$marker != 200
$marker != 204
Truth table33%2/6
A and B and C and D and E
A= $marker >= 192B= $marker <= 207C= $marker != 196D= $marker != 200E= $marker != 204
Truth table0%0/6
A and B and C and D and E
A= $marker >= 192B= $marker <= 207C= $marker != 196D= $marker != 200E= $marker != 204
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | last unless $at + 9 <= $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my ( $h, $w ) = unpack 'nn', substr( $bytes, $at + 5, 4 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | return ( 'image/jpeg', $w, $h ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | $at += 2 + $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | return ('image/jpeg'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 732 | ▶ | sub _required { my ( $r ) = @_; return !exists $r->{required} || $r->{required} ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_required: called CC=3 SCAR=11.1
Branch: 1 branch
Condition66%2/3
not exists $r->{"required"} or $r->{"required"}
MC/DC50%1/2
not exists $r->{"required"} or $r->{"required"}
not exists $r->{"required"}
$r->{"required"}
Truth table66%2/3
not(A) or B
A= not exists $r->{"required"}B= $r->{"required"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # an observation: answer to a diagnostic command, may depend on the state, never changes it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 8 | ▶ | sub _observe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_observe: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 8 | my ( $self, $h, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 8 | $self->_keys_ok( $h, $field, qw( match when output error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 7 | ▶ | $self->_refuse( $field.'.match', 'host and command as patterns' ) unless ref $h->{match} eq 'HASH' && $h->{match}{command}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $h->{"match"} eq "HASH" and $h->{"match"}{"command"}
MC/DC50%1/2
ref $h->{"match"} eq "HASH" and $h->{"match"}{"command"}
ref $h->{"match"} eq "HASH"
$h->{"match"}{"command"}
Truth table66%2/3
A and B
A= ref $h->{"match"} eq "HASH"B= $h->{"match"}{"command"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 6 | ▶ | $self->_refuse( $field.'.output', 'text expected (may be empty)' ) if !defined $h->{output} || ref $h->{output}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $h->{"output"} or ref $h->{"output"}
MC/DC0%0/2
not defined $h->{"output"} or ref $h->{"output"}
not defined $h->{"output"}
ref $h->{"output"}
Truth table33%1/3
not(A) or B
A= not defined $h->{"output"}B= ref $h->{"output"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 6 | $self->_handler( $h, $field, qw( match when output error ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 6 | return $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # the state: devices (hashes with type) need a known simulator; generated file contents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # resolved, then prepared — the case's initial state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 388 | ▶ | sub _state { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_state: called CC=17 SCAR=31.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 388 | my ( $self, $state, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 388 | ▶ | $self->_refuse( $field, 'hash (the state of the world) missing' ) unless ref $state eq 'HASH' && %$state; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $state eq "HASH" and %$state
MC/DC0%0/2
ref $state eq "HASH" and %$state
ref $state eq "HASH"
%$state
Truth table33%1/3
A and B
A= ref $state eq "HASH"B= %$state
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 388 | my %types = map { $_ => 1 } $self->simulators->types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 388 | for my $k ( sort keys %$state ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 439 | ▶ | next unless ref $state->{$k} eq 'HASH' && exists $state->{$k}{type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $state->{$k} eq "HASH" and exists $state->{$k}{"type"}
MC/DC100%2/2
ref $state->{$k} eq "HASH" and exists $state->{$k}{"type"}
ref $state->{$k} eq "HASH"
exists $state->{$k}{"type"}
Truth table100%3/3
A and B
A= ref $state->{$k} eq "HASH"B= exists $state->{$k}{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 79 | ▶ | $self->_refuse( $field.'.'.$k.'.type', 'device type '.join( ', ', sort keys %types ) ) unless $types{ $state->{$k}{type} // '' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$state->{$k}{"type"} // ""
MC/DC0%0/1
$state->{$k}{"type"} // ""
$state->{$k}{"type"}
Truth table50%1/2
A
A= $state->{$k}{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 385 | $self->_plain( $state->{$_}, $field.'.'.$_ ) for sort keys %$state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 379 | my $s = Langertha::Holmgang::World->clone($state); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 379 | for my $dev ( sort keys %$s ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 424 | ▶ | my $files = ref $s->{$dev} eq 'HASH' ? $s->{$dev}{files} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 424 | ▶ | next unless ref $files eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 40 | for my $p ( sort keys %$files ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 40 | my $e = $files->{$p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 40 | ▶ | next unless ref $e eq 'HASH' && ref $e->{content}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $e eq "HASH" and ref $e->{"content"}
MC/DC0%0/2
ref $e eq "HASH" and ref $e->{"content"}
ref $e eq "HASH"
ref $e->{"content"}
Truth table33%1/3
A and B
A= ref $e eq "HASH"B= ref $e->{"content"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $e->{content} = $self->haystack->resolve( $e->{content}, $field.'.'.$dev.'.files.'.$p.'.content' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 379 | ▶ | eval { $self->simulators->prepare($s); 1 } or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | my $err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | die $err if Langertha::Holmgang::Error->caught($err); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | $self->_refuse( $field, "$err" =~ s/\s+\z//r ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 379 | return $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | # plain data only (k59): what the world's copy and the YAML export take | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1596 | ▶ | sub _plain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_plain: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1596 | my ( $self, $v, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1596 | my $r = ref $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 1596 | ▶ | return unless $r; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 528 | ▶ | return if blessed $v && $v->isa('JSON::PP::Boolean'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($v) and $v->isa("JSON::PP::Boolean")
MC/DC100%2/2
builtin::blessed($v) and $v->isa("JSON::PP::Boolean")
builtin::blessed($v)
$v->isa("JSON::PP::Boolean")
Truth table100%3/3
A and B
A= builtin::blessed($v)B= $v->isa("JSON::PP::Boolean")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 527 | ▶ | if ( $r eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 449 | $self->_plain( $v->{$_}, $field.'.'.$_ ) for sort keys %$v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 443 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 78 | ▶ | if ( $r eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 72 | $self->_plain( $v->[$_], $field.'['.$_.']' ) for 0 .. $#$v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 71 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 6 | ▶ | $self->_refuse( $field, 'not data: '.( $r eq 'CODE' ? 'a code reference' : 'a '.$r.' reference' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | .' (the state holds texts, numbers, booleans, hashes and lists)' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 1483 | ▶ | sub _call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_call: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 1483 | my ( $self, $c, $field, $tools, $with_args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 1483 | $self->_keys_ok( $c, $field, qw( tool args ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 1483 | my $tool = $self->_text( $c->{tool}, $field.'.tool' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 1483 | ▶ | $self->_refuse( $field.'.tool', "the case offers no tool '".$tool."'" ) unless $tools->{$tool}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 1482 | ▶ | my $args = $c->{args} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$c->{"args"} // {}
MC/DC100%1/1
$c->{"args"} // {}
$c->{"args"}
Truth table100%2/2
A
A= $c->{"args"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 1482 | ▶ | $self->_refuse( $field.'.args', 'not a hash' ) unless ref $args eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 1482 | ▶ | $self->_arg_patterns( $args, $field.'.args' ) unless $with_args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 1482 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 1080 | ▶ | sub _calls { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_calls: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 1080 | my ( $self, $l, $field, $tools ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 1080 | $self->_list( $l, $field, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 1080 | $self->_call( $l->[$_], $field.'['.$_.']', $tools, 1 ) for 0 .. $#$l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 1079 | return $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | # one rule; returns its kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 755 | ▶ | sub _rule { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rule: called CC=41 SCAR=41.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 755 | my ( $self, $r, $field, $tools, $state ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 755 | ▶ | $self->_refuse( $field, 'not a hash' ) unless ref $r eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 755 | my @kind = grep { exists $r->{$_} } @RULE_KINDS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 755 | ▶ | $self->_refuse( $field, 'exactly one kind: '.join( ', ', @RULE_KINDS ) ) unless @kind == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 754 | my $kind = $kind[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 754 | $self->_text( $r->{title}, $field.'.title' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 754 | my %rest = %$r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 754 | delete @rest{qw( title required )}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 754 | ▶ | if ( $kind eq 'state' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 400 | my $path = delete $rest{state}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 400 | $self->_matchers( { %rest, path => $path }, $field ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | elsif ( $kind eq 'check' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 9 | $self->_check_rule( \%rest, $field, $state ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | elsif ( $kind eq 'login' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 4 | $self->_keys_ok( \%rest, $field, qw( login result ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 4 | my $l = $r->{login}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 4 | $self->_keys_ok( $l, $field.'.login', qw( host user from key port iif daddr auth ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 3 | $self->_text( $l->{$_}, $field.'.login.'.$_ ) for qw( host user from ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 3 | ▶ | for my $k (qw( key iif daddr )) { $self->_text( $l->{$k}, $field.'.login.'.$k ) if defined $l->{$k} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 3 | ▶ | if ( defined $l->{port} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | $self->_refuse( $field.'.login.port', 'port 1-65535' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | ▶ | unless !ref $l->{port} && $l->{port} =~ /\A\d+\z/ && $l->{port} >= 1 && $l->{port} <= 65535; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not ref $l->{"port"} and $l->{"port"} =~ /\A\d+\z/ and $l->{"port"} >= 1 and $l->{"port"} <= 65535
not ref $l->{"port"} and $l->{"port"} =~ /\A\d+\z/ and $l->{"port"} >= 1
not ref $l->{"port"} and $l->{"port"} =~ /\A\d+\z/
MC/DC0%0/4
not ref $l->{"port"} and $l->{"port"} =~ /\A\d+\z/ and $l->{"port"} >= 1 and $l->{"port"} <= 65535
not ref $l->{"port"}
$l->{"port"} =~ /\A\d+\z/
$l->{"port"} >= 1
$l->{"port"} <= 65535
Truth table20%1/5
not(A) and B and C and D
A= not ref $l->{"port"}B= $l->{"port"} =~ /\A\d+\z/C= $l->{"port"} >= 1D= $l->{"port"} <= 65535
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 2 | ▶ | my $auth = $l->{auth} // ( defined $l->{key} ? 'publickey' : '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$l->{"auth"} // (defined $l->{"key"} ? "publickey" : "")
MC/DC100%1/1
$l->{"auth"} // (defined $l->{"key"} ? "publickey" : "")
$l->{"auth"}
Truth table100%2/2
A
A= $l->{"auth"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | $self->_refuse( $field.'.login.auth', 'publickey (with key) or password' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 2 | ▶ | unless $auth eq 'password' || ( $auth eq 'publickey' && defined $l->{key} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$auth eq "password" or $auth eq "publickey" and defined $l->{"key"}
$auth eq "publickey" and defined $l->{"key"}
MC/DC33%1/3
$auth eq "password" or $auth eq "publickey" and defined $l->{"key"}
$auth eq "password"
$auth eq "publickey"
defined $l->{"key"}
Truth table50%2/4
A or B and C
A= $auth eq "password"B= $auth eq "publickey"C= defined $l->{"key"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 1 | ▶ | my $v = $r->{result} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$r->{"result"} // ""
MC/DC0%0/1
$r->{"result"} // ""
$r->{"result"}
Truth table50%1/2
A
A= $r->{"result"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 1 | ▶ | $self->_refuse( $field.'.result', 'allowed or denied' ) unless !ref $v && ( $v eq 'allowed' || $v eq 'denied' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not ref $v and $v eq "allowed" || $v eq "denied"
$v eq "allowed" or $v eq "denied"
MC/DC0%0/3
not ref $v and $v eq "allowed" || $v eq "denied"
not ref $v
$v eq "allowed"
$v eq "denied"
Truth table25%1/4
not(A) and B or C
A= not ref $vB= $v eq "allowed"C= $v eq "denied"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | elsif ( $kind eq 'packet' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 7 | $self->_keys_ok( \%rest, $field, qw( packet verdict boot ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 7 | $self->_packet( $r->{packet}, $field.'.packet' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 3 | ▶ | my $v = $r->{verdict} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$r->{"verdict"} // ""
MC/DC0%0/1
$r->{"verdict"} // ""
$r->{"verdict"}
Truth table50%1/2
A
A= $r->{"verdict"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 3 | ▶ | $self->_refuse( $field.'.verdict', 'accept or drop' ) unless !ref $v && ( $v eq 'accept' || $v eq 'drop' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not ref $v and $v eq "accept" || $v eq "drop"
$v eq "accept" or $v eq "drop"
MC/DC33%1/3
not ref $v and $v eq "accept" || $v eq "drop"
not ref $v
$v eq "accept"
$v eq "drop"
Truth table50%2/4
not(A) and B or C
A= not ref $vB= $v eq "accept"C= $v eq "drop"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 2 | ▶ | if ( my $b = $r->{boot} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | ▶ | $self->_refuse( $field.'.boot', 'true or an absolute path' ) unless !ref $b || "$b" eq '1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not ref $b or "$b" eq 1
MC/DC0%0/2
not ref $b or "$b" eq 1
not ref $b
"$b" eq 1
Truth table33%1/3
not(A) or B
A= not ref $bB= "$b" eq 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 334 | $self->_keys_ok( \%rest, $field, $kind ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 334 | ▶ | if ( $kind eq 'unchanged_except' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 298 | my $p = $self->_list( $r->{unchanged_except}, $field.'.unchanged_except' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 298 | $self->_path( $p->[$_], $field.'.unchanged_except['.$_.']' ) for 0 .. $#$p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | elsif ( $kind eq 'only_tools' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 14 | my $l = $self->_list( $r->{only_tools}, $field.'.only_tools' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 13 | for my $i ( 0 .. $#$l ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 10 | my $t = $l->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | $self->_refuse( $field.'.only_tools['.$i.']', "the case offers no tool '".( $t // '' )."'" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 10 | ▶ | unless defined $t && !ref $t && $tools->{$t}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%4/8
defined $t and not ref $t and $tools->{$t}
defined $t and not ref $t
$t // ""
MC/DC33%1/3
defined $t and not ref $t and $tools->{$t}
defined $t
not ref $t
$tools->{$t}
MC/DC0%0/1
$t // ""
$t
Truth table50%2/4
A and not(B) and C
A= defined $tB= not ref $tC= $tools->{$t}
Truth table50%1/2
A
A= $t
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | elsif ( $kind eq 'calls' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 3 | my $l = $self->_list( $r->{calls}, $field.'.calls', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 3 | $self->_call( $l->[$_], $field.'.calls['.$_.']', $tools ) for 0 .. $#$l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 19 | $self->_call( $r->{not_called}, $field.'.not_called', $tools ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 727 | return $kind; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | # rule check: a command { host, command } on a copy of the end state, expect { exit, output, lines } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 9 | ▶ | sub _check_rule { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_rule: called CC=10 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 9 | my ( $self, $r, $field, $state ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 9 | $self->_keys_ok( $r, $field, qw( check expect ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 9 | my $c = $r->{check}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 9 | ▶ | $self->_refuse( $field.'.check', 'hash { host, command } expected' ) unless ref $c eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 9 | $self->_keys_ok( $c, $field.'.check', qw( host command ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 9 | my $host = $self->_text( $c->{host}, $field.'.check.host' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 9 | ▶ | $self->_refuse( $field.'.check.host', "no device '".$host."' in the state" ) unless ref( ( $state || {} )->{$host} ) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$state || {}
MC/DC0%0/1
$state || {}
$state
Truth table50%1/2
A
A= $state
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 8 | my $e = $r->{expect}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 8 | ▶ | $self->_refuse( $field.'.expect', 'hash { exit, output, lines } missing' ) unless ref $e eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 7 | $self->_keys_ok( $e, $field.'.expect', qw( exit output lines ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 7 | ▶ | $self->_refuse( $field.'.expect', 'at least one expectation: exit, output or lines' ) unless grep { exists $e->{$_} } qw( exit output lines ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 6 | ▶ | $self->_num( $e->{exit}, $field.'.expect.exit', 0, 255 ) if exists $e->{exit}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 5 | for my $k (qw( output lines )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 10 | ▶ | next unless exists $e->{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 5 | ▶ | $self->_refuse( $field.'.expect.'.$k, 'hash of expectations expected' ) unless ref $e->{$k} eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 5 | $self->_matchers( $e->{$k}, $field.'.expect.'.$k, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 5 | $self->_text( $c->{command}, $field.'.check.command' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | # the packet of a rule packet: fields and values checked | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 7 | ▶ | sub _packet { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_packet: called CC=26 SCAR=38.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 7 | my ( $self, $p, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 7 | $self->_keys_ok( $p, $field, qw( host hook iif oif saddr daddr proto sport dport icmp_type icmp_code ct ct_status ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 7 | $self->_text( $p->{host}, $field.'.host' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 7 | ▶ | $self->_refuse( $field.'.hook', join( '|', sort keys %HOOK ) ) unless !ref $p->{hook} && $HOOK{ $p->{hook} // '' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
not ref $p->{"hook"} and $HOOK{$p->{"hook"} // ""}
$p->{"hook"} // ""
MC/DC50%1/2
not ref $p->{"hook"} and $HOOK{$p->{"hook"} // ""}
not ref $p->{"hook"}
$HOOK{$p->{"hook"} // ""}
MC/DC0%0/1
$p->{"hook"} // ""
$p->{"hook"}
Truth table66%2/3
not(A) and B
A= not ref $p->{"hook"}B= $HOOK{$p->{"hook"} // ""}
Truth table50%1/2
A
A= $p->{"hook"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 6 | my %fam; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 6 | for my $k (qw( saddr daddr )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 12 | my $a = $self->_text( $p->{$k}, $field.'.'.$k ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 12 | ▶ | $self->_refuse( $field.'.'.$k, 'IPv4 or IPv6 address' ) unless $a =~ /\A\d+\.\d+\.\d+\.\d+\z|\A[0-9a-f:]*:[0-9a-f:]*\z/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 12 | ▶ | $fam{$k} = $a =~ /:/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 6 | ▶ | $self->_refuse( $field.'.daddr', 'same family as saddr' ) unless $fam{saddr} == $fam{daddr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 5 | ▶ | $self->_refuse( $field.'.proto', join( '|', sort keys %L4 ) ) unless !ref $p->{proto} && $L4{ $p->{proto} // '' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
not ref $p->{"proto"} and $L4{$p->{"proto"} // ""}
$p->{"proto"} // ""
MC/DC0%0/2
not ref $p->{"proto"} and $L4{$p->{"proto"} // ""}
not ref $p->{"proto"}
$L4{$p->{"proto"} // ""}
MC/DC0%0/1
$p->{"proto"} // ""
$p->{"proto"}
Truth table33%1/3
not(A) and B
A= not ref $p->{"proto"}B= $L4{$p->{"proto"} // ""}
Truth table50%1/2
A
A= $p->{"proto"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 5 | ▶ | my $l4 = $p->{proto} eq 'tcp' || $p->{proto} eq 'udp'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$p->{'proto'} eq 'tcp' || $p->{'proto'} eq 'udp'
MC/DC50%1/2
$p->{'proto'} eq 'tcp' || $p->{'proto'} eq 'udp'
$p->{'proto'} eq 'tcp'
$p->{'proto'} eq 'udp'
Truth table66%2/3
A || B
A= $p->{'proto'} eq 'tcp'B= $p->{'proto'} eq 'udp'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 5 | for my $k (qw( sport dport )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 10 | ▶ | next unless defined $p->{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 4 | ▶ | $self->_refuse( $field.'.'.$k, 'port 1-65535' ) unless !ref $p->{$k} && $p->{$k} =~ /\A\d+\z/ && $p->{$k} >= 1 && $p->{$k} <= 65535; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not ref $p->{$k} and $p->{$k} =~ /\A\d+\z/ and $p->{$k} >= 1 and $p->{$k} <= 65535
not ref $p->{$k} and $p->{$k} =~ /\A\d+\z/ and $p->{$k} >= 1
not ref $p->{$k} and $p->{$k} =~ /\A\d+\z/
MC/DC0%0/4
not ref $p->{$k} and $p->{$k} =~ /\A\d+\z/ and $p->{$k} >= 1 and $p->{$k} <= 65535
not ref $p->{$k}
$p->{$k} =~ /\A\d+\z/
$p->{$k} >= 1
$p->{$k} <= 65535
Truth table20%1/5
not(A) and B and C and D
A= not ref $p->{$k}B= $p->{$k} =~ /\A\d+\z/C= $p->{$k} >= 1D= $p->{$k} <= 65535
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 4 | ▶ | $self->_refuse( $field.'.'.$k, 'only with tcp/udp' ) unless $l4; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 4 | ▶ | $self->_refuse( $field.'.dport', 'missing (tcp/udp)' ) if $l4 && !defined $p->{dport}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$l4 and not defined $p->{"dport"}
MC/DC50%1/2
$l4 and not defined $p->{"dport"}
$l4
not defined $p->{"dport"}
Truth table66%2/3
A and not(B)
A= $l4B= not defined $p->{"dport"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 3 | ▶ | for my $k (qw( iif oif icmp_type icmp_code ct_status )) { $self->_text( $p->{$k}, $field.'.'.$k ) if defined $p->{$k} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 3 | ▶ | if ( defined $p->{ct} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | $self->_refuse( $field.'.ct', 'new|established|related|invalid' ) unless !ref $p->{ct} && $p->{ct} =~ /\A(?:new|established|related|invalid)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $p->{"ct"} and $p->{"ct"} =~ /\A(?:new|established|related|invalid)\z/
MC/DC0%0/2
not ref $p->{"ct"} and $p->{"ct"} =~ /\A(?:new|established|related|invalid)\z/
not ref $p->{"ct"}
$p->{"ct"} =~ /\A(?:new|established|related|invalid)\z/
Truth table0%0/3
not(A) and B
A= not ref $p->{"ct"}B= $p->{"ct"} =~ /\A(?:new|established|related|invalid)\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 36 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||