]> gitweb.factorcode.org Git - factor.git/commitdiff
Add test for malloc-struct-array
authorU-SLAVA-DFB8FF805\Slava <Slava@slava-dfb8ff805.(none)>
Wed, 3 Dec 2008 15:54:59 +0000 (09:54 -0600)
committerU-SLAVA-DFB8FF805\Slava <Slava@slava-dfb8ff805.(none)>
Wed, 3 Dec 2008 15:54:59 +0000 (09:54 -0600)
basis/struct-arrays/struct-arrays-tests.factor [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 160abfe..d2bf583
@@ -1,6 +1,6 @@
 IN: struct-arrays.tests
 USING: struct-arrays tools.test kernel math sequences
-alien.syntax alien.c-types ;
+alien.syntax alien.c-types destructors libc accessors ;
 
 C-STRUCT: test-struct
 { "int" "x" }
@@ -17,3 +17,13 @@ C-STRUCT: test-struct
     3 4 make-point over set-second
     0 [ [ test-struct-x ] [ test-struct-y ] bi / + ] reduce
 ] unit-test
+
+[ 5/4 ] [
+    [
+        2 "test-struct" malloc-struct-array
+        dup underlying>> &free drop
+        1 2 make-point over set-first
+        3 4 make-point over set-second
+        0 [ [ test-struct-x ] [ test-struct-y ] bi / + ] reduce
+    ] with-destructors
+] unit-test