1 ! (c)2009 Joe Groff bsd license
2 USING: accessors alien.c-types alien.parser alien.syntax
3 continuations debugger eval parser tools.test vocabs.parser
14 "alien.parser.tests" use-vocab
15 "alien.c-types" use-vocab
17 [ int ] [ "int" parse-c-type ] unit-test
18 [ { int 5 } ] [ "int[5]" parse-c-type ] unit-test
19 [ { int 5 10 11 } ] [ "int[5][10][11]" parse-c-type ] unit-test
20 [ { int 5 10 eleven } ] [ "int[5][10][eleven]" parse-c-type ] unit-test
21 [ pointer: void ] [ "void*" parse-c-type ] unit-test
22 [ pointer: int ] [ "int*" parse-c-type ] unit-test
23 [ pointer: int* ] [ "int**" parse-c-type ] unit-test
24 [ pointer: int** ] [ "int***" parse-c-type ] unit-test
25 [ pointer: int*** ] [ "int****" parse-c-type ] unit-test
26 [ { pointer: int 3 } ] [ "int*[3]" parse-c-type ] unit-test
27 [ { pointer: void 3 } ] [ "void*[3]" parse-c-type ] unit-test
28 [ pointer: { int 3 } ] [ "int[3]*" parse-c-type ] unit-test
29 [ c-string ] [ "c-string" parse-c-type ] unit-test
30 [ char2 ] [ "char2" parse-c-type ] unit-test
31 [ pointer: char2 ] [ "char2*" parse-c-type ] unit-test
33 [ "void[3]" parse-c-type ] must-fail
34 [ "int[3" parse-c-type ] must-fail
35 [ "int[3][4" parse-c-type ] must-fail
36 [ "not-word" parse-c-type ] [ error>> no-word-error? ] must-fail-with
39 FUNCTION: void* alien-parser-function-effect-test ( int *arg1 float arg2 ) ;
41 { ( arg1 arg2 -- void* ) } [
42 \ alien-parser-function-effect-test "declared-effect" word-prop
45 { t } [ \ alien-parser-function-effect-test inline? ] unit-test
47 FUNCTION-ALIAS: (alien-parser-function-effect-test) void* alien-parser-function-effect-test ( int *arg1 float arg2 ) ;
49 { ( arg1 arg2 -- void* ) } [
50 \ (alien-parser-function-effect-test) "declared-effect" word-prop
53 { t } [ \ (alien-parser-function-effect-test) inline? ] unit-test
55 CALLBACK: void* alien-parser-callback-effect-test ( int *arg1 float arg2 ) ;
57 { ( arg1 arg2 -- void* ) } [
58 \ alien-parser-callback-effect-test "callback-effect" word-prop
61 { t } [ \ alien-parser-callback-effect-test inline? ] unit-test
64 TYPEDEF: int alien-parser-test-int ! reasonably unique name...
68 "USE: specialized-arrays SPECIALIZED-ARRAY: alien-parser-test-int" eval( -- )
69 ! after restart, we end up here