Tools for testing FFI
In your t/ffi/test.c:
int
mytest()
{
return 42;
}
In your t/mytest.t:
use Test2::V0;
use Test2::Tools::FFI;
is(
ffi->test->function( mytest => [] => 'int')->call,
42,
);
done_testing;
This Test2 Tools module provide some basic tools for testing FFI modules.
ffi_options %options;
This must be run before any ffi->
functions. Options available:
-
api
The FFI::Platypus api level. Zero (0) by default for backward compat, but it is recommended that you use One (1).
my $ffi = ffi->runtime;
Returns a FFI::Platypus instance connected to the runtime for your module.
my $ffi = ffi->test;
Returns a FFI::Platypus instance connected to the test for your module.
my $ffi = ffi->combined;
Return a FFI::Platypus instance with the combined test and runtime libraries for your module.
Graham Ollis plicease@cpan.org
This software is copyright (c) 2018-2022 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.