]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/parser/parser-tests.factor
add some tests for parse-c-type
[factor.git] / basis / alien / parser / parser-tests.factor
1 ! (c)2009 Joe Groff bsd license
2 USING: alien.c-types alien.parser alien.syntax tools.test
3 vocabs.parser ;
4 IN: alien.parser.tests
5
6 TYPEDEF: char char2
7
8 [ int ] [ "int" parse-c-type ] unit-test
9 [ { int 5 } ] [ "int[5]" parse-c-type ] unit-test
10 [ { int 5 10 11 } ] [ "int[5][10][11]" parse-c-type ] unit-test
11 [ void* ] [ "int*" parse-c-type ] unit-test
12 [ void* ] [ "int**" parse-c-type ] unit-test
13 [ void* ] [ "int***" parse-c-type ] unit-test
14 [ void* ] [ "int****" parse-c-type ] unit-test
15 [ char* ] [ "char*" parse-c-type ] unit-test
16 [ void* ] [ "char**" parse-c-type ] unit-test
17 [ void* ] [ "char***" parse-c-type ] unit-test
18 [ void* ] [ "char****" parse-c-type ] unit-test
19 [ char2 ] [ "char2" parse-c-type ] unit-test
20 [ char* ] [ "char2*" parse-c-type ] unit-test
21
22 SYMBOL: not-c-type
23
24 [ "not-c-type" parse-c-type ] [ no-c-type? ] must-fail-with
25 [ "not-word" parse-c-type ] [ no-word-error? ] must-fail-with
26