JSV/Keyword/Draft4/Not.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 97.0% 33 / 34 CC 3 SCAR 6.2
CC
3
Cov
100%
validate
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« Test/JSV/Suite.pm ↑ Summary JSV/Keyword/Draft4/UniqueItems.pm »
1 package JSV::Keyword::Draft4::Not;
2  
3 47 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 47 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 47 ▶use parent qw(JSV::Keyword);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 47 ▶use JSV::Keyword qw(:constants);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub instance_type() { INSTANCE_TYPE_ANY(); }
10 sub keyword() { "not" }
11 sub keyword_priority() { 10; }
12  
13 6 ▶sub validate {
Subroutine validate: called CC=3 SCAR=11.0
Pod undocumented
14 6 my ($class, $context, $schema, $instance) = @_;
15  
16 6 my $not_schema = $class->keyword_value($schema);
17 6 my $is_valid = 0;
18  
19 {
20 6 local $context->{current_schema_pointer} = $context->{current_schema_pointer} . "/" . $class->keyword;
21 6 local $context->{errors} = [];
22 6 $context->validate($not_schema, $instance);
23 6 ▶ $is_valid = 1 if scalar @{ $context->{errors} } == 0;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @{$context->{"errors"};} == 0 3 3 6
24 }
25  
26 6 ▶ if ($is_valid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_valid) 3 3 6
27 3 $context->log_error("The instance is matched to schema of not keyword value");
28 }
29 }
30  
31 47 1;
« Test/JSV/Suite.pm ↑ Summary JSV/Keyword/Draft4/UniqueItems.pm »