blib/lib/Wasm/Wasmtime/Engine.pm

filter: Statementstmt 89.6% 26 / 29 Branchbran 16.6% 1 / 6 Conditioncond 22.2% 2 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 62.5% 35 / 56 CC 7 SCAR 24.4
CC
7
Cov
66%
__ANON__
19.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.5
« blib/lib/Wasm.pm ↑ Summary blib/lib/Test2/Plugin/Wasm.pm »
1 package Wasm::Wasmtime::Engine;
2  
3 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 25 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 25 ▶use Wasm::Wasmtime::FFI;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 25 ▶use Wasm::Wasmtime::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # ABSTRACT: Wasmtime engine class
10 25 our $VERSION = '0.24'; # VERSION
11  
12  
13 25 $ffi_prefix = 'wasm_engine_';
14 25 $ffi->load_custom_type('::PtrObject' => 'wasm_engine_t' => __PACKAGE__ );
15  
16  
17 57 ▶$ffi->attach( [ 'new_with_config' => 'new' ] => ['wasm_config_t'] => 'wasm_engine_t' => sub {
Subroutine __ANON__: called CC=7 SCAR=29.4
18 57 my($xsub, $class, $config) = @_;
19 57 ▶ $config ||= Wasm::Wasmtime::Config->new;
Condition66%2/3
$config ||= "Wasm::Wasmtime::Config"->new
l!l&&r!l&&!r
17400
MC/DC0%0/2
$config ||= "Wasm::Wasmtime::Config"->new
$config "Wasm::Wasmtime::Config"->new
Truth table66%2/3
A ||= B
A= $configB= "Wasm::Wasmtime::Config"->new
ABresult
1X1
011
000
20 57 ▶ if(defined $ENV{PERL_WASM_WASMTIME_MEMORY})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ENV{"PERL_WASM_WASMTIME_MEMORY"}) 0 57 57
21 {
22 0 my($memory_reservation, $memory_guard_size) = split /:/, $ENV{PERL_WASM_WASMTIME_MEMORY};
23 0 ▶ $config->memory_reservation($memory_reservation) if defined $memory_reservation && length $memory_reservation;
Branch: 1 branch
BranchTrueFalseTotal
if defined $memory_reservation and length $memory_reservation 0 0 0
Condition0%0/3
defined $memory_reservation and length $memory_reservation
!ll&&!rl&&r
000
MC/DC0%0/2
defined $memory_reservation and length $memory_reservation
defined $memory_reservation length $memory_reservation
Truth table0%0/3
A and B
A= defined $memory_reservationB= length $memory_reservation
ABresult
0X0
100
111
24 0 ▶ $config->memory_guard_size($memory_guard_size) if defined $memory_guard_size && length $memory_guard_size;
Branch: 1 branch
BranchTrueFalseTotal
if defined $memory_guard_size and length $memory_guard_size 0 0 0
Condition0%0/3
defined $memory_guard_size and length $memory_guard_size
!ll&&!rl&&r
000
MC/DC0%0/2
defined $memory_guard_size and length $memory_guard_size
defined $memory_guard_size length $memory_guard_size
Truth table0%0/3
A and B
A= defined $memory_guard_sizeB= length $memory_guard_size
ABresult
0X0
100
111
25 }
26 57 my $self = $xsub->($config);
27 57 delete $config->{ptr};
28 57 $self;
29 25 });
30  
31 25 _generate_destroy('wasm_engine_delete');
32  
33 25 1;
34  
35 __END__
« blib/lib/Wasm.pm ↑ Summary blib/lib/Test2/Plugin/Wasm.pm »