1 IN: alien.c-types.tests
2 USING: alien alien.syntax alien.c-types kernel tools.test
3 sequences system libc alien.strings io.encodings.utf8 ;
5 \ expand-constants must-infer
9 [ { "blah" 123 } ] [ { "blah" xyz } expand-constants ] unit-test
11 : foo ( -- n ) "fdafd" f dlsym [ 123 ] unless* ;
13 [ 123 ] [ foo ] unit-test
15 [ -1 ] [ -1 <char> *char ] unit-test
16 [ -1 ] [ -1 <short> *short ] unit-test
17 [ -1 ] [ -1 <int> *int ] unit-test
23 [ f ] [ "char*" c-type "void*" c-type eq? ] unit-test
24 [ t ] [ "char**" c-type "void*" c-type eq? ] unit-test
26 [ t ] [ "foo" heap-size "int" heap-size = ] unit-test
30 [ t ] [ "int" c-type "MyInt" c-type eq? ] unit-test
31 [ t ] [ "void*" c-type "MyInt*" c-type eq? ] unit-test
35 [ t ] [ "char" c-type "MyChar" c-type eq? ] unit-test
36 [ f ] [ "void*" c-type "MyChar*" c-type eq? ] unit-test
37 [ t ] [ "char*" c-type "MyChar*" c-type eq? ] unit-test
39 [ 32 ] [ { "int" 8 } heap-size ] unit-test
41 TYPEDEF: char* MyString
43 [ t ] [ "char*" c-type "MyString" c-type eq? ] unit-test
44 [ t ] [ "void*" c-type "MyString*" c-type eq? ] unit-test
46 TYPEDEF: int* MyIntArray
48 [ t ] [ "void*" c-type "MyIntArray" c-type eq? ] unit-test
50 TYPEDEF: uchar* MyLPBYTE
52 [ t ] [ { "char*" utf8 } c-type "MyLPBYTE" c-type = ] unit-test
55 0 B{ 1 2 3 4 } <displaced-alien> <void*>
58 [ t ] [ { t f t } >c-bool-array { 1 0 1 } >c-int-array = ] unit-test
60 os windows? cpu x86.64? and [
61 [ -2147467259 ] [ 2147500037 <long> *long ] unit-test