diff options
author | Camil Staps | 2016-01-31 14:46:55 +0100 |
---|---|---|
committer | Camil Staps | 2016-01-31 14:46:55 +0100 |
commit | 2fb8dc632b4c007033d9a40c6d6ab060d1ea1fe3 (patch) | |
tree | 1877df4581887fd0e79aa396b64e61b28ada87a3 /test.icl | |
parent | Makefile (diff) |
Working version
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) |