blib/lib/Dallycot/AST/Invert.pm

filter: Statementstmt 88.4% 23 / 26 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 3 totaltotal 73.9% 34 / 46 CC 4 SCAR 6.3
CC
4
Cov
82%
__ANON__
3.1
new
2.1
to_rdf
2.0
CRAP 1.9
« blib/lib/Dallycot/Channel.pm ↑ Summary blib/lib/Dallycot/Value/OpenRange.pm »
1 package Dallycot::AST::Invert;
2 29 our $AUTHORITY = 'cpan:JSMITH';
3  
4 # ABSTRACT: Invert the truth of an expression or 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 sub new {
13 13 ▶ my ( $class, $expr ) = @_;
Subroutine new: called CC=2 SCAR=7.6
Pod undocumented
14  
15 13 ▶ $class = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0130
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
16 13 return bless [$expr] => $class;
17 }
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:invert'),
25 [ $self->[0] ],
26 {}
27 );
28 }
29  
30 sub execute {
31 80 ▶ my ( $self, $engine ) = @_;
Subroutine execute: called CC=1 SCAR=0.1
Pod undocumented
32  
33 return $engine->execute( $self->[0] )->then(
34 sub {
35 80 ▶ my ($res) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.3
36  
37 80 ▶ if ( $res->isa('Dallycot::Value::Boolean') ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($res->isa('Dallycot::Value::Boolean')) { } 67 13 80
elsif ($res->isa('Dallycot::Value::Lambda')) { } 13 0 13
38 67 return Dallycot::Value::Boolean->new( !$res->value );
39 }
40 elsif ( $res->isa('Dallycot::Value::Lambda') ) {
41 13 return Dallycot::Value::Lambda->new(
42 expression => Dallycot::AST::Invert->new( $res->[0] ),
43 bindings => $res->[1],
44 bindings_with_defaults => $res->[2],
45 options => $res->[3],
46 closure_environment => $res->[4],
47 closure_namespaces => $res->[5]
48 );
49 }
50 else {
51 0 return Dallycot::Value::Boolean->new( !$res->is_defined );
52 }
53 }
54 80 );
55 }
56  
57 29 1;
« blib/lib/Dallycot/Channel.pm ↑ Summary blib/lib/Dallycot/Value/OpenRange.pm »