blib/lib/Langertha/Holmgang/ToolSchema.pm

filter: Statementstmt 58.4% 97 / 166 Branchbran 47.8% 90 / 188 Conditioncond 43.6% 75 / 172 MC/DCmcdc 40.4% 38 / 94 Subroutinesub 78.5% 11 / 14 Podpod 100% 4 / 4 totaltotal 49.3% 315 / 638 CC 167 SCAR 52.7
CC
167
Cov
50%
schema_errors
261.7
schema_errors
261.7
check_schema
189.8
CRAP 193.8
« blib/lib/Langertha/Holmgang/Sim/Linux/Nft.pm ↑ Summary blib/lib/Langertha/Holmgang/Sim/Linux/Pki.pm »
1 package Langertha::Holmgang::ToolSchema;
2 # ABSTRACT: The JSON Schema subset of tool parameters, checked at load and per call
3  
4 42 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 42 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 42 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 42 ▶use Exporter qw( import );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 42 ▶use JSON::MaybeXS ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 42 ▶use Langertha::Holmgang::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 42 ▶use Langertha::Holmgang::Expectation qw( same_scalar );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 42 our $VERSION = '0.001';
14  
15 42 our @EXPORT_OK = qw( check_schema schema_errors );
16  
17 # the subset of JSON Schema a tool's parameters may use; a true constant
18 42 our @SCHEMA_KEYS = qw( type required properties items enum const pattern
19 minLength maxLength minimum maximum minItems maxItems description title );
20  
21 42 my %TYPE = map { $_ => 1 } qw( object array string number integer boolean null );
22  
23  
24 16 ▶sub _refuse { Langertha::Holmgang::Error->throw(@_) }
Subroutine _refuse: called CC=1 SCAR=0.0
25  
26  
27 1414 ▶sub check_schema {
Subroutine check_schema: called CC=32 SCAR=52.5
Pod documented
28 0 ▶ my ( $s, $field ) = @_;
Subroutine check_schema: not called CC=32 SCAR=52.5
Pod documented
29 0 ▶ _refuse( $field, 'not a hash' ) unless ref $s eq 'HASH';
Branch: 2 branches
BranchTrueFalseTotal
unless ref $s eq "HASH" 0 1414 1414
unless ref $s eq "HASH" 0 0 0
30 0 for my $k ( sort keys %$s ) {
31 0 ▶ _refuse( $field.'.'.$k, 'unknown key' ) unless grep { $_ eq $k } @SCHEMA_KEYS;
Branch: 2 branches
BranchTrueFalseTotal
unless grep {$_ eq $k;} @Langertha::Holmgang::ToolSchema::SCHEMA_KEYS 3 2705 2708
unless grep {$_ eq $k;} @Langertha::Holmgang::ToolSchema::SCHEMA_KEYS 0 0 0
32 }
33 0 ▶ if ( exists $s->{type} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $s->{"type"}) 1395 16 1411
if (exists $s->{"type"}) 0 0 0
34 0 my $t = $s->{type};
35 0 ▶ if ( ref $t eq 'ARRAY' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $t eq 'ARRAY') { } 11 1384 1395
if (ref $t eq 'ARRAY') { } 0 0 0
36 0 ▶ _refuse( $field.'.type', 'empty list' ) unless @$t;
Branch: 2 branches
BranchTrueFalseTotal
unless @$t 1 10 11
unless @$t 0 0 0
37 0 my %seen;
38 0 for my $i ( 0 .. $#$t ) {
39 0 my $x = $t->[$i];
40 0 ▶ _refuse( $field.'.type['.$i.']', 'unknown type' ) unless defined $x && !ref $x && $TYPE{$x};
Branch: 2 branches
BranchTrueFalseTotal
unless defined $x and not ref $x and $TYPE{$x} 3 17 20
unless defined $x and not ref $x and $TYPE{$x} 0 0 0
Condition50%6/12
defined $x and not ref $x and $TYPE{$x}
!ll&&!rl&&r
2117
defined $x and not ref $x
!ll&&!rl&&r
1118
defined $x and not ref $x and $TYPE{$x}
!ll&&!rl&&r
000
defined $x and not ref $x
!ll&&!rl&&r
000
MC/DC100%3/3
defined $x and not ref $x and $TYPE{$x}
defined $x not ref $x $TYPE{$x}
MC/DC0%0/3
defined $x and not ref $x and $TYPE{$x}
defined $x not ref $x $TYPE{$x}
Truth table100%4/4
A and not(B) and C
A= defined $xB= not ref $xC= $TYPE{$x}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $xB= not ref $xC= $TYPE{$x}
ABCresult
0XX0
10X0
1100
1111
41 0 ▶ _refuse( $field.'.type['.$i.']', 'named twice' ) if $seen{$x}++;
Branch: 2 branches
BranchTrueFalseTotal
if $seen{$x}++ 1 16 17
if $seen{$x}++ 0 0 0
42 }
43 }
44 else {
45 0 ▶ _refuse( $field.'.type', 'unknown type' ) unless defined $t && !ref $t && $TYPE{$t};
Branch: 2 branches
BranchTrueFalseTotal
unless defined $t and not ref $t and $TYPE{$t} 2 1382 1384
unless defined $t and not ref $t and $TYPE{$t} 0 0 0
Condition41%5/12
defined $t and not ref $t and $TYPE{$t}
!ll&&!rl&&r
111382
defined $t and not ref $t
!ll&&!rl&&r
011383
defined $t and not ref $t and $TYPE{$t}
!ll&&!rl&&r
000
defined $t and not ref $t
!ll&&!rl&&r
000
MC/DC66%2/3
defined $t and not ref $t and $TYPE{$t}
defined $t not ref $t $TYPE{$t}
MC/DC0%0/3
defined $t and not ref $t and $TYPE{$t}
defined $t not ref $t $TYPE{$t}
Truth table75%3/4
A and not(B) and C
A= defined $tB= not ref $tC= $TYPE{$t}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $tB= not ref $tC= $TYPE{$t}
ABCresult
0XX0
10X0
1100
1111
46 }
47 }
48 0 ▶ if ( exists $s->{pattern} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $s->{"pattern"}) 3 1401 1404
if (exists $s->{"pattern"}) 0 0 0
49 0 my $p = $s->{pattern};
50 0 ▶ _refuse( $field.'.pattern', 'text missing' ) if !defined $p || ref $p || !length $p;
Branch: 2 branches
BranchTrueFalseTotal
if not defined $p or ref $p or not length $p 0 3 3
if not defined $p or ref $p or not length $p 0 0 0
Condition16%2/12
not defined $p or ref $p or not length $p
l!l&&r!l&&!r
003
not defined $p or ref $p
l!l&&r!l&&!r
003
not defined $p or ref $p or not length $p
l!l&&r!l&&!r
000
not defined $p or ref $p
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $p or ref $p or not length $p
not defined $p ref $p not length $p
MC/DC0%0/3
not defined $p or ref $p or not length $p
not defined $p ref $p not length $p
Truth table25%1/4
not(A) or B or not(C)
A= not defined $pB= ref $pC= not length $p
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/4
not(A) or B or not(C)
A= not defined $pB= ref $pC= not length $p
ABCresult
1XX1
01X1
0011
0000
51 0 ▶ _refuse( $field.'.pattern', 'invalid regular expression' ) unless eval { qr/$p/; 1 };
Branch: 2 branches
BranchTrueFalseTotal
unless eval { do { qr/$p/; 1 } } 1 2 3
unless eval { do { qr/$p/; 1 } } 0 0 0
52 }
53 0 ▶ if ( exists $s->{properties} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $s->{"properties"}) 540 863 1403
if (exists $s->{"properties"}) 0 0 0
54 0 ▶ _refuse( $field.'.properties', 'not a hash' ) unless ref $s->{properties} eq 'HASH';
Branch: 2 branches
BranchTrueFalseTotal
unless ref $s->{"properties"} eq "HASH" 1 539 540
unless ref $s->{"properties"} eq "HASH" 0 0 0
55 0 check_schema( $s->{properties}{$_}, $field.'.properties.'.$_ ) for sort keys %{ $s->{properties} };
56 }
57 0 ▶ check_schema( $s->{items}, $field.'.items' ) if exists $s->{items};
Branch: 2 branches
BranchTrueFalseTotal
if exists $s->{"items"} 10 1388 1398
if exists $s->{"items"} 0 0 0
58 0 ▶ _refuse( $field.'.required', 'not a list' ) if exists $s->{required} && ref $s->{required} ne 'ARRAY';
Branch: 2 branches
BranchTrueFalseTotal
if exists $s->{"required"} and ref $s->{"required"} ne "ARRAY" 1 1396 1397
if exists $s->{"required"} and ref $s->{"required"} ne "ARRAY" 0 0 0
Condition50%3/6
exists $s->{"required"} and ref $s->{"required"} ne "ARRAY"
!ll&&!rl&&r
8745221
exists $s->{"required"} and ref $s->{"required"} ne "ARRAY"
!ll&&!rl&&r
000
MC/DC100%2/2
exists $s->{"required"} and ref $s->{"required"} ne "ARRAY"
exists $s->{"required"} ref $s->{"required"} ne "ARRAY"
MC/DC0%0/2
exists $s->{"required"} and ref $s->{"required"} ne "ARRAY"
exists $s->{"required"} ref $s->{"required"} ne "ARRAY"
Truth table100%3/3
A and B
A= exists $s->{"required"}B= ref $s->{"required"} ne "ARRAY"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $s->{"required"}B= ref $s->{"required"} ne "ARRAY"
ABresult
0X0
100
111
59 0 ▶ _refuse( $field.'.enum', 'not a list' ) if exists $s->{enum} && ref $s->{enum} ne 'ARRAY';
Branch: 2 branches
BranchTrueFalseTotal
if exists $s->{"enum"} and ref $s->{"enum"} ne "ARRAY" 1 1395 1396
if exists $s->{"enum"} and ref $s->{"enum"} ne "ARRAY" 0 0 0
Condition50%3/6
exists $s->{"enum"} and ref $s->{"enum"} ne "ARRAY"
!ll&&!rl&&r
11902051
exists $s->{"enum"} and ref $s->{"enum"} ne "ARRAY"
!ll&&!rl&&r
000
MC/DC100%2/2
exists $s->{"enum"} and ref $s->{"enum"} ne "ARRAY"
exists $s->{"enum"} ref $s->{"enum"} ne "ARRAY"
MC/DC0%0/2
exists $s->{"enum"} and ref $s->{"enum"} ne "ARRAY"
exists $s->{"enum"} ref $s->{"enum"} ne "ARRAY"
Truth table100%3/3
A and B
A= exists $s->{"enum"}B= ref $s->{"enum"} ne "ARRAY"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $s->{"enum"}B= ref $s->{"enum"} ne "ARRAY"
ABresult
0X0
100
111
60 _refuse( $field.'.const', 'not a scalar' )
61 0 ▶ if exists $s->{const} && ( !defined $s->{const} || ref $s->{const} && !JSON::MaybeXS::is_bool( $s->{const} ) );
Branch: 2 branches
BranchTrueFalseTotal
if exists $s->{"const"} and !defined($s->{"const"}) || ref $s->{"const"} && !JSON::MaybeXS::is_bool($s->{"const"}) 2 1393 1395
if exists $s->{"const"} and !defined($s->{"const"}) || ref $s->{"const"} && !JSON::MaybeXS::is_bool($s->{"const"}) 0 0 0
Condition50%9/18
exists $s->{"const"} and !defined($s->{"const"}) || ref $s->{"const"} && !JSON::MaybeXS::is_bool($s->{"const"})
!ll&&!rl&&r
139032
not defined $s->{"const"} or ref $s->{"const"} and not JSON::MaybeXS::is_bool($s->{"const"})
l!l&&r!l&&!r
113
ref $s->{"const"} and not JSON::MaybeXS::is_bool($s->{"const"})
!ll&&!rl&&r
211
exists $s->{"const"} and !defined($s->{"const"}) || ref $s->{"const"} && !JSON::MaybeXS::is_bool($s->{"const"})
!ll&&!rl&&r
000
not defined $s->{"const"} or ref $s->{"const"} and not JSON::MaybeXS::is_bool($s->{"const"})
l!l&&r!l&&!r
000
ref $s->{"const"} and not JSON::MaybeXS::is_bool($s->{"const"})
!ll&&!rl&&r
000
MC/DC100%4/4
exists $s->{"const"} and !defined($s->{"const"}) || ref $s->{"const"} && !JSON::MaybeXS::is_bool($s->{"const"})
exists $s->{"const"} not defined $s->{"const"} ref $s->{"const"} not JSON::MaybeXS::is_bool($s->{"const"})
MC/DC0%0/4
exists $s->{"const"} and !defined($s->{"const"}) || ref $s->{"const"} && !JSON::MaybeXS::is_bool($s->{"const"})
exists $s->{"const"} not defined $s->{"const"} ref $s->{"const"} not JSON::MaybeXS::is_bool($s->{"const"})
Truth table100%5/5
A and not(B) or C and not(D)
A= exists $s->{"const"}B= not defined $s->{"const"}C= ref $s->{"const"}D= not JSON::MaybeXS::is_bool($s->{"const"})
ABCDresult
0XXX0
100X0
10100
11XX1
10111
Truth table0%0/5
A and not(B) or C and not(D)
A= exists $s->{"const"}B= not defined $s->{"const"}C= ref $s->{"const"}D= not JSON::MaybeXS::is_bool($s->{"const"})
ABCDresult
0XXX0
100X0
10100
11XX1
10111
62 0 return $s;
63 }
64  
65 5578 ▶sub _is_type {
Subroutine _is_type: called CC=13 SCAR=38.9
66 0 ▶ my ( $d, $t ) = @_;
Subroutine _is_type: not called CC=13 SCAR=38.9
67 0 ▶ return $t eq 'object' ? ref $d eq 'HASH'
Branch: 14 branches
BranchTrueFalseTotal
$t eq 'object' ? : 2367 3211 5578
$t eq 'array' ? : 75 3136 3211
$t eq 'null' ? : 11 3125 3136
$t eq 'boolean' ? : 63 3062 3125
$t eq 'integer' ? : 375 2687 3062
$t eq 'number' ? : 38 2649 2687
$t eq 'string' ? : 2649 0 2649
$t eq 'object' ? : 0 0 0
$t eq 'array' ? : 0 0 0
$t eq 'null' ? : 0 0 0
$t eq 'boolean' ? : 0 0 0
$t eq 'integer' ? : 0 0 0
$t eq 'number' ? : 0 0 0
$t eq 'string' ? : 0 0 0
Condition33%10/30
defined $d and not ref $d and "$d" =~ /\A-?\d+\z/
!ll&&!rl&&r
13371
defined $d and not ref $d
!ll&&!rl&&r
01374
defined $d and not ref $d and "$d" =~ /\A-?\d+(?:\.\d+)?\z/
!ll&&!rl&&r
0038
defined $d and not ref $d
!ll&&!rl&&r
0038
defined $d and not ref $d
!ll&&!rl&&r
322644
defined $d and not ref $d and "$d" =~ /\A-?\d+\z/
!ll&&!rl&&r
000
defined $d and not ref $d
!ll&&!rl&&r
000
defined $d and not ref $d and "$d" =~ /\A-?\d+(?:\.\d+)?\z/
!ll&&!rl&&r
000
defined $d and not ref $d
!ll&&!rl&&r
000
defined $d and not ref $d
!ll&&!rl&&r
000
MC/DC66%2/3
defined $d and not ref $d and "$d" =~ /\A-?\d+\z/
defined $d not ref $d "$d" =~ /\A-?\d+\z/
MC/DC0%0/3
defined $d and not ref $d and "$d" =~ /\A-?\d+(?:\.\d+)?\z/
defined $d not ref $d "$d" =~ /\A-?\d+(?:\.\d+)?\z/
MC/DC0%0/3
defined $d and not ref $d and "$d" =~ /\A-?\d+\z/
defined $d not ref $d "$d" =~ /\A-?\d+\z/
MC/DC0%0/3
defined $d and not ref $d and "$d" =~ /\A-?\d+(?:\.\d+)?\z/
defined $d not ref $d "$d" =~ /\A-?\d+(?:\.\d+)?\z/
Truth table75%3/4
A and not(B) and C
A= defined $dB= not ref $dC= "$d" =~ /\A-?\d+\z/
ABCresult
0XX0
10X0
1100
1111
Truth table25%1/4
A and not(B) and C
A= defined $dB= not ref $dC= "$d" =~ /\A-?\d+(?:\.\d+)?\z/
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $dB= not ref $dC= "$d" =~ /\A-?\d+\z/
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and not(B) and C
A= defined $dB= not ref $dC= "$d" =~ /\A-?\d+(?:\.\d+)?\z/
ABCresult
0XX0
10X0
1100
1111
68 : $t eq 'array' ? ref $d eq 'ARRAY'
69 : $t eq 'null' ? !defined $d
70 : $t eq 'boolean' ? JSON::MaybeXS::is_bool($d)
71 : $t eq 'integer' ? ( defined $d && !ref $d && "$d" =~ /\A-?\d+\z/ )
72 : $t eq 'number' ? ( defined $d && !ref $d && "$d" =~ /\A-?\d+(?:\.\d+)?\z/ )
73 : $t eq 'string' ? ( defined $d && !ref $d )
74 : 0;
75 }
76  
77  
78 5594 ▶sub schema_errors {
Subroutine schema_errors: called CC=41 SCAR=55.7
Pod documented
79 0 ▶ my ( $d, $s, $at ) = @_;
Subroutine schema_errors: not called CC=41 SCAR=55.7
Pod documented
80 0 ▶ $at //= '$';
Condition50%2/4
$at //= "\$"
l!l
32842310
$at //= "\$"
l!l
00
MC/DC100%1/1
$at //= "\$"
$at
MC/DC0%0/1
$at //= "\$"
$at
Truth table100%2/2
A
A= $at
Aresult
11
00
Truth table0%0/2
A
A= $at
Aresult
11
00
81 0 ▶ return () unless ref $s eq 'HASH';
Branch: 2 branches
BranchTrueFalseTotal
unless ref $s eq "HASH" 1 5593 5594
unless ref $s eq "HASH" 0 0 0
82 0 my @e;
83 0 ▶ if ( defined( my $t = $s->{type} ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined(my $t = $s->{"type"})) 5565 28 5593
if (defined(my $t = $s->{"type"})) 0 0 0
84 0 ▶ my @t = ref $t eq 'ARRAY' ? @$t : $t;
Branch: 2 branches
BranchTrueFalseTotal
ref $t eq 'ARRAY' ? : 13 5552 5565
ref $t eq 'ARRAY' ? : 0 0 0
85 0 ▶ return ( $at.': erwartet '.join( ' oder ', @t ) ) unless grep { _is_type( $d, $_ ) } @t;
Branch: 2 branches
BranchTrueFalseTotal
unless grep {_is_type($d, $_);} @t 8 5557 5565
unless grep {_is_type($d, $_);} @t 0 0 0
86 }
87 0 ▶ if ( $s->{enum} && !grep { defined $d ? same_scalar( $d, $_ ) : !defined $_ } @{ $s->{enum} } ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($s->{"enum"} and not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})) 5 5580 5585
defined $d ? : 4819 3 4822
if ($s->{"enum"} and not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})) 0 0 0
defined $d ? : 0 0 0
Condition50%3/6
$s->{"enum"} and not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
!ll&&!rl&&r
420713735
$s->{"enum"} and not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
!ll&&!rl&&r
000
MC/DC100%2/2
$s->{"enum"} and not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
$s->{"enum"} not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
MC/DC0%0/2
$s->{"enum"} and not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
$s->{"enum"} not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
Truth table100%3/3
A and not(B)
A= $s->{"enum"}B= not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= $s->{"enum"}B= not grep({defined $d ? same_scalar($d, $_) : !defined($_);} @{$$s{"enum"};})
ABresult
0X0
100
111
88 0 ▶ push @e, $at.': erlaubt sind '.join( ', ', map { $_ // 'null' } @{ $s->{enum} } );
Condition50%2/4
$_ // "null"
l!l
101
$_ // "null"
l!l
00
MC/DC100%1/1
$_ // "null"
$_
MC/DC0%0/1
$_ // "null"
$_
Truth table100%2/2
A
A= $_
Aresult
11
00
Truth table0%0/2
A
A= $_
Aresult
11
00
89 }
90 0 ▶ if ( exists $s->{const} && !same_scalar( $d, $s->{const} ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $s->{"const"} and not same_scalar($d, $s->{"const"})) 3 5582 5585
if (exists $s->{"const"} and not same_scalar($d, $s->{"const"})) 0 0 0
Condition50%3/6
exists $s->{"const"} and not same_scalar($d, $s->{"const"})
!ll&&!rl&&r
557933
exists $s->{"const"} and not same_scalar($d, $s->{"const"})
!ll&&!rl&&r
000
MC/DC100%2/2
exists $s->{"const"} and not same_scalar($d, $s->{"const"})
exists $s->{"const"} not same_scalar($d, $s->{"const"})
MC/DC0%0/2
exists $s->{"const"} and not same_scalar($d, $s->{"const"})
exists $s->{"const"} not same_scalar($d, $s->{"const"})
Truth table100%3/3
A and not(B)
A= exists $s->{"const"}B= not same_scalar($d, $s->{"const"})
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= exists $s->{"const"}B= not same_scalar($d, $s->{"const"})
ABresult
0X0
100
111
91 0 my $c = $s->{const};
92 0 ▶ push @e, $at.': erlaubt ist '.( JSON::MaybeXS::is_bool($c) ? ( $c ? 'true' : 'false' ) : $c );
Branch: 4 branches
BranchTrueFalseTotal
JSON::MaybeXS::is_bool($c) ? : 1 2 3
$c ? : 1 0 1
JSON::MaybeXS::is_bool($c) ? : 0 0 0
$c ? : 0 0 0
93 }
94 0 ▶ if ( defined $d && !ref $d ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $d and not ref $d) 3107 2478 5585
if (defined $d and not ref $d) 0 0 0
Condition50%3/6
defined $d and not ref $d
!ll&&!rl&&r
1624623107
defined $d and not ref $d
!ll&&!rl&&r
000
MC/DC100%2/2
defined $d and not ref $d
defined $d not ref $d
MC/DC0%0/2
defined $d and not ref $d
defined $d not ref $d
Truth table100%3/3
A and not(B)
A= defined $dB= not ref $d
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= defined $dB= not ref $d
ABresult
0X0
100
111
95 0 ▶ push @e, $at.': zu kurz' if defined $s->{minLength} && length $d < $s->{minLength};
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"minLength"} and length $d < $s->{"minLength"} 1 3106 3107
if defined $s->{"minLength"} and length $d < $s->{"minLength"} 0 0 0
Condition50%3/6
defined $s->{"minLength"} and length $d < $s->{"minLength"}
!ll&&!rl&&r
3084221
defined $s->{"minLength"} and length $d < $s->{"minLength"}
!ll&&!rl&&r
000
MC/DC100%2/2
defined $s->{"minLength"} and length $d < $s->{"minLength"}
defined $s->{"minLength"} length $d < $s->{"minLength"}
MC/DC0%0/2
defined $s->{"minLength"} and length $d < $s->{"minLength"}
defined $s->{"minLength"} length $d < $s->{"minLength"}
Truth table100%3/3
A and B
A= defined $s->{"minLength"}B= length $d < $s->{"minLength"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $s->{"minLength"}B= length $d < $s->{"minLength"}
ABresult
0X0
100
111
96 0 ▶ push @e, $at.': zu lang' if defined $s->{maxLength} && length $d > $s->{maxLength};
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"maxLength"} and length $d > $s->{"maxLength"} 1 3106 3107
if defined $s->{"maxLength"} and length $d > $s->{"maxLength"} 0 0 0
Condition50%3/6
defined $s->{"maxLength"} and length $d > $s->{"maxLength"}
!ll&&!rl&&r
3084221
defined $s->{"maxLength"} and length $d > $s->{"maxLength"}
!ll&&!rl&&r
000
MC/DC100%2/2
defined $s->{"maxLength"} and length $d > $s->{"maxLength"}
defined $s->{"maxLength"} length $d > $s->{"maxLength"}
MC/DC0%0/2
defined $s->{"maxLength"} and length $d > $s->{"maxLength"}
defined $s->{"maxLength"} length $d > $s->{"maxLength"}
Truth table100%3/3
A and B
A= defined $s->{"maxLength"}B= length $d > $s->{"maxLength"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $s->{"maxLength"}B= length $d > $s->{"maxLength"}
ABresult
0X0
100
111
97 0 ▶ push @e, $at.': passt nicht zu '.$s->{pattern} if defined $s->{pattern} && $d !~ /$s->{pattern}/;
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"pattern"} and not $d =~ /$s->{"pattern"}/ 2 3105 3107
if defined $s->{"pattern"} and not $d =~ /$s->{"pattern"}/ 0 0 0
Condition50%3/6
defined $s->{"pattern"} and not $d =~ /$s->{"pattern"}/
!ll&&!rl&&r
3082232
defined $s->{"pattern"} and not $d =~ /$s->{"pattern"}/
!ll&&!rl&&r
000
MC/DC100%2/2
defined $s->{"pattern"} and not $d =~ /$s->{"pattern"}/
defined $s->{"pattern"} not $d =~ /$s->{"pattern"}/
MC/DC0%0/2
defined $s->{"pattern"} and not $d =~ /$s->{"pattern"}/
defined $s->{"pattern"} not $d =~ /$s->{"pattern"}/
Truth table100%3/3
A and not(B)
A= defined $s->{"pattern"}B= not $d =~ /$s->{"pattern"}/
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= defined $s->{"pattern"}B= not $d =~ /$s->{"pattern"}/
ABresult
0X0
100
111
98 0 ▶ if ( "$d" =~ /\A-?\d+(?:\.\d+)?\z/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ("$d" =~ /\A-?\d+(?:\.\d+)?\z/) 625 2482 3107
if ("$d" =~ /\A-?\d+(?:\.\d+)?\z/) 0 0 0
99 0 ▶ push @e, $at.': kleiner als '.$s->{minimum} if defined $s->{minimum} && $d < $s->{minimum};
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"minimum"} and $d < $s->{"minimum"} 1 624 625
if defined $s->{"minimum"} and $d < $s->{"minimum"} 0 0 0
Condition50%3/6
defined $s->{"minimum"} and $d < $s->{"minimum"}
!ll&&!rl&&r
603211
defined $s->{"minimum"} and $d < $s->{"minimum"}
!ll&&!rl&&r
000
MC/DC100%2/2
defined $s->{"minimum"} and $d < $s->{"minimum"}
defined $s->{"minimum"} $d < $s->{"minimum"}
MC/DC0%0/2
defined $s->{"minimum"} and $d < $s->{"minimum"}
defined $s->{"minimum"} $d < $s->{"minimum"}
Truth table100%3/3
A and B
A= defined $s->{"minimum"}B= $d < $s->{"minimum"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $s->{"minimum"}B= $d < $s->{"minimum"}
ABresult
0X0
100
111
100 0 ▶ push @e, $at.': größer als '.$s->{maximum} if defined $s->{maximum} && $d > $s->{maximum};
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"maximum"} and $d > $s->{"maximum"} 1 624 625
if defined $s->{"maximum"} and $d > $s->{"maximum"} 0 0 0
Condition50%3/6
defined $s->{"maximum"} and $d > $s->{"maximum"}
!ll&&!rl&&r
603211
defined $s->{"maximum"} and $d > $s->{"maximum"}
!ll&&!rl&&r
000
MC/DC100%2/2
defined $s->{"maximum"} and $d > $s->{"maximum"}
defined $s->{"maximum"} $d > $s->{"maximum"}
MC/DC0%0/2
defined $s->{"maximum"} and $d > $s->{"maximum"}
defined $s->{"maximum"} $d > $s->{"maximum"}
Truth table100%3/3
A and B
A= defined $s->{"maximum"}B= $d > $s->{"maximum"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $s->{"maximum"}B= $d > $s->{"maximum"}
ABresult
0X0
100
111
101 }
102 }
103 0 ▶ if ( ref $d eq 'HASH' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $d eq "HASH") 2366 3219 5585
if (ref $d eq "HASH") 0 0 0
104 0 ▶ for my $k ( @{ $s->{required} || [] } ) {
Condition50%2/4
$s->{'required'} || []
l!l
231452
$s->{'required'} || []
l!l
00
MC/DC100%1/1
$s->{'required'} || []
$s->{'required'}
MC/DC0%0/1
$s->{'required'} || []
$s->{'required'}
Truth table100%2/2
A
A= $s->{'required'}
Aresult
11
00
Truth table0%0/2
A
A= $s->{'required'}
Aresult
11
00
105 0 ▶ push @e, $at.'.'.$k.': fehlt' unless exists $d->{$k};
Branch: 2 branches
BranchTrueFalseTotal
unless exists $d->{$k} 4 3084 3088
unless exists $d->{$k} 0 0 0
106 }
107 0 ▶ my $p = $s->{properties} || {};
Condition25%1/4
$s->{'properties'} || {}
l!l
23660
$s->{'properties'} || {}
l!l
00
MC/DC0%0/1
$s->{'properties'} || {}
$s->{'properties'}
MC/DC0%0/1
$s->{'properties'} || {}
$s->{'properties'}
Truth table50%1/2
A
A= $s->{'properties'}
Aresult
11
00
Truth table0%0/2
A
A= $s->{'properties'}
Aresult
11
00
108 0 for my $k ( sort keys %$p ) {
109 0 ▶ push @e, schema_errors( $d->{$k}, $p->{$k}, $at.'.'.$k ) if exists $d->{$k};
Branch: 2 branches
BranchTrueFalseTotal
if exists $d->{$k} 3130 357 3487
if exists $d->{$k} 0 0 0
110 }
111 }
112 0 ▶ if ( ref $d eq 'ARRAY' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $d eq "ARRAY") 75 5510 5585
if (ref $d eq "ARRAY") 0 0 0
113 0 ▶ push @e, $at.': zu wenige Einträge' if defined $s->{minItems} && @$d < $s->{minItems};
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"minItems"} and @$d < $s->{"minItems"} 1 74 75
if defined $s->{"minItems"} and @$d < $s->{"minItems"} 0 0 0
Condition50%3/6
defined $s->{"minItems"} and @$d < $s->{"minItems"}
!ll&&!rl&&r
7221
defined $s->{"minItems"} and @$d < $s->{"minItems"}
!ll&&!rl&&r
000
MC/DC100%2/2
defined $s->{"minItems"} and @$d < $s->{"minItems"}
defined $s->{"minItems"} @$d < $s->{"minItems"}
MC/DC0%0/2
defined $s->{"minItems"} and @$d < $s->{"minItems"}
defined $s->{"minItems"} @$d < $s->{"minItems"}
Truth table100%3/3
A and B
A= defined $s->{"minItems"}B= @$d < $s->{"minItems"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $s->{"minItems"}B= @$d < $s->{"minItems"}
ABresult
0X0
100
111
114 0 ▶ push @e, $at.': zu viele Einträge' if defined $s->{maxItems} && @$d > $s->{maxItems};
Branch: 2 branches
BranchTrueFalseTotal
if defined $s->{"maxItems"} and @$d > $s->{"maxItems"} 1 74 75
if defined $s->{"maxItems"} and @$d > $s->{"maxItems"} 0 0 0
Condition50%3/6
defined $s->{"maxItems"} and @$d > $s->{"maxItems"}
!ll&&!rl&&r
7221
defined $s->{"maxItems"} and @$d > $s->{"maxItems"}
!ll&&!rl&&r
000
MC/DC100%2/2
defined $s->{"maxItems"} and @$d > $s->{"maxItems"}
defined $s->{"maxItems"} @$d > $s->{"maxItems"}
MC/DC0%0/2
defined $s->{"maxItems"} and @$d > $s->{"maxItems"}
defined $s->{"maxItems"} @$d > $s->{"maxItems"}
Truth table100%3/3
A and B
A= defined $s->{"maxItems"}B= @$d > $s->{"maxItems"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $s->{"maxItems"}B= @$d > $s->{"maxItems"}
ABresult
0X0
100
111
115 0 ▶ if ( $s->{items} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($s->{"items"}) 69 6 75
if ($s->{"items"}) 0 0 0
116 0 push @e, schema_errors( $d->[$_], $s->{items}, $at.'['.$_.']' ) for 0 .. $#$d;
117 }
118 }
119 0 return @e;
120 }
121  
122 42 1;
123  
124 __END__
« blib/lib/Langertha/Holmgang/Sim/Linux/Nft.pm ↑ Summary blib/lib/Langertha/Holmgang/Sim/Linux/Pki.pm »