diff options
Diffstat (limited to 'c/tests')
| -rw-r--r-- | c/tests/step9_interop.mal | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/c/tests/step9_interop.mal b/c/tests/step9_interop.mal new file mode 100644 index 0000000..657e3e7 --- /dev/null +++ b/c/tests/step9_interop.mal @@ -0,0 +1,23 @@ + +;; Testing FFI of "strlen" +(. nil "int32" "strlen" "string" "abcde") +;=>5 +(. nil "int32" "strlen" "string" "") +;=>0 + +;; Testing FFI of "strcmp" + +(. nil "int32" "strcmp" "string" "abc" "string" "abcA") +;=>-65 +(. nil "int32" "strcmp" "string" "abcA" "string" "abc") +;=>65 +(. nil "int32" "strcmp" "string" "abc" "string" "abc") +;=>0 + + +;; Testing FFI of "pow" (libm.so) + +(. "libm.so" "double" "pow" "double" 2.0 "double" 3.0) +;=>8.000000 +(. "libm.so" "double" "pow" "double" 3.0 "double" 2.0) +;=>9.000000 |
