統合テストに、最新版Autotest.mkを反映
[YACASL2.git] / test / unit / cerrtest / cerrtest.c
1 #include <stdio.h>
2 #include "casl2.h"
3
4 static CERR cerr_utest[] = {
5     { 101, "label already defined" },
6     { 102, "label table is full" },
7     { 103, "label not found" },
8     { 104, "label length is too long" },
9     { 105, "no command in the line" },
10     { 106, "operand count mismatch" },
11     { 107, "no label in START" },
12     { 108, "not command of operand \"r\"" },
13     { 109, "not command of operand \"r1,r2\"" },
14     { 110, "not command of operand \"r,adr[,x]\"" },
15     { 111, "not command of operand \"adr[,x]\"" },
16     { 112, "not command of no operand" },
17     { 113, "command not defined" },
18     { 114, "not integer" },
19     { 115, "not hex" },
20     { 116, "out of hex range" },
21     { 117, "operand is too many" },
22     { 118, "operand length is too long" },
23     { 119, "out of COMET II memory" },
24     { 120, "GR0 in operand x" },
25     { 121, "cannot get operand token" },
26     { 122, "cannot create hash table" },
27     { 123, "unclosed quote" },
28     { 124, "more than one character in literal" },
29     { 125, "not GR in operand x" },
30     { 201, "execute - out of COMET II memory" },
31     { 202, "SVC input - out of Input memory" },
32     { 203, "SVC output - out of COMET II memory" },
33     { 204, "Program Register (PR) - out of COMET II memory" },
34     { 205, "Stack Pointer (SP) - cannot allocate stack buffer" },
35     { 206, "Address - out of COMET II memory" },
36     { 207, "Stack Pointer (SP) - out of COMET II memory" },
37 };
38
39 int main(){
40     int i, j;
41     int code[] = {
42         101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
43         111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
44         121, 122, 123, 124, 201, 202, 203, 204, 205, 206, 207, 999
45     };
46     const char *str[] = {NULL, "foobar"};
47     addcerrlist(ARRAYSIZE(cerr_utest), cerr_utest);
48     /* エラーの初期化 */
49     cerr = malloc_chk(sizeof(CERR), "cerr");
50     for(i = 0; i < ARRAYSIZE(str); i++) {
51         for(j = 0; j < ARRAYSIZE(code); j++) {
52             setcerr(code[j], str[i]);
53             printf("%d: %s - %d\t%s\n", code[j], str[i], cerr->num, cerr->msg);
54         }
55     }
56     freecerr();
57     return 0;
58 }