on master help sign in
Update test
commit30e5a19871c23f4515dac009d4ce84c9cc68c977 authorNiklas Larsson <niklas@mm.st> dateMon 7 Mar 2016, 14:55 (11 years ago) parente4a16c7
2 files changed+12−20
test/ffi008/expected+3 test/ffi008/ffi008.idr+9−20
test/ffi008/expected+3
@@ -1,2 +1,5 @@
11True
22True
3+a: 122 b: 0
4+4
5+00000010
test/ffi008/ffi008.idr+9−20
@@ -30,27 +30,16 @@ test3 = STRUCT [DOUBLE, DOUBLE, I8, I64]
3030test4 : Composite
3131test4 = PACKEDSTRUCT [I8, I8, I8, I64]
3232
33−printMore : IO ()
34−printMore = do
35− p <- alloc test3
36− f3 <- return $ (test3 # 1) p
37− a <- peek DOUBLE f3
38− printLn a
39− free p
40− fms <- return $ (test2#0) !mystruct
41− poke I32 fms 122
42− print_mystruct
43− printLn test4
44− printLn !size1
45− printLn !size2
46− printLn $ fields test3
47− printLn $ offsets (STRUCT [I8, I8, I8, I64, test3])
48− printLn $ sizeOf (ARRAY 67 I32)
49− printLn $ sizeOf test1
50− printLn $ sizeOf test2
51−
5233main : IO ()
5334main = do
5435 printLn $ sizeOf test1 == !size1
5536 printLn $ sizeOf test2 == !size2
56−-- printMore
37+ fms <- return $ (test2#0) !mystruct
38+ poke I32 fms 122
39+ print_mystruct
40+ printLn $ fields test3
41+ withAlloc test2 $ \p => do
42+ f1 <- return $ (test2 # 0) p
43+ poke I32 f1 8
44+ update I32 f1 (* 2)
45+ print !(peek I32 f1)