aboutsummaryrefslogtreecommitdiff
path: root/c/tests/stepA_mal.mal
blob: 657e3e73e23ae6c39dbda7d91f4da6d9cba88b8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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