Markdent/Role/BalancedEvent.pm

filter: Statementstmt 86.9% 40 / 46 Branchbran 33.3% 4 / 12 Conditioncond 25.0% 5 / 20 MC/DCmcdc 11.1% 1 / 9 Subroutinesub 91.6% 11 / 12 Podpod n/a totaltotal 61.6% 61 / 99 CC 14 SCAR 25.6
CC
14
Cov
63%
__ANON__
22.0
balances_event
22.0
__ANON__
2.8
CRAP 12.9
« Markdent/CLI.pm ↑ Summary Markdent/Dialect/Theory/BlockParser.pm »
1 package Markdent::Role::BalancedEvent;
2  
3 35 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 35 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 35 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 35 our $VERSION = '0.41';
8  
9 35 ▶use List::AllUtils qw( all );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 35 ▶use Markdent::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 35 ▶use Params::ValidationCompiler qw( validation_for );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 35 ▶use Specio::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 35 ▶use MooseX::Role::Parameterized;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 35 parameter compare => (
17 isa => t( 'ArrayRef', of => t('Str') ),
18 );
19  
20 290 ▶role {
Subroutine __ANON__: called CC=2 SCAR=10.2
21 290 my $p = shift;
22  
23 290 ▶ my @compare = @{ $p->compare || [] };
Condition100%2/2
$p->compare || []
l!l
22070
MC/DC100%1/1
$p->compare || []
$p->compare
Truth table100%2/2
A
A= $p->compare
Aresult
11
00
24  
25 290 my $validator = validation_for(
26 params => [
27 { type => t('EventObject') },
28 ],
29 );
30  
31 0 ▶ method balances_event => sub {
Subroutine __ANON__: not called CC=7 SCAR=30.9
Subroutine balances_event: called CC=7 SCAR=30.9
32 0 my $self = shift;
33 0 my ($other) = $validator->(@_);
34  
35 0 ▶ return 0 unless $self->name eq $other->name;
Branch: 2 branches
BranchTrueFalseTotal
unless $self->name eq $other->name 0 0 0
unless $self->name eq $other->name 0 537 537
36  
37 0 ▶ return 0
Branch: 2 branches
BranchTrueFalseTotal
unless $self->is_start and $other->is_end or $self->is_end and $other->is_start 0 0 0
unless $self->is_start and $other->is_end or $self->is_end and $other->is_start 0 537 537
Condition16%3/18
$self->is_start and $other->is_end or $self->is_end and $other->is_start
l!l&&r!l&&!r
000
$self->is_start and $other->is_end
!ll&&!rl&&r
000
$self->is_end and $other->is_start
!ll&&!rl&&r
000
$self->is_start and $other->is_end or $self->is_end and $other->is_start
l!l&&r!l&&!r
05370
$self->is_start and $other->is_end
!ll&&!rl&&r
53700
$self->is_end and $other->is_start
!ll&&!rl&&r
00537
MC/DC0%0/4
$self->is_start and $other->is_end or $self->is_end and $other->is_start
$self->is_start $other->is_end $self->is_end $other->is_start
MC/DC0%0/4
$self->is_start and $other->is_end or $self->is_end and $other->is_start
$self->is_start $other->is_end $self->is_end $other->is_start
Truth table0%0/7
A and B or C and D
A= $self->is_startB= $other->is_endC= $self->is_endD= $other->is_start
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
Truth table14%1/7
A and B or C and D
A= $self->is_startB= $other->is_endC= $self->is_endD= $other->is_start
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
38 unless ( $self->is_start && $other->is_end )
39 || ( $self->is_end && $other->is_start );
40  
41 0 ▶ return 1 unless @compare;
Branch: 2 branches
BranchTrueFalseTotal
unless @compare 0 0 0
unless @compare 64 473 537
42  
43 0 ▶ return all { $self->$_() eq $other->$_() } @compare;
Subroutine __ANON__: called CC=1 SCAR=0.4
44 290 };
45 35 };
46  
47 35 1;
48  
49 # ABSTRACT: A parameterized role for events which can check if they balance another event
50  
51 __END__
« Markdent/CLI.pm ↑ Summary Markdent/Dialect/Theory/BlockParser.pm »