c7fc5e3ca5a5bfba35f9a589e51c8a6d7894bb7b
[YACASL2.git] / test / unit / getgr / getgr.c
1 #include "casl2.h"
2 #include "assemble.h"
3
4 int main(){
5     int i, j;
6     char *title = malloc(64);
7     WORD r;
8     bool is_x[] = {
9         false, true
10     };
11     char *str[] = {
12         "", "0", "aaa", "GR", "GR8", "GR20",
13         "GR0", "GR1", "GR2", "GR3", "GR4", "GR5", "GR6", "GR7"
14     };
15
16     cerr = malloc_chk(sizeof(CERR), "cerr");    /* エラーの初期化 */
17     addcerrlist_assemble();
18     for(i = 0; i <= 1; i++) {
19         title = (is_x[i] == false) ? "Generel Register" : "Index Register";
20         printf("== %s ==\n", title);
21         for(j = 0; j < ARRAYSIZE(str); j++) {
22             cerr->num = 0;
23             r = getgr(str[j], is_x[i]);
24             printf("%s\t#%04X", str[j], r);
25             if(cerr->num > 0) {
26                 printf("\tError - %d\t%s", cerr->num, cerr->msg);
27             }
28             printf("\n");
29         }
30     }
31     freecerr();
32     return 0;
33 }