From 469e4b526f5735de7ecda5ebac98bea79e30530e Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Wed, 26 Aug 2009 17:38:33 -0500 Subject: [PATCH] use struct class in struct-arrays test --- .../struct-arrays/struct-arrays-tests.factor | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/basis/struct-arrays/struct-arrays-tests.factor b/basis/struct-arrays/struct-arrays-tests.factor index b537f448d5..f4da63544c 100755 --- a/basis/struct-arrays/struct-arrays-tests.factor +++ b/basis/struct-arrays/struct-arrays-tests.factor @@ -1,40 +1,40 @@ IN: struct-arrays.tests -USING: struct-arrays tools.test kernel math sequences +USING: classes.struct struct-arrays tools.test kernel math sequences alien.syntax alien.c-types destructors libc accessors sequences.private ; -C-STRUCT: test-struct -{ "int" "x" } -{ "int" "y" } ; +STRUCT: test-struct-array + { x int } + { y int } ; : make-point ( x y -- struct ) - "test-struct" - [ set-test-struct-y ] keep - [ set-test-struct-x ] keep ; + test-struct-array ; [ 5/4 ] [ - 2 "test-struct" + 2 test-struct-array 1 2 make-point over set-first 3 4 make-point over set-second - 0 [ [ test-struct-x ] [ test-struct-y ] bi / + ] reduce + 0 [ [ x>> ] [ y>> ] bi / + ] reduce ] unit-test [ 5/4 ] [ [ - 2 "test-struct" malloc-struct-array + 2 test-struct-array malloc-struct-array dup &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 + 0 [ [ x>> ] [ y>> ] bi / + ] reduce ] with-destructors ] unit-test -[ ] [ ALIEN: 123 10 "test-struct" drop ] unit-test +[ ] [ ALIEN: 123 10 test-struct-array drop ] unit-test [ ] [ [ - 10 "test-struct" malloc-struct-array + 10 test-struct-array malloc-struct-array &free drop ] with-destructors ] unit-test -[ 15 ] [ 15 10 "test-struct" resize length ] unit-test \ No newline at end of file +[ 15 ] [ 15 10 test-struct-array resize length ] unit-test + +