X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=test%2Funit%2Fcerrtest%2Fcerrtest.c;h=8e3ea7200b84239be3c9bcdb3521d1e1ad63cf71;hp=39f2a09d1c51d16fbc8155970217e054084d42b1;hb=4ee27a568fb9222907a566e59aaefe248f08a8e4;hpb=3ea92ba68cb320156d5bc7fe92f5e5fa0c150635 diff --git a/test/unit/cerrtest/cerrtest.c b/test/unit/cerrtest/cerrtest.c index 39f2a09..8e3ea72 100644 --- a/test/unit/cerrtest/cerrtest.c +++ b/test/unit/cerrtest/cerrtest.c @@ -1,8 +1,7 @@ #include #include "casl2.h" -/* エラー番号とエラーメッセージ */ -static CERRARRAY cerr_utest[] = { +static CERR cerr_utest[] = { { 101, "label already defined" }, { 102, "label table is full" }, { 103, "label not found" }, @@ -46,14 +45,14 @@ int main(){ }; const char *str[] = {NULL, "foobar"}; addcerrlist(ARRAYSIZE(cerr_utest), cerr_utest); + /* エラーの初期化 */ + cerr = malloc_chk(sizeof(CERR), "cerr"); for(i = 0; i < ARRAYSIZE(str); i++) { for(j = 0; j < ARRAYSIZE(code); j++) { setcerr(code[j], str[i]); - printf("%d: %s - %d\t%s\n", code[j], str[i], cerrno, cerrmsg); - if(cerrno != 0) { - freecerr(); - } + printf("%d: %s - %d\t%s\n", code[j], str[i], cerr->num, cerr->msg); } } + freecerr(); return 0; }