Stream/Event.pm

filter: Statementstmt 94.1% 32 / 34 Branchbran 100% 2 / 2 Conditioncond 57.1% 4 / 7 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 90.9% 10 / 11 Podpod 100% 4 / 4 totaltotal 87.1% 54 / 62 CC 5 SCAR 9.0
CC
5
Cov
88%
bytes
6.0
__ANON__
4.0
BEGIN
1.0
CRAP 2.5
« Stream/Event/SysEx.pm ↑ Summary Stream/FIFO.pm »
1 13 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 13 ▶use Feature::Compat::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: MIDI event base class
6  
7  
8 13 ▶use experimental qw/ signatures /;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 package MIDI::Stream::Event;
11 class MIDI::Stream::Event;
12  
13 13 our $VERSION = '0.006';
14  
15 13 ▶use Carp qw/ croak /;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 13 ▶use MIDI::Stream::Tables qw/ status_name keys_for /;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18  
19 13 field $name :reader;
20 13 field $message :reader :param;
21 13 field $dt :reader :param;
22 13 field $bytes;
23 13 field $status :reader;
24  
25  
26 0 ▶method bytes {
Subroutine bytes: not called CC=2 SCAR=17.9
Pod documented
27 0 ▶ $bytes //= join '', map { chr } $message->@*;
Condition0%0/2
$bytes //= join("", map({chr $_;} @$message))
l!l
00
MC/DC0%0/1
$bytes //= join("", map({chr $_;} @$message))
$bytes
Truth table0%0/2
A
A= $bytes
Aresult
11
00
28 }
29  
30  
31 116 ▶method as_hashref {
Subroutine as_hashref: called CC=1 SCAR=0.0
Pod documented
32 +{
33 116 map { $_ => $self->$_ }
34 ( 'name', keys_for( $self->name )->@* )
35 };
36 }
37  
38  
39 116 ▶method TO_JSON { $self->as_hashref };
Subroutine TO_JSON: called CC=1 SCAR=0.0
Pod documented
40  
41  
42 31 ▶method as_arrayref {
Subroutine as_arrayref: called CC=1 SCAR=0.0
Pod documented
43 [
44 $self->name =>
45 31 map { $self->$_ } keys_for( $self->name )->@*
46 ]
47 }
48  
49 179 ▶ADJUST {
Subroutine __ANON__: called CC=4 SCAR=13.9
50 179 ▶ $name = status_name( $message->[0] ) // 'unknown';
Condition50%1/2
status_name($message->[0]) // "unknown"
l!l
1790
MC/DC0%0/1
status_name($message->[0]) // "unknown"
status_name($message->[0])
Truth table50%1/2
A
A= status_name($message->[0])
Aresult
11
00
51 179 $status = $message->[0];
52 # note on with velocity 0 is note off
53 179 ▶ $name = 'note_off' if $status < 0xa0 && !$message->[2];
Branch: 1 branch
BranchTrueFalseTotal
if $status < 160 and not $message->[2] 8 171 179
Condition100%3/3
$status < 160 and not $message->[2]
!ll&&!rl&&r
132398
MC/DC100%2/2
$status < 160 and not $message->[2]
$status < 160 not $message->[2]
Truth table100%3/3
A and not(B)
A= $status < 160B= not $message->[2]
ABresult
0X0
100
111
54 }
55  
56 13 1;
57  
58 __END__
« Stream/Event/SysEx.pm ↑ Summary Stream/FIFO.pm »