mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-23 13:01:42 -08:00
tests: ffi: add a smoke test for complex float handling
This commit is contained in:
parent
ad5fe834bb
commit
b8dfd2784c
1 changed files with 24 additions and 0 deletions
|
|
@ -112,3 +112,27 @@ int (*foo)(int) = (int (*)(int))#0;
|
|||
(test ffi.0005.string-is-array
|
||||
(finishes
|
||||
(si::make-foreign-data-from-array "dan")))
|
||||
|
||||
;;; Date: 2019-12-16
|
||||
;;; Description:
|
||||
;;; Regression test to ensure correct complex float handling by
|
||||
;;; the interface. On some platforms libffi is miscompiled to
|
||||
;;; mishandle complex float return values. See the commit message
|
||||
;;; in a commit ad5fe834.
|
||||
#+complex-float
|
||||
(defun ffi.0006.complex-floats ()
|
||||
;; dffi
|
||||
(let* ((arg #C(10.0s0 0.5s0))
|
||||
(expect (atanh arg)))
|
||||
(finishes (ffi:def-function "catanhf" ((x :csfloat))
|
||||
:returning :csfloat
|
||||
:module :default))
|
||||
(is (= expect (catanhf arg))))
|
||||
;; sffi
|
||||
#-ecl-bytecmp
|
||||
(let* ((arg #C(10.0s0 0.5s0))
|
||||
(expect (atanh arg)))
|
||||
(finishes (ffi:def-function "catanhf" ((x :csfloat))
|
||||
:returning :csfloat))
|
||||
(compile 'catanhf)
|
||||
(is (= expect (catanhf arg)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue