From 2b1d06227767bb2f00eaf295ba4ad2fd38111f4b Mon Sep 17 00:00:00 2001 From: Kristin Rutenkolk Date: Wed, 30 Oct 2024 21:00:45 +0100 Subject: [PATCH] add non raw array ffi test --- test/clj/coffi/ffi_test.clj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/clj/coffi/ffi_test.clj b/test/clj/coffi/ffi_test.clj index 77bfe6b..5b20880 100644 --- a/test/clj/coffi/ffi_test.clj +++ b/test/clj/coffi/ffi_test.clj @@ -95,5 +95,13 @@ {:x {:x 3.0 :y 4.0} :y 3 :w "hello from c"} #(dissoc % :z) [5 6 7 8] (comp vec :z))) +(mem/defstruct ComplexTypeWrapped [::Point x ::mem/byte y [::mem/array ::mem/int 4] z ::mem/c-string w] :raw-arrays? false) + +(t/deftest can-call-with-wrapped-complex-defstruct + (t/are [x y] (= x (y ((ffi/cfn "complexTypeTest" [::ComplexTypeWrapped] ::ComplexTypeWrapped) + (ComplexTypeWrapped. (Point. 2 3) 4 (int-array [5 6 7 8]) "hello from clojure")))) + {:x {:x 3.0 :y 4.0} :y 3 :w "hello from c"} #(dissoc % :z) + [5 6 7 8] (comp vec :z))) +