Corvus/Node.pm

filter: Statementstmt 80.0% 64 / 80 Branchbran 76.0% 35 / 46 Conditioncond 70.7% 133 / 188 MC/DCmcdc 77.7% 7 / 9 Subroutinesub 94.1% 16 / 17 Podpod 0.0% 0 / 10 totaltotal 72.8% 255 / 350 CC 90 SCAR 27.0
CC
90
Cov
74%
in_place_children
25.2
is_pure_ref
24.7
has_in_place_applicators
15.4
CRAP 14.8
« Corvus/Json.pm ↑ Summary Corvus/Uri.pm »
1 package JSON::Schema::Corvus::Node;
2  
3 # The compiled schema graph: one node per distinct (document, pointer), with its keywords digested. A port of the
4 # Python package's node.py (Corvus.Text.Json.RuntimeEvaluator.Compilation.SchemaNode, trimmed to what code generation
5 # and results collection need). A node is a hash of the fields below; the compiler sets them, and they are fixed once
6 # compilation finishes, so the derived has_* and is_* properties are computed once.
7  
8 4 ▶use 5.026;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # JSON types as bits.
14 4 ▶use constant { T_NONE => 0, T_NULL => 1, T_BOOLEAN => 2, T_OBJECT => 4, T_ARRAY => 8, T_NUMBER => 16, T_STRING => 32,
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 T_INTEGER => 64, T_ALL => 127 };
16  
17 # Content kinds.
18 4 ▶use constant { CONTENT_NONE => 0, CONTENT_BASE64 => 1, CONTENT_JSON => 2, CONTENT_BASE64_JSON => 3 };
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 4 our @EXPORT_OK = qw(T_NONE T_NULL T_BOOLEAN T_OBJECT T_ARRAY T_NUMBER T_STRING T_INTEGER T_ALL
21 CONTENT_NONE CONTENT_BASE64 CONTENT_JSON CONTENT_BASE64_JSON);
22 4 our %EXPORT_TAGS = (all => \@EXPORT_OK);
23  
24 # The fields of a node and their defaults (-1 is "none" for a child node id or a count; undef for a list or a map).
25 4 my %DEFAULTS = (
26 always_true => 0, always_false => 0,
27 # Assertions.
28 type => T_NONE, has_type => 0, has_const => 0, const_value => undef, enum_values => undef,
29 # References. dynamic_ref is { anchor, is_recursive, fallback, by_resource => {resource id => node id} }.
30 ref => -1, static_dynamic_ref => -1, static_dynamic_keyword => undef, dynamic_ref => undef,
31 # In-place applicators.
32 all_of => undef, any_of => undef, one_of => undef, not_ => -1, if_ => -1, then => -1, else_ => -1,
33 # Objects. properties is { name => node id } with property_order the names in schema order; pattern_properties is
34 # [ { pattern, node } ]; dependencies is [ { keyword, name, required => [names] or undef, schema => node id or
35 # undef } ].
36 properties => undef, property_order => undef, pattern_properties => undef, additional_properties => -1,
37 property_names => -1, required => undef, required_list => undef, dependencies => undef, min_properties => -1,
38 max_properties => -1, unevaluated_properties => -1,
39 # Arrays.
40 prefix_items => undef, prefix_keyword => 'prefixItems', items_keyword => 'items', items => -1, contains => -1,
41 min_contains => 1, max_contains => -1, contains_marks_evaluated => 0, min_items => -1, max_items => -1,
42 unique_items => 0, unevaluated_items => -1,
43 # Strings.
44 min_length => -1, max_length => -1, pattern => undef, format => undef, format_kind => 'unknown', assert_format => 0,
45 content => CONTENT_NONE, assert_content => 0,
46 # Numbers.
47 minimum => undef, maximum => undef, exclusive_minimum => undef, exclusive_maximum => undef, multiple_of => undef,
48 # Annotations, in schema order: [ { keyword, value, strings_only } ].
49 annotations => undef,
50 # Analysis. A discriminator is { property, known => [ [value, [branch indexes]] ], unknown => [branch indexes],
51 # all_require }.
52 marks_properties => 0, marks_items => 0, in_place_cycle => 0, one_of_discriminator => undef,
53 any_of_discriminator => undef,
54 );
55  
56 182 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
57 182 my ($class, %fields) = @_;
58 182 return bless { %DEFAULTS, %fields }, $class;
59 }
60  
61 0 ▶sub _is_numeric_format {
Subroutine _is_numeric_format: not called CC=1 SCAR=6.9
62 0 require JSON::Schema::Corvus::Formats;
63 0 return JSON::Schema::Corvus::Formats::is_numeric_format($_[0]);
64 }
65  
66 1130 ▶sub has_object_keywords {
Subroutine has_object_keywords: called CC=11 SCAR=25.3
Pod undocumented
67 1130 my ($n) = @_;
68 return $n->{_has_object} //= (defined $n->{properties} || defined $n->{pattern_properties}
69 || $n->{additional_properties} >= 0 || $n->{property_names} >= 0 || defined $n->{required}
70 || defined $n->{dependencies} || $n->{min_properties} >= 0 || $n->{max_properties} >= 0
71 1130 ▶ || $n->{unevaluated_properties} >= 0) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $n->{'properties'} || defined $n->{'pattern_properties'} || $n->{'additional_properties'} >= 0 || $n->{'property_names'} >= 0 || defined $n->{'required'} || defined $n->{'dependencies'} || $n->{'min_properties'} >= 0 || $n->{'max_properties'} >= 0 || $n->{'unevaluated_properties'} >= 0 ? : 18 95 113
Condition73%19/26
$n->{"_has_object"} //= defined $n->{"properties"} || defined $n->{"pattern_properties"} || $n->{"additional_properties"} >= 0 || $n->{"property_names"} >= 0 || defined $n->{"required"} || defined $n->{"dependencies"} || $n->{"min_properties"} >= 0 || $n->{"max_properties"} >= 0 || $n->{"unevaluated_properties"} >= 0 ? 1 : 0
l!l
1017113
defined $n->{"properties"} or defined $n->{"pattern_properties"} or $n->{"additional_properties"} >= 0 or $n->{"property_names"} >= 0 or defined $n->{"required"} or defined $n->{"dependencies"} or $n->{"min_properties"} >= 0 or $n->{"max_properties"} >= 0 or $n->{"unevaluated_properties"} >= 0
l!l&&r!l&&!r
18095
defined $n->{"properties"} or defined $n->{"pattern_properties"} or $n->{"additional_properties"} >= 0 or $n->{"property_names"} >= 0 or defined $n->{"required"} or defined $n->{"dependencies"} or $n->{"min_properties"} >= 0 or $n->{"max_properties"} >= 0
l!l&&r!l&&!r
18095
defined $n->{"properties"} or defined $n->{"pattern_properties"} or $n->{"additional_properties"} >= 0 or $n->{"property_names"} >= 0 or defined $n->{"required"} or defined $n->{"dependencies"} or $n->{"min_properties"} >= 0
l!l&&r!l&&!r
18095
defined $n->{"properties"} or defined $n->{"pattern_properties"} or $n->{"additional_properties"} >= 0 or $n->{"property_names"} >= 0 or defined $n->{"required"} or defined $n->{"dependencies"}
l!l&&r!l&&!r
18095
defined $n->{"properties"} or defined $n->{"pattern_properties"} or $n->{"additional_properties"} >= 0 or $n->{"property_names"} >= 0 or defined $n->{"required"}
l!l&&r!l&&!r
18095
defined $n->{"properties"} or defined $n->{"pattern_properties"} or $n->{"additional_properties"} >= 0 or $n->{"property_names"} >= 0
l!l&&r!l&&!r
18095
defined $n->{"properties"} or defined $n->{"pattern_properties"} or $n->{"additional_properties"} >= 0
l!l&&r!l&&!r
10895
defined $n->{"properties"} or defined $n->{"pattern_properties"}
l!l&&r!l&&!r
100103
MC/DC100%1/1
$n->{"_has_object"} //= defined $n->{"properties"} || defined $n->{"pattern_properties"} || $n->{"additional_properties"} >= 0 || $n->{"property_names"} >= 0 || defined $n->{"required"} || defined $n->{"dependencies"} || $n->{"min_properties"} >= 0 || $n->{"max_properties"} >= 0 || $n->{"unevaluated_properties"} >= 0 ? 1 : 0
$n->{"_has_object"}
Truth table100%2/2
A
A= $n->{"_has_object"}
Aresult
11
00
72 }
73  
74 887 ▶sub has_array_keywords {
Subroutine has_array_keywords: called CC=9 SCAR=23.3
Pod undocumented
75 887 my ($n) = @_;
76 return $n->{_has_array} //= (defined $n->{prefix_items} || $n->{items} >= 0 || $n->{contains} >= 0
77 887 ▶ || $n->{min_items} >= 0 || $n->{max_items} >= 0 || $n->{unique_items} || $n->{unevaluated_items} >= 0) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $n->{'prefix_items'} || $n->{'items'} >= 0 || $n->{'contains'} >= 0 || $n->{'min_items'} >= 0 || $n->{'max_items'} >= 0 || $n->{'unique_items'} || $n->{'unevaluated_items'} >= 0 ? : 6 90 96
Condition70%14/20
$n->{"_has_array"} //= defined $n->{"prefix_items"} || $n->{"items"} >= 0 || $n->{"contains"} >= 0 || $n->{"min_items"} >= 0 || $n->{"max_items"} >= 0 || $n->{"unique_items"} || $n->{"unevaluated_items"} >= 0 ? 1 : 0
l!l
79196
defined $n->{"prefix_items"} or $n->{"items"} >= 0 or $n->{"contains"} >= 0 or $n->{"min_items"} >= 0 or $n->{"max_items"} >= 0 or $n->{"unique_items"} or $n->{"unevaluated_items"} >= 0
l!l&&r!l&&!r
6090
defined $n->{"prefix_items"} or $n->{"items"} >= 0 or $n->{"contains"} >= 0 or $n->{"min_items"} >= 0 or $n->{"max_items"} >= 0 or $n->{"unique_items"}
l!l&&r!l&&!r
6090
defined $n->{"prefix_items"} or $n->{"items"} >= 0 or $n->{"contains"} >= 0 or $n->{"min_items"} >= 0 or $n->{"max_items"} >= 0
l!l&&r!l&&!r
6090
defined $n->{"prefix_items"} or $n->{"items"} >= 0 or $n->{"contains"} >= 0 or $n->{"min_items"} >= 0
l!l&&r!l&&!r
6090
defined $n->{"prefix_items"} or $n->{"items"} >= 0 or $n->{"contains"} >= 0
l!l&&r!l&&!r
6090
defined $n->{"prefix_items"} or $n->{"items"} >= 0
l!l&&r!l&&!r
0690
MC/DC100%1/1
$n->{"_has_array"} //= defined $n->{"prefix_items"} || $n->{"items"} >= 0 || $n->{"contains"} >= 0 || $n->{"min_items"} >= 0 || $n->{"max_items"} >= 0 || $n->{"unique_items"} || $n->{"unevaluated_items"} >= 0 ? 1 : 0
$n->{"_has_array"}
Truth table100%2/2
A
A= $n->{"_has_array"}
Aresult
11
00
78 }
79  
80 91 ▶sub has_string_keywords {
Subroutine has_string_keywords: called CC=9 SCAR=25.9
Pod undocumented
81 91 my ($n) = @_;
82 return $n->{_has_string} //= ($n->{min_length} >= 0 || $n->{max_length} >= 0 || defined $n->{pattern}
83 || ($n->{assert_format} && defined $n->{format} && !_is_numeric_format($n->{format_kind}))
84 91 ▶ || $n->{assert_content}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$n->{'min_length'} >= 0 || $n->{'max_length'} >= 0 || defined $n->{'pattern'} || $n->{'assert_format'} && defined $n->{'format'} && !_is_numeric_format($n->{'format_kind'}) || $n->{'assert_content'} ? : 2 86 88
Condition55%11/20
$n->{"_has_string"} //= $n->{"min_length"} >= 0 || $n->{"max_length"} >= 0 || defined $n->{"pattern"} || $n->{"assert_format"} && defined $n->{"format"} && !_is_numeric_format($n->{"format_kind"}) || $n->{"assert_content"} ? 1 : 0
l!l
388
$n->{"min_length"} >= 0 or $n->{"max_length"} >= 0 or defined $n->{"pattern"} or $n->{"assert_format"} and defined $n->{"format"} and not _is_numeric_format($n->{"format_kind"}) or $n->{"assert_content"}
l!l&&r!l&&!r
2086
$n->{"min_length"} >= 0 or $n->{"max_length"} >= 0 or defined $n->{"pattern"} or $n->{"assert_format"} and defined $n->{"format"} and not _is_numeric_format($n->{"format_kind"})
l!l&&r!l&&!r
2086
$n->{"min_length"} >= 0 or $n->{"max_length"} >= 0 or defined $n->{"pattern"}
l!l&&r!l&&!r
0286
$n->{"min_length"} >= 0 or $n->{"max_length"} >= 0
l!l&&r!l&&!r
0088
$n->{"assert_format"} and defined $n->{"format"} and not _is_numeric_format($n->{"format_kind"})
!ll&&!rl&&r
8600
$n->{"assert_format"} and defined $n->{"format"}
!ll&&!rl&&r
8600
MC/DC100%1/1
$n->{"_has_string"} //= $n->{"min_length"} >= 0 || $n->{"max_length"} >= 0 || defined $n->{"pattern"} || $n->{"assert_format"} && defined $n->{"format"} && !_is_numeric_format($n->{"format_kind"}) || $n->{"assert_content"} ? 1 : 0
$n->{"_has_string"}
Truth table100%2/2
A
A= $n->{"_has_string"}
Aresult
11
00
85 }
86  
87 89 ▶sub has_number_keywords {
Subroutine has_number_keywords: called CC=9 SCAR=23.3
Pod undocumented
88 89 my ($n) = @_;
89 return $n->{_has_number} //= (defined $n->{minimum} || defined $n->{maximum} || defined $n->{exclusive_minimum}
90 || defined $n->{exclusive_maximum} || defined $n->{multiple_of}
91 89 ▶ || ($n->{assert_format} && _is_numeric_format($n->{format_kind}))) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $n->{'minimum'} || defined $n->{'maximum'} || defined $n->{'exclusive_minimum'} || defined $n->{'exclusive_maximum'} || defined $n->{'multiple_of'} || $n->{'assert_format'} && _is_numeric_format($n->{'format_kind'}) ? : 2 83 85
Condition70%14/20
$n->{"_has_number"} //= defined $n->{"minimum"} || defined $n->{"maximum"} || defined $n->{"exclusive_minimum"} || defined $n->{"exclusive_maximum"} || defined $n->{"multiple_of"} || $n->{"assert_format"} && _is_numeric_format($n->{"format_kind"}) ? 1 : 0
l!l
485
defined $n->{"minimum"} or defined $n->{"maximum"} or defined $n->{"exclusive_minimum"} or defined $n->{"exclusive_maximum"} or defined $n->{"multiple_of"} or $n->{"assert_format"} and _is_numeric_format($n->{"format_kind"})
l!l&&r!l&&!r
2083
defined $n->{"minimum"} or defined $n->{"maximum"} or defined $n->{"exclusive_minimum"} or defined $n->{"exclusive_maximum"} or defined $n->{"multiple_of"}
l!l&&r!l&&!r
2083
defined $n->{"minimum"} or defined $n->{"maximum"} or defined $n->{"exclusive_minimum"} or defined $n->{"exclusive_maximum"}
l!l&&r!l&&!r
2083
defined $n->{"minimum"} or defined $n->{"maximum"} or defined $n->{"exclusive_minimum"}
l!l&&r!l&&!r
1183
defined $n->{"minimum"} or defined $n->{"maximum"}
l!l&&r!l&&!r
1084
$n->{"assert_format"} and _is_numeric_format($n->{"format_kind"})
!ll&&!rl&&r
8300
MC/DC100%1/1
$n->{"_has_number"} //= defined $n->{"minimum"} || defined $n->{"maximum"} || defined $n->{"exclusive_minimum"} || defined $n->{"exclusive_maximum"} || defined $n->{"multiple_of"} || $n->{"assert_format"} && _is_numeric_format($n->{"format_kind"}) ? 1 : 0
$n->{"_has_number"}
Truth table100%2/2
A
A= $n->{"_has_number"}
Aresult
11
00
92 }
93  
94 647 ▶sub has_in_place_applicators {
Subroutine has_in_place_applicators: called CC=12 SCAR=27.3
Pod undocumented
95 647 my ($n) = @_;
96 return $n->{_has_in_place} //= ($n->{ref} >= 0 || $n->{static_dynamic_ref} >= 0 || defined $n->{dynamic_ref}
97 || defined $n->{all_of} || defined $n->{any_of} || defined $n->{one_of} || $n->{not_} >= 0 || $n->{if_} >= 0
98 0 ▶ || (defined $n->{dependencies} && grep { defined $_->{schema} } @{ $n->{dependencies} })) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$n->{'ref'} >= 0 || $n->{'static_dynamic_ref'} >= 0 || defined $n->{'dynamic_ref'} || defined $n->{'all_of'} || defined $n->{'any_of'} || defined $n->{'one_of'} || $n->{'not_'} >= 0 || $n->{'if_'} >= 0 || defined $n->{'dependencies'} && grep({defined $_->{'schema'};} @{$$n{'dependencies'};}) ? : 23 31 54
Condition72%21/29
$n->{"_has_in_place"} //= $n->{"ref"} >= 0 || $n->{"static_dynamic_ref"} >= 0 || defined $n->{"dynamic_ref"} || defined $n->{"all_of"} || defined $n->{"any_of"} || defined $n->{"one_of"} || $n->{"not_"} >= 0 || $n->{"if_"} >= 0 || defined $n->{"dependencies"} && grep({defined $_->{"schema"};} @{$$n{"dependencies"};}) ? 1 : 0
l!l
59354
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0 or defined $n->{"dynamic_ref"} or defined $n->{"all_of"} or defined $n->{"any_of"} or defined $n->{"one_of"} or $n->{"not_"} >= 0 or $n->{"if_"} >= 0 or defined $n->{"dependencies"} and grep {defined $_->{"schema"};} @{$$n{"dependencies"};}
l!l&&r!l&&!r
23031
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0 or defined $n->{"dynamic_ref"} or defined $n->{"all_of"} or defined $n->{"any_of"} or defined $n->{"one_of"} or $n->{"not_"} >= 0 or $n->{"if_"} >= 0
l!l&&r!l&&!r
23031
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0 or defined $n->{"dynamic_ref"} or defined $n->{"all_of"} or defined $n->{"any_of"} or defined $n->{"one_of"} or $n->{"not_"} >= 0
l!l&&r!l&&!r
23031
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0 or defined $n->{"dynamic_ref"} or defined $n->{"all_of"} or defined $n->{"any_of"} or defined $n->{"one_of"}
l!l&&r!l&&!r
23031
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0 or defined $n->{"dynamic_ref"} or defined $n->{"all_of"} or defined $n->{"any_of"}
l!l&&r!l&&!r
21231
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0 or defined $n->{"dynamic_ref"} or defined $n->{"all_of"}
l!l&&r!l&&!r
21033
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0 or defined $n->{"dynamic_ref"}
l!l&&r!l&&!r
21033
$n->{"ref"} >= 0 or $n->{"static_dynamic_ref"} >= 0
l!l&&r!l&&!r
31833
defined $n->{"dependencies"} and grep {defined $_->{"schema"};} @{$$n{"dependencies"};}
!ll&&!rl&&r
3100
MC/DC100%1/1
$n->{"_has_in_place"} //= $n->{"ref"} >= 0 || $n->{"static_dynamic_ref"} >= 0 || defined $n->{"dynamic_ref"} || defined $n->{"all_of"} || defined $n->{"any_of"} || defined $n->{"one_of"} || $n->{"not_"} >= 0 || $n->{"if_"} >= 0 || defined $n->{"dependencies"} && grep({defined $_->{"schema"};} @{$$n{"dependencies"};}) ? 1 : 0
$n->{"_has_in_place"}
Truth table100%2/2
A
A= $n->{"_has_in_place"}
Aresult
11
00
99 }
100  
101 # Only type (a type test at the call site).
102 1496 ▶sub is_type_only {
Subroutine is_type_only: called CC=10 SCAR=23.2
Pod undocumented
103 1496 my ($n) = @_;
104 return $n->{_type_only} //= ($n->{has_type} && !$n->{has_const} && !defined $n->{enum_values}
105 1496 ▶ && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords
Branch: 1 branch
BranchTrueFalseTotal
$n->{'has_type'} && !$n->{'has_const'} && !defined($n->{'enum_values'}) && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords && !$n->has_number_keywords && !$n->has_in_place_applicators ? : 24 50 74
Condition86%20/23
$n->{"_type_only"} //= $n->{"has_type"} && !$n->{"has_const"} && !defined($n->{"enum_values"}) && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords && !$n->has_number_keywords && !$n->has_in_place_applicators ? 1 : 0
l!l
142274
$n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not $n->has_in_place_applicators
!ll&&!rl&&r
50024
$n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords
!ll&&!rl&&r
48224
$n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords
!ll&&!rl&&r
47126
$n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords
!ll&&!rl&&r
42527
$n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords
!ll&&!rl&&r
261632
$n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"}
!ll&&!rl&&r
26048
$n->{"has_type"} and not $n->{"has_const"}
!ll&&!rl&&r
26048
MC/DC100%1/1
$n->{"_type_only"} //= $n->{"has_type"} && !$n->{"has_const"} && !defined($n->{"enum_values"}) && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords && !$n->has_number_keywords && !$n->has_in_place_applicators ? 1 : 0
$n->{"_type_only"}
Truth table100%2/2
A
A= $n->{"_type_only"}
Aresult
11
00
106 && !$n->has_number_keywords && !$n->has_in_place_applicators) ? 1 : 0;
107 }
108  
109 # Nothing but $ref.
110 184 ▶sub is_pure_ref {
Subroutine is_pure_ref: called CC=18 SCAR=32.1
Pod undocumented
111 184 my ($n) = @_;
112 return $n->{_pure_ref} //= ($n->{ref} >= 0 && !$n->{has_type} && !$n->{has_const} && !defined $n->{enum_values}
113 && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords
114 && !$n->has_number_keywords && !defined $n->{dynamic_ref} && $n->{static_dynamic_ref} < 0
115 && !defined $n->{all_of} && !defined $n->{any_of} && !defined $n->{one_of} && $n->{not_} < 0
116 184 ▶ && $n->{if_} < 0 && !defined $n->{dependencies}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$n->{'ref'} >= 0 && !$n->{'has_type'} && !$n->{'has_const'} && !defined($n->{'enum_values'}) && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords && !$n->has_number_keywords && !defined($n->{'dynamic_ref'}) && $n->{'static_dynamic_ref'} < 0 && !defined($n->{'all_of'}) && !defined($n->{'any_of'}) && !defined($n->{'one_of'}) && $n->{'not_'} < 0 && $n->{'if_'} < 0 && !defined($n->{'dependencies'}) ? : 39 114 153
Condition70%33/47
$n->{"_pure_ref"} //= $n->{"ref"} >= 0 && !$n->{"has_type"} && !$n->{"has_const"} && !defined($n->{"enum_values"}) && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords && !$n->has_number_keywords && !defined($n->{"dynamic_ref"}) && $n->{"static_dynamic_ref"} < 0 && !defined($n->{"all_of"}) && !defined($n->{"any_of"}) && !defined($n->{"one_of"}) && $n->{"not_"} < 0 && $n->{"if_"} < 0 && !defined($n->{"dependencies"}) ? 1 : 0
l!l
31153
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"} and $n->{"static_dynamic_ref"} < 0 and not defined $n->{"all_of"} and not defined $n->{"any_of"} and not defined $n->{"one_of"} and $n->{"not_"} < 0 and $n->{"if_"} < 0 and not defined $n->{"dependencies"}
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"} and $n->{"static_dynamic_ref"} < 0 and not defined $n->{"all_of"} and not defined $n->{"any_of"} and not defined $n->{"one_of"} and $n->{"not_"} < 0 and $n->{"if_"} < 0
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"} and $n->{"static_dynamic_ref"} < 0 and not defined $n->{"all_of"} and not defined $n->{"any_of"} and not defined $n->{"one_of"} and $n->{"not_"} < 0
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"} and $n->{"static_dynamic_ref"} < 0 and not defined $n->{"all_of"} and not defined $n->{"any_of"} and not defined $n->{"one_of"}
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"} and $n->{"static_dynamic_ref"} < 0 and not defined $n->{"all_of"} and not defined $n->{"any_of"}
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"} and $n->{"static_dynamic_ref"} < 0 and not defined $n->{"all_of"}
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"} and $n->{"static_dynamic_ref"} < 0
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords and not defined $n->{"dynamic_ref"}
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords and not $n->has_number_keywords
!ll&&!rl&&r
114039
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords and not $n->has_string_keywords
!ll&&!rl&&r
113139
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords and not $n->has_array_keywords
!ll&&!rl&&r
113040
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"} and not $n->has_object_keywords
!ll&&!rl&&r
113040
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"} and not defined $n->{"enum_values"}
!ll&&!rl&&r
113040
$n->{"ref"} >= 0 and not $n->{"has_type"} and not $n->{"has_const"}
!ll&&!rl&&r
113040
$n->{"ref"} >= 0 and not $n->{"has_type"}
!ll&&!rl&&r
113040
MC/DC100%1/1
$n->{"_pure_ref"} //= $n->{"ref"} >= 0 && !$n->{"has_type"} && !$n->{"has_const"} && !defined($n->{"enum_values"}) && !$n->has_object_keywords && !$n->has_array_keywords && !$n->has_string_keywords && !$n->has_number_keywords && !defined($n->{"dynamic_ref"}) && $n->{"static_dynamic_ref"} < 0 && !defined($n->{"all_of"}) && !defined($n->{"any_of"}) && !defined($n->{"one_of"}) && $n->{"not_"} < 0 && $n->{"if_"} < 0 && !defined($n->{"dependencies"}) ? 1 : 0
$n->{"_pure_ref"}
Truth table100%2/2
A
A= $n->{"_pure_ref"}
Aresult
11
00
117 }
118  
119 # The in-place children (the instance is evaluated at the same location).
120 256 ▶sub in_place_children {
Subroutine in_place_children: called CC=14 SCAR=32.2
Pod undocumented
121 256 my ($n, $include_not) = @_;
122 256 my @out;
123 256 ▶ push @out, $n->{ref} if $n->{ref} >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"ref"} >= 0 74 182 256
124 256 ▶ push @out, $n->{static_dynamic_ref} if $n->{static_dynamic_ref} >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"static_dynamic_ref"} >= 0 18 238 256
125 256 ▶ if (my $d = $n->{dynamic_ref}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $d = $n->{"dynamic_ref"}) 0 256 256
126 0 push @out, $d->{fallback};
127 0 push @out, map { $d->{by_resource}{$_} } sort { $a <=> $b } keys %{ $d->{by_resource} };
128 }
129 256 ▶ push @out, @{ $n->{all_of} } if $n->{all_of};
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"all_of"} 2 254 256
130 256 ▶ push @out, @{ $n->{any_of} } if $n->{any_of};
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"any_of"} 4 252 256
131 0 ▶ push @out, @{ $n->{one_of} } if $n->{one_of};
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"one_of"} 0 256 256
132 256 ▶ push @out, $n->{not_} if $include_not && $n->{not_} >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $include_not and $n->{"not_"} >= 0 0 256 256
Condition33%1/3
$include_not and $n->{"not_"} >= 0
!ll&&!rl&&r
02560
MC/DC0%0/2
$include_not and $n->{"not_"} >= 0
$include_not $n->{"not_"} >= 0
Truth table33%1/3
A and B
A= $include_notB= $n->{"not_"} >= 0
ABresult
0X0
100
111
133 256 ▶ push @out, $n->{if_} if $n->{if_} >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"if_"} >= 0 0 256 256
134 256 ▶ push @out, $n->{then} if $n->{then} >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"then"} >= 0 0 256 256
135 256 ▶ push @out, $n->{else_} if $n->{else_} >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"else_"} >= 0 0 256 256
136 256 ▶ if ($n->{dependencies}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n->{"dependencies"}) 0 256 256
137 0 ▶ push @out, map { defined $_->{schema} ? $_->{schema} : () } @{ $n->{dependencies} };
Branch: 1 branch
BranchTrueFalseTotal
defined $_->{'schema'} ? : 0 0 0
138 }
139 256 return \@out;
140 }
141  
142 # Every child node.
143 103 ▶sub children {
Subroutine children: called CC=6 SCAR=18.6
Pod undocumented
144 103 my ($n) = @_;
145 103 my @out = @{ $n->in_place_children(1) };
146 103 ▶ push @out, map { $n->{properties}{$_} } @{ $n->{property_order} } if $n->{properties};
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"properties"} 8 95 103
147 0 ▶ push @out, map { $_->{node} } @{ $n->{pattern_properties} } if $n->{pattern_properties};
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"pattern_properties"} 0 103 103
148 103 for my $c (@$n{qw(additional_properties property_names unevaluated_properties items contains unevaluated_items)}) {
149 618 ▶ push @out, $c if $c >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $c >= 0 15 603 618
150 }
151 0 ▶ push @out, @{ $n->{prefix_items} } if $n->{prefix_items};
Branch: 1 branch
BranchTrueFalseTotal
if $n->{"prefix_items"} 0 103 103
152 103 return \@out;
153 }
154  
155 4 1;
« Corvus/Json.pm ↑ Summary Corvus/Uri.pm »