blib/lib/Dallycot/AST/Defined.pm

filter: Statementstmt 81.4% 22 / 27 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 3 totaltotal 72.9% 35 / 48 CC 4 SCAR 8.2
CC
4
Cov
79%
__ANON__
4.3
to_string
2.0
to_rdf
2.0
CRAP 2.3
« blib/lib/Dallycot/AST/Unique.pm ↑ Summary blib/lib/Dallycot/Value.pm »
1 package Dallycot::AST::Defined;
2 29 our $AUTHORITY = 'cpan:JSMITH';
3  
4 # ABSTRACT: Test if expression evaluates to a defined value
5  
6 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 29 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 29 ▶use parent 'Dallycot::AST';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 29 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 sub to_string {
15 0 ▶ my ($self) = @_;
Subroutine to_string: not called CC=1 SCAR=6.9
Pod undocumented
16  
17 0 return "?(" . ( $self->[0]->to_string ) . ")";
18 }
19  
20 sub to_rdf {
21 0 ▶ my($self, $model) = @_;
Subroutine to_rdf: not called CC=1 SCAR=6.9
Pod undocumented
22  
23 0 return $model -> apply(
24 $model -> meta_uri('loc:not-empty'),
25 [ $self->[0] ],
26 {}
27 );
28 # my $bnode = $model -> bnode;
29 # $model -> add_type($bnode, 'loc:NotEmpty');
30 # $model -> add_expression($self -> [0]);
31 # return $bnode;
32 }
33  
34 sub execute {
35 291 ▶ my ( $self, $engine ) = @_;
Subroutine execute: called CC=1 SCAR=0.1
Pod undocumented
36  
37 return $engine->execute( $self->[0] )->then(
38 sub {
39 288 ▶ my ($result) = @_;
Subroutine __ANON__: called CC=4 SCAR=14.6
40 288 ▶ if ( blessed $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($result)) { } 288 0 288
41 288 ▶ return ( $result->is_defined && !$result->is_empty ? $engine->TRUE : $engine->FALSE );
Branch: 1 branch
BranchTrueFalseTotal
$result->is_defined && !$result->is_empty ? : 272 16 288
Condition66%2/3
$result->is_defined and not $result->is_empty
!ll&&!rl&&r
016272
MC/DC50%1/2
$result->is_defined and not $result->is_empty
$result->is_defined not $result->is_empty
Truth table66%2/3
A and not(B)
A= $result->is_definedB= not $result->is_empty
ABresult
0X0
100
111
42 }
43 else {
44 0 return ( $engine->FALSE );
45 }
46 }
47 291 );
48 }
49  
50 29 1;
« blib/lib/Dallycot/AST/Unique.pm ↑ Summary blib/lib/Dallycot/Value.pm »