]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/c-types/c-types-tests.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / alien / c-types / c-types-tests.factor
1 USING: alien alien.syntax alien.c-types kernel tools.test
2 sequences system libc alien.strings io.encodings.utf8 ;
3 IN: alien.c-types.tests
4
5 CONSTANT: xyz 123
6
7 [ { "blah" 123 } ] [ { "blah" xyz } expand-constants ] unit-test
8
9 [ -1 ] [ -1 <char> *char ] unit-test
10 [ -1 ] [ -1 <short> *short ] unit-test
11 [ -1 ] [ -1 <int> *int ] unit-test
12
13 C-UNION: foo
14     "int"
15     "int" ;
16
17 [ f ] [ "char*" c-type "void*" c-type eq? ] unit-test
18 [ t ] [ "char**" c-type "void*" c-type eq? ] unit-test
19
20 [ t ] [ "foo" heap-size "int" heap-size = ] unit-test
21
22 TYPEDEF: int MyInt
23
24 [ t ] [ "int" c-type "MyInt" c-type eq? ] unit-test
25 [ t ] [ "void*" c-type "MyInt*" c-type eq? ] unit-test
26
27 TYPEDEF: char MyChar
28
29 [ t ] [ "char" c-type "MyChar" c-type eq? ] unit-test
30 [ f ] [ "void*" c-type "MyChar*" c-type eq? ] unit-test
31 [ t ] [ "char*" c-type "MyChar*" c-type eq? ] unit-test
32
33 [ 32 ] [ { "int" 8 } heap-size ] unit-test
34
35 TYPEDEF: char* MyString
36
37 [ t ] [ "char*" c-type "MyString" c-type eq? ] unit-test
38 [ t ] [ "void*" c-type "MyString*" c-type eq? ] unit-test
39
40 TYPEDEF: int* MyIntArray
41
42 [ t ] [ "void*" c-type "MyIntArray" c-type eq? ] unit-test
43
44 TYPEDEF: uchar* MyLPBYTE
45
46 [ t ] [ { "char*" utf8 } c-type "MyLPBYTE" c-type = ] unit-test
47
48 [
49     0 B{ 1 2 3 4 } <displaced-alien> <void*>
50 ] must-fail
51
52 os windows? cpu x86.64? and [
53     [ -2147467259 ] [ 2147500037 <long> *long ] unit-test
54 ] when