blib/lib/Logic/Relational/Goal/All.pm

filter: Statementstmt 83.3% 20 / 24 Branchbran 0.0% 0 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 7 / 8 Podpod 60.0% 3 / 5 totaltotal 70.4% 31 / 44 CC 4 SCAR 14.3
CC
4
Cov
72%
is_ground
12.0
expand
2.1
BEGIN
1.0
CRAP 4.2
« blib/lib/Logic/Relational/Goal/Any.pm ↑ Summary blib/lib/Logic/Relational/Term.pm »
1 package Logic::Relational::Goal::All;
2  
3 31 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 31 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 31 ▶use parent 'Logic::Relational::Goal';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Logic::Relational::Goal::All - Conjunction of goals (AND).
10  
11 =cut
12  
13 213 ▶sub new ( $class, $goals ) {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
14 213 return bless { goals => $goals }, $class;
15 }
16  
17 109 ▶sub goals ($self) { return $self->{goals}; }
Subroutine goals: called CC=1 SCAR=0.0
Pod undocumented
18  
19 97 ▶sub expand ( $self, %args ) {
Subroutine expand: called CC=2 SCAR=7.2
Pod documented
20 97 my $state = $args{state};
21 97 my $remaining = $args{remaining};
22 97 my $succ = $state->derive( goals => [ @{ $self->{goals} }, @$remaining ], );
23 97 ▶ return $succ // ();
Condition33%1/3
$succ // ()
l!l&&r!l&&!r
9700
MC/DC0%0/2
$succ // ()
$succ ()
Truth table33%1/3
A // B
A= $succB= ()
ABresult
1X1
011
000
24 }
25  
26 91 ▶sub freshen ( $self, $var_map ) {
Subroutine freshen: called CC=1 SCAR=0.0
Pod documented
27 91 my @fresh_goals = map { $_->freshen($var_map) } @{ $self->{goals} };
28 91 return ref($self)->new( \@fresh_goals );
29 }
30  
31 0 ▶sub is_ground ( $self, $subst ) {
Subroutine is_ground: not called CC=3 SCAR=24.8
Pod documented
32 0 for my $goal ( @{ $self->{goals} } ) {
33 0 ▶ return 0 unless $goal->is_ground($subst);
Branch: 1 branch
BranchTrueFalseTotal
unless $goal->is_ground($subst) 0 0 0
34 }
35 0 return 1;
36 }
37  
38 31 1;
« blib/lib/Logic/Relational/Goal/Any.pm ↑ Summary blib/lib/Logic/Relational/Term.pm »