ユニットテストをに、最新のAutotest.mkを反映
[YACASL2.git] / test / unit / opdtok / cmd.c
1 #include <stdio.h>
2 #include "assemble.h"
3 #include "cerr.h"
4
5 OPD *opdtok(const char *str);
6
7 int main(){
8     int i, j;
9     OPD *opd;
10     char *str[] = {
11         "", "GR0,GR1", "GR0,A", "GR1,12", "GR0,0,GR1",
12         "\'aaa\',0", "\'aaa\',\'bbb\'", "\'aaa\'\',\'\'bbb\'", "\'aaa,bbb\'",
13         "1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0",
14         "1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1",
15         "\'1234567890123456789012345678901234567890\'",
16         "\'12345678901234567890123456789012345678901\'",
17     };
18
19     cerr = malloc_chk(sizeof(CERR), "cerr");    /* エラーの初期化 */
20     addcerrlist_assemble();
21     for(i = 0; i < ARRAYSIZE(str); i++) {
22         cerr->num = 0;
23         printf("%s\n", str[i]);
24         opd = opdtok(str[i]);
25         printf("OPDC:%d\n", opd->opdc);
26         for(j = 0; j < opd->opdc; j++) {
27             printf("OPDC[%d]:%s\n", j, opd->opdv[j]);
28         }
29         if(cerr->num > 0){
30             printf("Error - %d: %s\n", cerr->num, cerr->msg);
31         }
32         printf("\n");
33     }
34     freecerr();
35     return 0;
36 }