1 ! (c)2009 Joe Groff bsd license
2 USING: accessors alien.c-types classes.struct classes.struct.vectored
3 kernel sequences specialized-arrays tools.test vocabs compiler.units ;
4 FROM: specialized-arrays.private => specialized-array-vocab ;
5 SPECIALIZED-ARRAYS: int ushort float ;
6 IN: classes.struct.vectored.tests
14 SPECIALIZED-ARRAY: foo
19 { x int-array{ 0 1 0 0 } }
20 { y float-array{ 0.0 2.0 0.0 0.0 } }
21 { z ushort-array{ 0 3 0 0 } }
22 { w ushort-array{ 0 4 0 0 } }
24 } [ S{ foo f 1 2.0 3 4 } 4 <vectored-foo> [ set-second ] keep ] unit-test
28 { x int-array{ 0 1 2 3 } }
29 { y float-array{ 0.0 0.5 1.0 1.5 } }
30 { z ushort-array{ 10 20 30 40 } }
31 { w ushort-array{ 15 25 35 45 } }
35 S{ foo { x 0 } { y 0.0 } { z 10 } { w 15 } }
36 S{ foo { x 1 } { y 0.5 } { z 20 } { w 25 } }
37 S{ foo { x 2 } { y 1.0 } { z 30 } { w 35 } }
38 S{ foo { x 3 } { y 1.5 } { z 40 } { w 45 } }
44 S{ foo { x 0 } { y 0.0 } { z 10 } { w 15 } }
45 S{ foo { x 1 } { y 0.5 } { z 20 } { w 25 } }
46 S{ foo { x 2 } { y 1.0 } { z 30 } { w 35 } }
47 S{ foo { x 3 } { y 1.5 } { z 40 } { w 45 } }
51 { x int-array{ 0 1 2 3 } }
52 { y float-array{ 0.0 0.5 1.0 1.5 } }
53 { z ushort-array{ 10 20 30 40 } }
54 { w ushort-array{ 15 25 35 45 } }
60 { x int-array{ 0 1 2 3 } }
61 { y float-array{ 0.0 0.5 1.0 1.5 } }
62 { z ushort-array{ 10 20 30 40 } }
63 { w ushort-array{ 15 25 35 45 } }
67 { S{ foo { x 2 } { y 1.0 } { z 30 } { w 35 } } } [
69 { x int-array{ 0 1 2 3 } }
70 { y float-array{ 0.0 0.5 1.0 1.5 } }
71 { z ushort-array{ 10 20 30 40 } }
72 { w ushort-array{ 15 25 35 45 } }
73 } third vectored-element>
78 foo specialized-array-vocab forget-vocab
79 ] with-compilation-unit