<commit_before>! (c)<NAME> bsd license
USING: accessors alien.c-types classes.c-types classes.struct
combinators io.streams.string kernel libc math namespaces
prettyprint prettyprint.config tools.test ;
IN: classes.struct.tests

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 <struct> y>> ] unit-test
[ 123 ] [ bar <struct> foo>> y>> ] unit-test

[ 1 2 3 t ] [
    1   2 3 t foo <struct-boa>   bar <struct-boa>
    {
        [ w>> ] 
        [ foo>> x>> ]
        [ foo>> y>> ]
        [ foo>> z>> ]
    } cleave
] unit-test

[ 7654 ] [ S{ foo f 98 7654 f } y>> ] unit-test
[ 7654 ] [ S{ foo { y 7654 } } y>> ] unit-test

UNION-STRUCT: float-and-bits
    { f single-float }
    { bits uint } ;

[ 1.0 ] [ float-and-bits <struct> 1.0 float>bits >>bits f>> ] unit-test
[ 4 ] [ float-and-bits heap-size ] unit-test

[ ] [ foo malloc-struct free ] unit-test

[ "S{ foo { y 7654 } }" ]
[ f boa-tuples? [ foo <struct> 7654 >>y [ pprint ] with-string-writer ] with-variable ] unit-test

[ "S{ foo f 0 7654 f }" ]
[ t boa-tuples? [ foo <struct> 7654 >>y [ pprint ] with-string-writer ] with-variable ] unit-test
<commit_msg>test that STRUCT:s and UNION-STRUCT:s see properly<commit_after>! (c)<NAME> bsd license
USING: accessors alien.c-types classes.c-types classes.struct
combinators io.streams.string kernel libc math multiline namespaces
prettyprint prettyprint.config see tools.test ;
IN: classes.struct.tests

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 <struct> y>> ] unit-test
[ 123 ] [ bar <struct> foo>> y>> ] unit-test

[ 1 2 3 t ] [
    1   2 3 t foo <struct-boa>   bar <struct-boa>
    {
        [ w>> ] 
        [ foo>> x>> ]
        [ foo>> y>> ]
        [ foo>> z>> ]
    } cleave
] unit-test

[ 7654 ] [ S{ foo f 98 7654 f } y>> ] unit-test
[ 7654 ] [ S{ foo { y 7654 } } y>> ] unit-test

UNION-STRUCT: float-and-bits
    { f single-float }
    { bits uint } ;

[ 1.0 ] [ float-and-bits <struct> 1.0 float>bits >>bits f>> ] unit-test
[ 4 ] [ float-and-bits heap-size ] unit-test

[ ] [ foo malloc-struct free ] unit-test

[ "S{ foo { y 7654 } }" ]
[ f boa-tuples? [ foo <struct> 7654 >>y [ pprint ] with-string-writer ] with-variable ] unit-test

[ "S{ foo f 0 7654 f }" ]
[ t boa-tuples? [ foo <struct> 7654 >>y [ pprint ] with-string-writer ] with-variable ] unit-test

[ <" USING: classes.c-types classes.struct kernel ;
IN: classes.struct.tests
STRUCT: foo
    { x char initial: 0 } { y int initial: 123 }
    { z boolean initial: f } ;
"> ]
[ [ foo see ] with-string-writer ] unit-test

[ <" USING: classes.c-types classes.struct ;
IN: classes.struct.tests
UNION-STRUCT: float-and-bits
    { f single-float initial: 0.0 } { bits uint initial: 0 } ;
"> ]
[ [ float-and-bits see ] with-string-writer ] unit-test
{'fraction_non_alphanumeric': 0.1605058365758755, 'fraction_numerical': 0.04053177691309987, 'mean_word_length': 2.566473988439306, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1070082', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1155, 'n_words': 345}