on master help sign in
added c test using modifyIORef'
commit01fdc751982020d6c8328c811965acbc0969a3cd authorRui Barreiro <rui.barreiro@gmail.com> dateFri 6 Oct 2017, 18:53 (9 years ago) parent4c19d46
4 files changed+19−2
test/TestData.hs+2−1 test/basic021/basic021_2.idr+13 test/basic021/expected+1 test/basic021/run+3−1
test/TestData.hs+2−1
@@ -72,7 +72,8 @@ testFamiliesData = [
7272 ( 18, ANY ),
7373 ( 19, ANY ),
7474 ( 20, ANY ),
75− ( 21, C_CG )]),
75+ ( 21, C_CG ),
76+ ( 22, NODE_CG )]),
7677 ("bignum", "Bignum",
7778 [ ( 1, ANY ),
7879 ( 2, ANY )]),
test/basic021/basic021_2.idrnew file+13
@@ -0,0 +1,13 @@
1+import Data.IORef
2+
3+count : HasReference ffi => Nat -> IORef Integer -> IO' ffi ()
4+count Z ref
5+ = do x <- readIORef' ref
6+ printLn' x
7+count (S k) ref
8+ = do modifyIORef' ref (+1)
9+ count k ref
10+
11+main : IO ()
12+main = do r <- newIORef' 0
13+ count 1000 r
test/basic021/expected+1
@@ -1 +1,2 @@
111000000
2+1000
test/basic021/run+3−1
@@ -1,4 +1,6 @@
11#!/usr/bin/env bash
22${IDRIS:-idris} $@ basic021.idr -o basic021
3+${IDRIS:-idris} $@ basic021_2.idr -o basic021_2
34./basic021
4−rm -f basic021 *.ibc
5+./basic021_2
6+rm -f basic021 basic021_2 *.ibc