From 1f490c5ea15d073c9ec918b78a5e6117a0a8bd3e Mon Sep 17 00:00:00 2001 From: j8takagi Date: Thu, 28 Jan 2010 12:01:49 +0900 Subject: [PATCH] =?utf8?q?=E3=82=AA=E3=83=9A=E3=83=A9=E3=83=B3=E3=83=89?= =?utf8?q?=E3=81=AE=E6=9C=80=E5=A4=A7=E9=95=B7=E3=82=92OPDSIZE-1(=3D39)?= =?utf8?q?=E3=81=8B=E3=82=89OPDSIZE(=3D40)=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/token.c | 2 +- test/unit/opdtok/0.txt | 172 +++++++++++++++++++------------------- test/unit/opdtok/Makefile | 4 +- test/unit/opdtok/opdtok.c | 12 +-- 4 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/token.c b/src/token.c index c46c9f2..fcb1aeb 100644 --- a/src/token.c +++ b/src/token.c @@ -38,7 +38,7 @@ OPD *opdtok(const char *str) setcerr(121, NULL); /* cannot get operand token */ break; } - if(strlen(p) > OPDSIZE + 1) { + if(strlen(p) > OPDSIZE + 2) { setcerr(118, p); /* operand length is too long */ break; } diff --git a/test/unit/opdtok/0.txt b/test/unit/opdtok/0.txt index 1dcf923..7bb505e 100644 --- a/test/unit/opdtok/0.txt +++ b/test/unit/opdtok/0.txt @@ -40,98 +40,98 @@ OPDC[0]:'aaa'',''bbb' OPDC:1 OPDC[0]:'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 +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 OPDC:40 -OPDC[0]:0 -OPDC[1]:1 -OPDC[2]:2 -OPDC[3]:3 -OPDC[4]:4 -OPDC[5]:5 -OPDC[6]:6 -OPDC[7]:7 -OPDC[8]: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PDC[6]:6 -OPDC[7]:7 -OPDC[8]:8 -OPDC[9]:9 -OPDC[10]:0 -OPDC[11]:1 -OPDC[12]:2 -OPDC[13]:3 -OPDC[14]:4 -OPDC[15]:5 -OPDC[16]:6 -OPDC[17]:7 -OPDC[18]:8 -OPDC[19]:9 -OPDC[20]:0 -OPDC[21]:1 -OPDC[22]:2 -OPDC[23]:3 -OPDC[24]:4 -OPDC[25]:5 -OPDC[26]:6 -OPDC[27]:7 -OPDC[28]:8 -OPDC[29]:9 -OPDC[30]:0 -OPDC[31]:1 -OPDC[32]:2 -OPDC[33]:3 -OPDC[34]:4 -OPDC[35]:5 -OPDC[36]:6 -OPDC[37]:7 -OPDC[38]:8 -OPDC[39]:9 +OPDC[0]:1 +OPDC[1]:2 +OPDC[2]:3 +OPDC[3]:4 +OPDC[4]:5 +OPDC[5]:6 +OPDC[6]:7 +OPDC[7]:8 +OPDC[8]:9 +OPDC[9]:0 +OPDC[10]:1 +OPDC[11]:2 +OPDC[12]:3 +OPDC[13]:4 +OPDC[14]:5 +OPDC[15]:6 +OPDC[16]:7 +OPDC[17]:8 +OPDC[18]:9 +OPDC[19]:0 +OPDC[20]:1 +OPDC[21]:2 +OPDC[22]:3 +OPDC[23]:4 +OPDC[24]:5 +OPDC[25]:6 +OPDC[26]:7 +OPDC[27]:8 +OPDC[28]:9 +OPDC[29]:0 +OPDC[30]:1 +OPDC[31]:2 +OPDC[32]:3 +OPDC[33]:4 +OPDC[34]:5 +OPDC[35]:6 +OPDC[36]:7 +OPDC[37]:8 +OPDC[38]:9 +OPDC[39]:0 Error - 117: operand is too many -'01234567890123456789012345678901234567' +'1234567890123456789012345678901234567890' OPDC:1 -OPDC[0]:'01234567890123456789012345678901234567' +OPDC[0]:'1234567890123456789012345678901234567890' -'012345678901234567890123456789012345678' +'12345678901234567890123456789012345678901' OPDC:0 -Error - 118: '012345678901234567890123456789012345678': operand length is too long +Error - 118: '12345678901234567890123456789012345678901': operand length is too long diff --git a/test/unit/opdtok/Makefile b/test/unit/opdtok/Makefile index eb78a08..5225297 100644 --- a/test/unit/opdtok/Makefile +++ b/test/unit/opdtok/Makefile @@ -1,3 +1,3 @@ -UNITNAME = opdtok UCLASS = AS -include ../Test.mk +TESTSRCFILE = opdtok.c +include ../TEST.mk diff --git a/test/unit/opdtok/opdtok.c b/test/unit/opdtok/opdtok.c index dc5021e..d65a420 100644 --- a/test/unit/opdtok/opdtok.c +++ b/test/unit/opdtok/opdtok.c @@ -7,12 +7,12 @@ int main(){ 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\'" + "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,1", + "\'1234567890123456789012345678901234567890\'", + "\'12345678901234567890123456789012345678901\'", }; - for(i = 0; i < sizeof str / sizeof str[0]; i++) { + for(i = 0; i < ARRAYSIZE(str); i++) { printf("%s\n", str[i]); opd = opdtok(str[i]); printf("OPDC:%d\n", opd->opdc); @@ -23,7 +23,7 @@ int main(){ printf("Error - %d: %s\n", cerrno, cerrmsg); freecerr(); } - printf("\n"); + printf("\n"); } return 0; } -- 2.18.0