1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
module test
import StdEnv
import CleanC
Start
# s = cNewState
# s = cInit s
# (r0,s) = test_int s
# (r1,s) = test_string s
# (r2,s) = test_double s
# (r3,s) = test_two_params s
= and [r0,r1,r2,r3]
test_int :: *State -> (Bool, *State)
test_int s
# (i, s) = cCall Int "test_int" 15 s
= (fromCParam i == 30, s)
test_string :: *State -> (Bool, *State)
test_string st
# (s, st) = cCall String "test_string" "!dlroW ,olleH" st
= (fromCParam s == "Hello, World!", st)
test_double :: *State -> (Bool, *State)
test_double s
# (r, s) = cCall Real "test_double" 17.0 s
= (fromCParam r == 8.5, s)
test_two_params :: *State -> (Bool, *State)
test_two_params s
# (i, s) = cCall Int "test_two_params" (13,29) s
= (fromCParam i == 42, s)
|