From 87e9bb7a7bbe0f241c23028306f8956b559f8093 Mon Sep 17 00:00:00 2001 From: Kristin Rutenkolk Date: Thu, 12 Dec 2024 12:36:15 +0100 Subject: [PATCH] adjust tests to make use of :raw? option in arrays --- test/clj/coffi/ffi_test.clj | 4 ++-- test/clj/coffi/mem_test.clj | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/clj/coffi/ffi_test.clj b/test/clj/coffi/ffi_test.clj index 5b20880..6310222 100644 --- a/test/clj/coffi/ffi_test.clj +++ b/test/clj/coffi/ffi_test.clj @@ -87,7 +87,7 @@ :x 3.14 :y 42.0}))) -(mem/defstruct ComplexType [::Point x ::mem/byte y [::mem/array ::mem/int 4] z ::mem/c-string w]) +(mem/defstruct ComplexType [::Point x ::mem/byte y [::mem/array ::mem/int 4 :raw? true] z ::mem/c-string w]) (t/deftest can-call-with-complex-defstruct (t/are [x y] (= x (y ((ffi/cfn "complexTypeTest" [::ComplexType] ::ComplexType) @@ -95,7 +95,7 @@ {: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) +(mem/defstruct ComplexTypeWrapped [::Point x ::mem/byte y [::mem/array ::mem/int 4] z ::mem/c-string w]) (t/deftest can-call-with-wrapped-complex-defstruct (t/are [x y] (= x (y ((ffi/cfn "complexTypeTest" [::ComplexTypeWrapped] ::ComplexTypeWrapped) diff --git a/test/clj/coffi/mem_test.clj b/test/clj/coffi/mem_test.clj index 25e0887..88decd2 100644 --- a/test/clj/coffi/mem_test.clj +++ b/test/clj/coffi/mem_test.clj @@ -88,9 +88,9 @@ (t/deftest can-define-structs-with-array-members (t/is (eval - `(mem/defstruct ~'ArrayTestType [::mem/int ~'x ::mem/byte ~'y [::mem/array ::mem/int 4] ~'z])))) + `(mem/defstruct ~'ArrayTestType [::mem/int ~'x ::mem/byte ~'y [::mem/array ::mem/int 4 :raw? true] ~'z])))) -(mem/defstruct ArrayTestType [::mem/int x ::mem/byte y [::mem/array ::mem/int 4] z]) +(mem/defstruct ArrayTestType [::mem/int x ::mem/byte y [::mem/array ::mem/int 4 :raw? true] z]) (t/deftest can-instantiated-array-member-structs (t/are [x y z] (z x (y (ArrayTestType. 5 6 (int-array [1 2 3 4])))) @@ -108,7 +108,7 @@ (int-array [1 2 3 4]) (.z (mem/deserialize (mem/serialize (ArrayTestType. 5 6 (int-array [1 2 3 4])) ::ArrayTestType) ::ArrayTestType))))) -(mem/defstruct ComplexTestType [[::mem/array ::ArrayTestType 4] x ::mem/byte y [::mem/array ::mem/int 4] z ::NestedTestType w]) +(mem/defstruct ComplexTestType [[::mem/array ::ArrayTestType 4 :raw? true] x ::mem/byte y [::mem/array ::mem/int 4 :raw? true] z ::NestedTestType w]) (t/deftest can-serialize-deserialize-complex-struct-type (t/is @@ -121,7 +121,7 @@ (mem/serialize ::ComplexTestType) (mem/deserialize ::ComplexTestType))))) -(mem/defstruct ComplexTestTypeWrapped [[::mem/array ::ArrayTestType 4] x ::mem/byte y [::mem/array ::mem/int 4] z ::NestedTestType w] :raw-arrays? false) +(mem/defstruct ComplexTestTypeWrapped [[::mem/array ::ArrayTestType 4] x ::mem/byte y [::mem/array ::mem/int 4] z ::NestedTestType w]) (t/deftest can-serialize-deserialize-complex-wrapped-struct-type (t/is