]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/prettyprint/prettyprint-tests.factor
basis: Cleaning up tests using lists and IN: forms.
[factor.git] / basis / alien / prettyprint / prettyprint-tests.factor
1 USING: alien.c-types alien.syntax io.encodings.ascii
2 io.streams.string prettyprint see tools.test ;
3 IN: alien.prettyprint.tests
4
5 CONSTANT: FOO 10
6
7 FUNCTION: int function_test ( float x, int[4][FOO] y, char* z, ushort *w )
8
9 { "USING: alien.c-types alien.syntax ;
10 IN: alien.prettyprint.tests
11 FUNCTION: int function_test
12     ( float x, int[4][FOO] y, char* z, ushort* w ) ; inline
13 " } [
14     [ \ function_test see ] with-string-writer
15 ] unit-test
16
17 FUNCTION-ALIAS: function-test int function_test
18     ( float x, int[4][FOO] y, char* z, ushort *w )
19
20 { "USING: alien.c-types alien.syntax ;
21 IN: alien.prettyprint.tests
22 FUNCTION-ALIAS: function-test int function_test
23     ( float x, int[4][FOO] y, char* z, ushort* w ) ; inline
24 " } [
25     [ \ function-test see ] with-string-writer
26 ] unit-test
27
28 TYPEDEF: c-string[ascii] string-typedef
29 TYPEDEF: char[1][2][3] array-typedef
30
31 { "USING: alien.c-types alien.syntax ;
32 IN: alien.prettyprint.tests
33 TYPEDEF: c-string[ascii] string-typedef
34 " } [
35     [ \ string-typedef see ] with-string-writer
36 ] unit-test
37
38 { "USING: alien.c-types alien.syntax ;
39 IN: alien.prettyprint.tests
40 TYPEDEF: char[1][2][3] array-typedef
41 " } [
42     [ \ array-typedef see ] with-string-writer
43 ] unit-test
44
45 C-TYPE: opaque-c-type
46
47 { "USING: alien.syntax ;
48 IN: alien.prettyprint.tests
49 C-TYPE: opaque-c-type
50 " } [
51     [ \ opaque-c-type see ] with-string-writer
52 ] unit-test
53
54 TYPEDEF: pointer: int pint
55
56 { "USING: alien.c-types alien.syntax ;
57 IN: alien.prettyprint.tests
58 TYPEDEF: int* pint
59 " } [
60     [ \ pint see ] with-string-writer
61 ] unit-test
62
63 { "pointer: int" } [ pointer: int unparse ] unit-test
64
65 CALLBACK: void callback-test ( int x, float[4] y )
66
67 { "USING: alien.c-types alien.syntax ;
68 IN: alien.prettyprint.tests
69 CALLBACK: void callback-test ( int x, float[4] y ) ;
70 " } [
71     [ \ callback-test see ] with-string-writer
72 ] unit-test