X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=test%2Funit%2Fopdtok%2Fopdtok.c;fp=test%2Funit%2Fopdtok%2Fopdtok.c;h=dc5021e886b14399f3d881d464d5a433a6d6c2e6;hp=0000000000000000000000000000000000000000;hb=fb54b1c9d2fbc3d4a62c6b4d38ff68e9d3b25c26;hpb=b4e48008c95b35c692827326191698c22b06124f diff --git a/test/unit/opdtok/opdtok.c b/test/unit/opdtok/opdtok.c new file mode 100644 index 0000000..dc5021e --- /dev/null +++ b/test/unit/opdtok/opdtok.c @@ -0,0 +1,29 @@ +#include "casl2.h" +#include "assemble.h" + +int main(){ + int i, j; + OPD *opd; + char *str[] = { + "", "GR0,GR1", "GR0,A", "GR1,12", "GR0,0,GR1", + "\'aaa\',0", "\'aaa\',\'bbb\'", "\'aaa\'\',\'\'bbb\'", "\'aaa,bbb\'", + "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,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,2,3,4,5,6,7,8,9,0", + "\'01234567890123456789012345678901234567\'", + "\'012345678901234567890123456789012345678\'" + }; + for(i = 0; i < sizeof str / sizeof str[0]; i++) { + printf("%s\n", str[i]); + opd = opdtok(str[i]); + printf("OPDC:%d\n", opd->opdc); + for(j = 0; j < opd->opdc; j++) { + printf("OPDC[%d]:%s\n", j, opd->opdv[j]); + } + if(cerrno > 0){ + printf("Error - %d: %s\n", cerrno, cerrmsg); + freecerr(); + } + printf("\n"); + } + return 0; +}