Debian Codegraph @

t/ffi_platypus_api.t

raw
1 use Test2::V0 -no_srand => 1;
2 use FFI::Platypus::API;
3
4 subtest 'basic' => sub {
5
6 {
7 package FFI::Platypus::Type::C1;
8
9 sub ffi_custom_type_api_1
10 {
11 return {
12 native_type => 'sint8',
13 perl_to_native => sub { $_[0] * 2 },
14 }
15 }
16 }
17
18 my $ffi = FFI::Platypus->new;
19 $ffi->load_custom_type('::C1' => 'c1');
20 is(
21 $ffi->function( 0 => ['c1'] => 'sint8' )->call(10),
22 20,
23 );
24
25 };
26
27 done_testing;