1 USING: alien alien.syntax alien.c-types alien.parser
2 kernel tools.test sequences system libc alien.strings
3 io.encodings.utf8 math.constants classes.struct ;
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*" parse-c-type c-type void* c-type eq? ] unit-test
19 [ t ] [ "char**" parse-c-type 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*" parse-c-type c-type eq? ] unit-test
30 [ t ] [ char c-type MyChar c-type eq? ] unit-test
31 [ f ] [ void* c-type "MyChar*" parse-c-type c-type eq? ] unit-test
32 [ t ] [ "char*" parse-c-type c-type "MyChar*" parse-c-type 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*" parse-c-type 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