blib/lib/FFI/Platypus/Type.pm

filter: Statementstmt 100% 24 / 24 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 87.8% 36 / 41 CC 5 SCAR 11.8
CC
5
Cov
94%
alignof
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« lib/FFI/Build/File/Base.pm ↑ Summary lib/FFI/Probe/Runner.pm »
1 package FFI::Platypus::Type;
2  
3 57 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 57 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 57 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 57 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 57 require FFI::Platypus;
8  
9 # ABSTRACT: Defining types for FFI::Platypus
10 57 our $VERSION = '2.12'; # VERSION
11  
12 # The TypeParser and Type classes are used internally ONLY and
13 # are not to be exposed to the user. External users should
14 # not under any circumstances rely on the implementation of
15 # these classes.
16  
17 sub alignof
18 153 ▶{
Subroutine alignof: called CC=5 SCAR=16.2
Pod undocumented
19 153 my($self) = @_;
20 153 my $meta = $self->meta;
21  
22 # TODO: it is possible, though complicated
23 # to compute the alignment of a struct
24 # type record.
25 croak "cannot determine alignment of record"
26 if $meta->{type} eq 'record'
27 153 ▶ && $meta->{ref} == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $meta->{"type"} eq "record" and $meta->{"ref"} == 1 0 153 153
Condition66%2/3
$meta->{"type"} eq "record" and $meta->{"ref"} == 1
!ll&&!rl&&r
143100
MC/DC0%0/2
$meta->{"type"} eq "record" and $meta->{"ref"} == 1
$meta->{"type"} eq "record" $meta->{"ref"} == 1
Truth table66%2/3
A and B
A= $meta->{"type"} eq "record"B= $meta->{"ref"} == 1
ABresult
0X0
100
111
28  
29 153 my $ffi_type;
30 153 ▶ if($meta->{type} eq 'pointer')
Branch: 2 branches
BranchTrueFalseTotal
if ($meta->{'type'} eq 'pointer') { } 11 142 153
elsif ($meta->{'type'} eq 'record') { } 10 132 142
31 {
32 11 $ffi_type = 'pointer';
33 }
34 elsif($meta->{type} eq 'record')
35 {
36 10 $ffi_type = 'uint8';
37 }
38 else
39 {
40 132 $ffi_type = $meta->{ffi_type};
41 }
42  
43 153 require FFI::Platypus::ShareConfig;
44 153 FFI::Platypus::ShareConfig->get('align')->{$ffi_type};
45 }
46  
47 57 1;
48  
49 __END__
« lib/FFI/Build/File/Base.pm ↑ Summary lib/FFI/Probe/Runner.pm »