1 USING: alien alien.syntax alien.c-types kernel tools.test
2 sequences system libc alien.strings io.encodings.utf8
4 IN: alien.c-types.tests
8 [ 492 ] [ { "int" xyz } heap-size ] unit-test
10 [ -1 ] [ -1 <char> *char ] unit-test
11 [ -1 ] [ -1 <short> *short ] unit-test
12 [ -1 ] [ -1 <int> *int ] unit-test
18 [ f ] [ "char*" c-type "void*" c-type eq? ] unit-test
19 [ t ] [ "char**" c-type "void*" c-type eq? ] unit-test
21 [ t ] [ "foo" heap-size "int" heap-size = ] unit-test
25 [ t ] [ "int" c-type "MyInt" c-type eq? ] unit-test
26 [ t ] [ "void*" c-type "MyInt*" c-type eq? ] unit-test
30 [ t ] [ "char" c-type "MyChar" c-type eq? ] unit-test
31 [ f ] [ "void*" c-type "MyChar*" c-type eq? ] unit-test
32 [ t ] [ "char*" c-type "MyChar*" c-type eq? ] unit-test
34 [ 32 ] [ { "int" 8 } heap-size ] unit-test
36 TYPEDEF: char* MyString
38 [ t ] [ "char*" c-type "MyString" c-type eq? ] unit-test
39 [ t ] [ "void*" c-type "MyString*" c-type eq? ] unit-test
41 TYPEDEF: int* MyIntArray
43 [ t ] [ "void*" c-type "MyIntArray" c-type eq? ] unit-test
45 TYPEDEF: uchar* MyLPBYTE
47 [ t ] [ { char* utf8 } c-type "MyLPBYTE" c-type = ] unit-test
50 0 B{ 1 2 3 4 } <displaced-alien> <void*>
53 os windows? cpu x86.64? and [
54 [ -2147467259 ] [ 2147500037 <long> *long ] unit-test
57 [ 0 ] [ -10 uchar c-type-clamp ] unit-test
58 [ 12 ] [ 12 uchar c-type-clamp ] unit-test
59 [ -10 ] [ -10 char c-type-clamp ] unit-test
60 [ 127 ] [ 230 char c-type-clamp ] unit-test
61 [ t ] [ pi dup float c-type-clamp = ] unit-test