blib/lib/Dallycot/AST/BuildRange.pm

filter: Statementstmt 85.1% 23 / 27 Branchbran 50.0% 3 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 2 totaltotal 75.5% 37 / 49 CC 5 SCAR 8.7
CC
5
Cov
78%
to_rdf
6.0
execute
3.0
__ANON__
2.1
CRAP 2.4
« blib/lib/Dallycot/AST/Modulus.pm ↑ Summary blib/lib/Dallycot/AST/All.pm »
1 package Dallycot::AST::BuildRange;
2 29 our $AUTHORITY = 'cpan:JSMITH';
3  
4 # ABSTRACT: Create open or closed range
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 to_rdf {
13 0 ▶ my($self, $model) = @_;
Subroutine to_rdf: not called CC=2 SCAR=17.9
Pod undocumented
14  
15 0 ▶ if(@$self > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$self > 1) { } 0 0 0
16 0 return $model -> apply(
17 $model -> meta_uri('loc:range'),
18 [
19 $self->[0], $self -> [1]
20 ]
21 );
22 }
23 else {
24 0 return $model -> apply(
25 $model -> meta_uri('loc:upfrom'),
26 [ $self -> [0] ]
27 );
28 }
29 # my $bnode = $model -> bnode;
30 # $model -> add_type($bnode, 'loc:Range');
31 # $model -> add_first($bnode, $self->[0]);
32 # if(@$self > 1) {
33 # $model -> add_last($bnode, $self->[1]);
34 # }
35 # return $bnode;
36 }
37  
38 sub execute {
39 42 ▶ my ( $self, $engine ) = @_;
Subroutine execute: called CC=3 SCAR=11.0
Pod undocumented
40  
41 42 ▶ if ( @$self == 1 || !defined( $self->[1] ) ) { # semi-open range
Branch: 1 branch
BranchTrueFalseTotal
if (@$self == 1 or not defined $self->[1]) { } 35 7 42
Condition66%2/3
@$self == 1 or not defined $self->[1]
l!l&&r!l&&!r
0357
MC/DC50%1/2
@$self == 1 or not defined $self->[1]
@$self == 1 not defined $self->[1]
Truth table66%2/3
A or not(B)
A= @$self == 1B= not defined $self->[1]
ABresult
1X1
011
000
42 return $engine->execute( $self->[0] )->then(
43 sub {
44 33 ▶ bless [@_] => 'Dallycot::Value::OpenRange';
Subroutine __ANON__: called CC=1 SCAR=0.0
45 }
46 35 );
47 }
48 else {
49 return $engine->collect(@$self)->then(
50 sub {
51 7 ▶ my ( $left_value, $right_value ) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
52  
53 $left_value->is_less( $engine, $right_value )->then(
54 sub {
55 7 ▶ my ($f) = @_;
Subroutine __ANON__: called CC=2 SCAR=7.2
56  
57 7 ▶ bless [ $left_value, $right_value, $f ? 1 : -1 ] => 'Dallycot::Value::ClosedRange';
Branch: 1 branch
BranchTrueFalseTotal
$f ? : 7 0 7
58 }
59 7 );
60 }
61 7 );
62 }
63 }
64  
65 29 1;
« blib/lib/Dallycot/AST/Modulus.pm ↑ Summary blib/lib/Dallycot/AST/All.pm »