add more failing test cases

This commit is contained in:
Kristin Rutenkolk 2024-07-23 15:35:21 +02:00
parent 510763f68e
commit 0bf267e44a
3 changed files with 36 additions and 3 deletions

View file

@ -73,7 +73,8 @@ AlignmentTest get_struct() {
} }
void test_call_with_trailing_string_arg(int a, int b, char* text) { void test_call_with_trailing_string_arg(int a, int b, char* text) {
printf("call of `test_call_with_trailing_string_arg` with a=%i b=%i text='%s'",a,b,text); printf("call of `test_call_with_trailing_string_arg` with a=%i b=%i text='%s'",1,2,text);
printf("\r ");
return; return;
} }

View file

@ -66,5 +66,5 @@
((ffi/cfn "test_call_with_trailing_string_arg" ((ffi/cfn "test_call_with_trailing_string_arg"
[::mem/int ::mem/int ::mem/c-string] [::mem/int ::mem/int ::mem/c-string]
::mem/void) ::mem/void)
1 2 "third arg") 1 2 "third arg"))))
)))

View file

@ -0,0 +1,32 @@
(ns coffi.mem-test
(:require
[clojure.test :as t]
[coffi.ffi :as ffi]
[coffi.layout :as layout]
[coffi.mem :as mem])
(:import
(java.lang.foreign
AddressLayout
Arena
MemoryLayout
MemorySegment
MemorySegment$Scope
SegmentAllocator
ValueLayout
ValueLayout$OfByte
ValueLayout$OfShort
ValueLayout$OfInt
ValueLayout$OfLong
ValueLayout$OfChar
ValueLayout$OfFloat
ValueLayout$OfDouble)
(java.lang.ref Cleaner)
(java.nio ByteOrder)))
(ffi/load-library "target/ffi_test.so")
(t/deftest can-serialize-string
(t/is
(instance? MemorySegment (mem/serialize "this is a string" ::mem/c-string))))