From 78164a12a7b4bbda738b45a7b42fa0889d010ad5 Mon Sep 17 00:00:00 2001 From: Kristin Rutenkolk Date: Mon, 28 Oct 2024 14:35:54 +0100 Subject: [PATCH] add struct serialization tests --- test/clj/coffi/mem_test.clj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/clj/coffi/mem_test.clj b/test/clj/coffi/mem_test.clj index 3f531ad..3f72f89 100644 --- a/test/clj/coffi/mem_test.clj +++ b/test/clj/coffi/mem_test.clj @@ -67,4 +67,12 @@ (TestType. 5 10 15) identity (TestType. 5 10 15) (fn [s] {:a 5 :b 10 :c 15}))) +(t/deftest can-serialize-struct-type + (t/is + (instance? MemorySegment (mem/serialize (TestType. 5 10 15) ::TestType)))) + +(t/deftest can-deserialize-struct-type + (t/is + (= {:a 5 :b 10 :c 15} + (mem/deserialize (mem/serialize (TestType. 5 10 15) ::TestType) ::TestType))))