diff options
Diffstat (limited to 'test.icl')
-rw-r--r-- | test.icl | 34 |
1 files changed, 28 insertions, 6 deletions
@@ -1,12 +1,34 @@ module test import StdEnv -import cleanc +import CleanC Start -# s = 10 -# s = puti 50 s -# s = call "hello" s -# (i, s) = geti s -= i +# 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) |