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