1 IN: struct-arrays.tests
2 USING: struct-arrays tools.test kernel math sequences
3 alien.syntax alien.c-types destructors libc accessors ;
9 : make-point ( x y -- struct )
10 "test-struct" <c-object>
11 [ set-test-struct-y ] keep
12 [ set-test-struct-x ] keep ;
15 2 "test-struct" <struct-array>
16 1 2 make-point over set-first
17 3 4 make-point over set-second
18 0 [ [ test-struct-x ] [ test-struct-y ] bi / + ] reduce
23 2 "test-struct" malloc-struct-array
24 dup underlying>> &free drop
25 1 2 make-point over set-first
26 3 4 make-point over set-second
27 0 [ [ test-struct-x ] [ test-struct-y ] bi / + ] reduce