fix UB in ffi tests
This commit is contained in:
committed by
Bennet Bleßmann
parent
e1246f0c83
commit
760e1d2aac
@@ -2,7 +2,9 @@
|
||||
:- use_module(library(ffi)).
|
||||
|
||||
test :-
|
||||
getenv("ffi_f64_minus_zero_LIB", LIB),
|
||||
read(Body),
|
||||
term_variables(Body, [LIB]),
|
||||
Body,
|
||||
use_foreign_module(LIB, ['ffi_f64_minus_zero'([], f64), 'signum'([f64], f64)]),
|
||||
ffi:'ffi_f64_minus_zero'(N),
|
||||
A is max(0.0, N),
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
:- use_module(library(ffi)).
|
||||
|
||||
test :-
|
||||
getenv("ffi_f64_nan_LIB", LIB),
|
||||
read(Body),
|
||||
term_variables(Body, [LIB]),
|
||||
Body,
|
||||
use_foreign_module(LIB, ['ffi_f64_nan'([], f64)]),
|
||||
ffi:'ffi_f64_nan'(N),
|
||||
_ is round(N).
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
:- use_module(library(ffi)).
|
||||
|
||||
test :-
|
||||
getenv("ffi_invalid_type_LIB", LIB),
|
||||
read(Body),
|
||||
term_variables(Body, [LIB]),
|
||||
Body,
|
||||
use_foreign_module(LIB, [
|
||||
'ffi_invalid_type'([], c_void)
|
||||
]).
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
:- use_module(library(ffi)).
|
||||
|
||||
test :-
|
||||
getenv("ffi_return_values_LIB", LIB),
|
||||
read(Body),
|
||||
term_variables(Body, [LIB]),
|
||||
Body,
|
||||
use_foreign_module(LIB, [
|
||||
'ffi_return_values_true'([], bool),
|
||||
'ffi_return_values_false'([], bool),
|
||||
|
||||
Reference in New Issue
Block a user