From a4a4d9291958ee920beaec963000248b9523389b Mon Sep 17 00:00:00 2001 From: j8takagi Date: Mon, 1 Feb 2010 00:40:22 +0900 Subject: [PATCH] =?utf8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=81=AE=E6=95=B4?= =?utf8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- test/.gitignore | 1 + test/Makefile.TESTGROUPS.mk | 2 +- test/integration/casl2/Makefile | 2 +- test/integration/casl2/TEST.mk | 1 - test/integration/comet2/CMD.mk | 3 +- test/integration/comet2/Makefile | 2 +- test/integration/comet2/TEST.mk | 3 +- test/integration/dumpword/ARGS.txt | 2 + test/integration/dumpword/Makefile | 2 +- test/integration/dumpword/a/0.txt | 2 + test/integration/dumpword/l/0.txt | 2 + test/integration/dumpword/noopt/0.txt | 2 + test/unit/.gitignore | 1 + test/unit/Makefile | 2 +- test/unit/TEST.mk | 11 +++-- test/unit/cerrtest/0.txt | 64 +++++++++++++++++++++++++++ test/unit/{gethex => h2word}/0.txt | 0 test/unit/{gethex => h2word}/Makefile | 0 test/unit/{gethex => h2word}/gethex.c | 2 +- test/unit/hash/0.txt | 2 +- test/unit/{getint => n2word}/0.txt | 8 ++-- test/unit/{getint => n2word}/Makefile | 0 test/unit/{getint => n2word}/getint.c | 2 +- 23 files changed, 94 insertions(+), 22 deletions(-) create mode 100644 test/unit/cerrtest/0.txt rename test/unit/{gethex => h2word}/0.txt (100%) rename test/unit/{gethex => h2word}/Makefile (100%) rename test/unit/{gethex => h2word}/gethex.c (94%) rename test/unit/{getint => n2word}/0.txt (74%) rename test/unit/{getint => n2word}/Makefile (100%) rename test/unit/{getint => n2word}/getint.c (94%) diff --git a/test/.gitignore b/test/.gitignore index f00c031..0659e1a 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -3,3 +3,4 @@ report.txt diff.txt err.txt TEST.log +Test.log \ No newline at end of file diff --git a/test/Makefile.TESTGROUPS.mk b/test/Makefile.TESTGROUPS.mk index b453755..22dd7ec 100644 --- a/test/Makefile.TESTGROUPS.mk +++ b/test/Makefile.TESTGROUPS.mk @@ -7,7 +7,7 @@ # make prepare : すべてのテストの、想定結果を出力 # make create : UNITNAMEで指定されたテストを新規に作成 TESTS = `ls | grep "^[^A-Z].*"` -LOGFILE = TEST.log +LOGFILE = Test.log .PHONY: all check report clean cleanall prepare create all: check report diff --git a/test/integration/casl2/Makefile b/test/integration/casl2/Makefile index 1600450..05bb87a 100644 --- a/test/integration/casl2/Makefile +++ b/test/integration/casl2/Makefile @@ -7,7 +7,7 @@ # make prepare : すべてのテストの、想定結果を出力 # make create : UNITNAMEで指定されたテストを新規に作成 TESTS = `ls | grep "^[^A-Z].*"` -LOGFILE = TEST.log +LOGFILE = Test.log .PHONY: all check report clean cleanall prepare create all: check report diff --git a/test/integration/casl2/TEST.mk b/test/integration/casl2/TEST.mk index bb83457..13e4f02 100644 --- a/test/integration/casl2/TEST.mk +++ b/test/integration/casl2/TEST.mk @@ -4,7 +4,6 @@ # make prepare : CMDで設定されたコマンドを実行した出力結果を0.txt(テストの想定結果)に出力 # make clean : 「make」で生成されたファイルをクリア # make cleanall: 「make」と「make clean」で生成されたファイルをクリア -LOGFILE = ../TEST.log ERRFILE = err.txt UNITNAME = `pwd | xargs basename` diff --git a/test/integration/comet2/CMD.mk b/test/integration/comet2/CMD.mk index 904b810..77f6439 100644 --- a/test/integration/comet2/CMD.mk +++ b/test/integration/comet2/CMD.mk @@ -1,6 +1,5 @@ YACASL2DIR=../../../.. -UNITNAME = `pwd | xargs basename` -OBJFILE = a.o CASL2 = $(YACASL2DIR)/casl2 +OBJFILE = a.o COMET2 = $(YACASL2DIR)/comet2 CMD = $(COMET2) $(COMET2FLAG) $(OBJFILE) diff --git a/test/integration/comet2/Makefile b/test/integration/comet2/Makefile index d60aaa1..e7e747d 100644 --- a/test/integration/comet2/Makefile +++ b/test/integration/comet2/Makefile @@ -7,7 +7,7 @@ # make prepare : すべてのテストの、想定結果を出力 # make create : UNITNAMEで指定されたテストを新規に作成 TESTS = `ls | grep "^[^A-Z].*"` -LOGFILE = TEST.log +LOGFILE = Test.log .PHONY: all check report clean cleanall prepare create all: check report diff --git a/test/integration/comet2/TEST.mk b/test/integration/comet2/TEST.mk index 3ec7fed..0a386cb 100644 --- a/test/integration/comet2/TEST.mk +++ b/test/integration/comet2/TEST.mk @@ -4,8 +4,9 @@ # make prepare : CMDで設定されたコマンドを実行した出力結果を0.txt(テストの想定結果)に出力 # make clean : 「make」で生成されたファイルをクリア # make cleanall: 「make」と「make report」で生成されたファイルをクリア -LOGFILE = ../TEST.log +# 要設定: CASL2, OBJFILE, COMET2, CMD ERRFILE = err.txt +UNITNAME = `pwd | xargs basename` .PHPNY: check prepare clean cleanall check: clean report.txt diff --git a/test/integration/dumpword/ARGS.txt b/test/integration/dumpword/ARGS.txt index f86899d..9886259 100644 --- a/test/integration/dumpword/ARGS.txt +++ b/test/integration/dumpword/ARGS.txt @@ -23,3 +23,5 @@ \'#FFFF\' \'#00001\' \'#G\' +G +g diff --git a/test/integration/dumpword/Makefile b/test/integration/dumpword/Makefile index c453c20..745a8a4 100644 --- a/test/integration/dumpword/Makefile +++ b/test/integration/dumpword/Makefile @@ -7,7 +7,7 @@ # make prepare : すべてのテストの、想定結果を出力 # make create : UNITNAMEで指定されたテストを新規に作成 TESTS = `ls | grep "^[^A-Z].*"` -LOGFILE = TEST.log +LOGFILE = Test.log .PHONY: all check report clean cleanall prepare create all: check report diff --git a/test/integration/dumpword/a/0.txt b/test/integration/dumpword/a/0.txt index 47be5ae..1f4da4d 100644 --- a/test/integration/dumpword/a/0.txt +++ b/test/integration/dumpword/a/0.txt @@ -23,3 +23,5 @@ #FFFF: -1 = #FFFF = 1111111111111111 Dumpword Error - 116: #00001: out of hex range Dumpword Error - 115: #G: not hex +Dumpword Error - 114: G: not integer +Dumpword Error - 114: g: not integer diff --git a/test/integration/dumpword/l/0.txt b/test/integration/dumpword/l/0.txt index a39a28e..629f201 100644 --- a/test/integration/dumpword/l/0.txt +++ b/test/integration/dumpword/l/0.txt @@ -23,3 +23,5 @@ #FFFF: 65535 = #FFFF = 1111111111111111 Dumpword Error - 116: #00001: out of hex range Dumpword Error - 115: #G: not hex +Dumpword Error - 114: G: not integer +Dumpword Error - 114: g: not integer diff --git a/test/integration/dumpword/noopt/0.txt b/test/integration/dumpword/noopt/0.txt index 47be5ae..1f4da4d 100644 --- a/test/integration/dumpword/noopt/0.txt +++ b/test/integration/dumpword/noopt/0.txt @@ -23,3 +23,5 @@ #FFFF: -1 = #FFFF = 1111111111111111 Dumpword Error - 116: #00001: out of hex range Dumpword Error - 115: #G: not hex +Dumpword Error - 114: G: not integer +Dumpword Error - 114: g: not integer diff --git a/test/unit/.gitignore b/test/unit/.gitignore index cba7efc..d7756c2 100644 --- a/test/unit/.gitignore +++ b/test/unit/.gitignore @@ -1 +1,2 @@ a.out +*.o diff --git a/test/unit/Makefile b/test/unit/Makefile index 7f6bd86..e1a3dff 100644 --- a/test/unit/Makefile +++ b/test/unit/Makefile @@ -7,7 +7,7 @@ # make prepare : すべてのテストの、想定結果を出力 # make create : UNITNAMEで指定されたテストを新規に作成 TESTS = `ls | grep "^[^A-Z].*"` -LOGFILE = TEST.log +LOGFILE = Test.log .PHONY: all check report clean cleanall prepare create all: check report diff --git a/test/unit/TEST.mk b/test/unit/TEST.mk index b08dd02..96c908d 100644 --- a/test/unit/TEST.mk +++ b/test/unit/TEST.mk @@ -4,17 +4,16 @@ # make prepare : CMDで設定されたコマンドを実行した出力結果を0.txt(テストの想定結果)に出力 # make clean : 「make」で生成されたファイルをクリア # make cleanall: 「make」と「make clean」で生成されたファイルをクリア -LOGFILE = ../TEST.log ERRFILE = err.txt UNITNAME = `pwd | xargs basename` +SRCDIR = ../../../src INCLUDE = ../../../include CC = gcc CFLAGS = -g -Wall -I $(INCLUDE) -SRCDIR = ../../../src -COMMONSRC = $(SRCDIR)/struct.o $(SRCDIR)/hash.o $(SRCDIR)/cmd.o $(SRCDIR)/cerr.o $(SRCDIR)/dump.o +COMMONSRC = $(SRCDIR)/word.o $(SRCDIR)/struct.o $(SRCDIR)/hash.o $(SRCDIR)/cmd.o $(SRCDIR)/cerr.o ASSRC = $(SRCDIR)/assemble.o $(SRCDIR)/token.o $(SRCDIR)/label.o $(SRCDIR)/macro.o -EXECSRC = $(SRCDIR)/exec.o +EXECSRC = $(SRCDIR)/exec.o $(SRCDIR)/dump.o ifeq "$(UCLASS)" "AS" SRC = $(COMMONSRC) $(ASSRC) @@ -33,10 +32,10 @@ clean: @rm -f a.out 1.txt diff.txt report.txt cleanall: clean @rm -f 0.txt -a.out: $(SRC) $(TESTSRCFILE) - @gcc $(CFLAGS) $(SRC) $(TESTSRCFILE) $(SRCDIR)/%.o: $(SRCDIR)/%.c @$(CC) -c $(CFLAGS) $< +a.out: $(SRC) $(TESTSRCFILE) + @gcc $(CFLAGS) $(SRC) $(TESTSRCFILE) 0.txt 1.txt: a.out @./a.out >$@ 2>&1 diff.txt: 1.txt diff --git a/test/unit/cerrtest/0.txt b/test/unit/cerrtest/0.txt new file mode 100644 index 0000000..0183602 --- /dev/null +++ b/test/unit/cerrtest/0.txt @@ -0,0 +1,64 @@ +101: (null) - 101 label already defined +102: (null) - 102 label table is full +103: (null) - 103 label not found +104: (null) - 104 label length is too long +105: (null) - 105 no command in the line +106: (null) - 106 operand count mismatch +107: (null) - 107 no label in START +108: (null) - 108 not command of operand "r" +109: (null) - 109 not command of operand "r1,r2" +110: (null) - 110 not command of operand "r,adr[,x]" +111: (null) - 111 not command of operand "adr[,x]" +112: (null) - 112 not command of no operand +113: (null) - 113 command not defined +114: (null) - 114 not integer +115: (null) - 115 not hex +116: (null) - 116 out of hex range +117: (null) - 117 operand is too many +118: (null) - 118 operand length is too long +119: (null) - 119 out of COMET II memory +120: (null) - 120 GR0 in operand x +121: (null) - 121 cannot get operand token +122: (null) - 122 cannot create hash table +123: (null) - 123 unkown error +124: (null) - 124 unkown error +201: (null) - 201 execute - out of COMET II memory +202: (null) - 202 SVC input - out of Input memory +203: (null) - 203 SVC output - out of COMET II memory +204: (null) - 204 Program Register (PR) - out of COMET II memory +205: (null) - 205 Stack Pointer (SP) - cannot allocate stack buffer +206: (null) - 206 Address - out of COMET II memory +207: (null) - 207 Stack Pointer (SP) - out of COMET II memory +999: (null) - 999 unkown error +101: foobar - 101 foobar: label already defined +102: foobar - 102 foobar: label table is full +103: foobar - 103 foobar: label not found +104: foobar - 104 foobar: label length is too long +105: foobar - 105 foobar: no command in the line +106: foobar - 106 foobar: operand count mismatch +107: foobar - 107 foobar: no label in START +108: foobar - 108 foobar: not command of operand "r" +109: foobar - 109 foobar: not command of operand "r1,r2" +110: foobar - 110 foobar: not command of operand "r,adr[,x]" +111: foobar - 111 foobar: not command of operand "adr[,x]" +112: foobar - 112 foobar: not command of no operand +113: foobar - 113 foobar: command not defined +114: foobar - 114 foobar: not integer +115: foobar - 115 foobar: not hex +116: foobar - 116 foobar: out of hex range +117: foobar - 117 foobar: operand is too many +118: foobar - 118 foobar: operand length is too long +119: foobar - 119 foobar: out of COMET II memory +120: foobar - 120 foobar: GR0 in operand x +121: foobar - 121 foobar: cannot get operand token +122: foobar - 122 foobar: cannot create hash table +123: foobar - 123 foobar: unkown error +124: foobar - 124 foobar: unkown error +201: foobar - 201 foobar: execute - out of COMET II memory +202: foobar - 202 foobar: SVC input - out of Input memory +203: foobar - 203 foobar: SVC output - out of COMET II memory +204: foobar - 204 foobar: Program Register (PR) - out of COMET II memory +205: foobar - 205 foobar: Stack Pointer (SP) - cannot allocate stack buffer +206: foobar - 206 foobar: Address - out of COMET II memory +207: foobar - 207 foobar: Stack Pointer (SP) - out of COMET II memory +999: foobar - 999 foobar: unkown error diff --git a/test/unit/gethex/0.txt b/test/unit/h2word/0.txt similarity index 100% rename from test/unit/gethex/0.txt rename to test/unit/h2word/0.txt diff --git a/test/unit/gethex/Makefile b/test/unit/h2word/Makefile similarity index 100% rename from test/unit/gethex/Makefile rename to test/unit/h2word/Makefile diff --git a/test/unit/gethex/gethex.c b/test/unit/h2word/gethex.c similarity index 94% rename from test/unit/gethex/gethex.c rename to test/unit/h2word/gethex.c index b69610f..a4c34f8 100644 --- a/test/unit/gethex/gethex.c +++ b/test/unit/h2word/gethex.c @@ -10,7 +10,7 @@ int main(){ "#32768", "#-1", "#G", "#FFFF", "#0", "#1", "#ab", "#AB", "#20" }; for(i = 0; i < sizeof(str)/sizeof(str[0]); i++) { - r = gethex(str[i]); + r = h2word(str[i]); printf("%s\t#%04X", str[i], r); if(cerrno > 0) { printf("\tError - %d\t%s", cerrno, cerrmsg); diff --git a/test/unit/hash/0.txt b/test/unit/hash/0.txt index 766dc2d..b35644c 100644 --- a/test/unit/hash/0.txt +++ b/test/unit/hash/0.txt @@ -1,3 +1,3 @@ HASH VALUE: 20 HASH VALUE: 11 -HASH VALUE: 23 +HASH VALUE: 3 diff --git a/test/unit/getint/0.txt b/test/unit/n2word/0.txt similarity index 74% rename from test/unit/getint/0.txt rename to test/unit/n2word/0.txt index c3db13f..e56aa1f 100644 --- a/test/unit/getint/0.txt +++ b/test/unit/n2word/0.txt @@ -4,10 +4,10 @@ -5G 0x0000 Error - 114 -5G: not integer 123 0x007b 32767 0x7fff -32768 0x0000 -32769 0x0001 +32768 0x8000 +32769 0x8001 -1 0xffff -2345 0xf6d7 -32768 0x8000 --32769 0xffff --32770 0xfffe +-32769 0x7fff +-32770 0x7ffe diff --git a/test/unit/getint/Makefile b/test/unit/n2word/Makefile similarity index 100% rename from test/unit/getint/Makefile rename to test/unit/n2word/Makefile diff --git a/test/unit/getint/getint.c b/test/unit/n2word/getint.c similarity index 94% rename from test/unit/getint/getint.c rename to test/unit/n2word/getint.c index 8e1b994..945db38 100644 --- a/test/unit/getint/getint.c +++ b/test/unit/n2word/getint.c @@ -10,7 +10,7 @@ int main(){ "-1", "-2345", "-32768", "-32769", "-32770" }; for(i = 0; i < sizeof(str)/sizeof(str[0]); i++) { - r = getint(str[i]); + r = n2word(str[i]); printf("%s\t0x%04x", str[i], r); if(cerrno > 0) { printf("\tError - %d\t%s", cerrno, cerrmsg); -- 2.18.0