2009-08-12 10:01:32 -04:00
|
|
|
USING: accessors alien.c-types classes.c-types classes.struct
|
|
|
|
combinators kernel tools.test ;
|
|
|
|
IN: classes.struct.tests
|
2009-08-11 22:13:18 -04:00
|
|
|
|
|
|
|
STRUCT: foo
|
|
|
|
{ x char }
|
|
|
|
{ y int initial: 123 }
|
|
|
|
{ z boolean } ;
|
|
|
|
|
|
|
|
STRUCT: bar
|
|
|
|
{ w ushort initial: HEX: ffff }
|
|
|
|
{ foo foo } ;
|
|
|
|
|
|
|
|
[ 12 ] [ foo heap-size ] unit-test
|
|
|
|
[ 16 ] [ bar heap-size ] unit-test
|
|
|
|
[ 123 ] [ foo new y>> ] unit-test
|
|
|
|
[ 123 ] [ bar new foo>> y>> ] unit-test
|
2009-08-12 10:01:32 -04:00
|
|
|
|
|
|
|
[ 1 2 3 t ] [
|
2009-08-12 10:37:09 -04:00
|
|
|
1 2 3 t foo boa bar boa
|
2009-08-12 10:01:32 -04:00
|
|
|
{
|
|
|
|
[ w>> ]
|
|
|
|
[ foo>> x>> ]
|
|
|
|
[ foo>> y>> ]
|
|
|
|
[ foo>> z>> ]
|
|
|
|
} cleave
|
|
|
|
] unit-test
|
2009-08-12 16:04:27 -04:00
|
|
|
|
|
|
|
[ 7654 ] [ S{ foo f 98 7654 f } y>> ] unit-test
|
|
|
|
[ 7654 ] [ S{ foo { y 7654 } } y>> ] unit-test
|