8d1d04eba1b437918185be0ed0ce2fc1d6283623
[YACASL2.git] / test / unit / n2word / cmd.c
1 #include <stdio.h>
2 #include "casl2.h"
3 #include "assemble.h"
4
5 int main(){
6     int i;
7     WORD r;
8     char *str[] = {
9         "0", "01", "1a", "-5G", "123", "32767", "32768", "32769",
10         "-1", "-2345", "-32768", "-32769", "-32770"
11     };
12
13     cerr = malloc_chk(sizeof(CERR), "cerr");    /* エラーの初期化 */
14     addcerrlist_word();
15     for(i = 0; i < sizeof(str)/sizeof(str[0]); i++) {
16         cerr->num = 0;
17         r = n2word(str[i]);
18         printf("%s\t0x%04x", str[i], r);
19         if(cerr->num > 0) {
20             printf("\tError - %d\t%s", cerr->num, cerr->msg);
21         }
22         printf("\n");
23     }
24     freecerr();
25     return 0;
26 }