From 36321c9c9100ea89f70ba4382c60572efdc35cc5 Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Sun, 26 Jul 2020 15:34:00 +0200 Subject: [PATCH] Componentize golden files for c64 and c16 forth tests --- 6502/C64/Makefile | 18 +- 6502/C64/tests/evaluate-test.sh | 3 +- 6502/C64/tests/golden/block.golden | 134 +++++++++ 6502/C64/tests/golden/core.golden | 32 ++ 6502/C64/tests/golden/coreext.golden | 52 ++++ 6502/C64/tests/golden/double.golden | 3 + .../{test-c16.golden => golden/prelim.golden} | 38 +-- 6502/C64/tests/golden/report-blk.golden | 21 ++ 6502/C64/tests/golden/report-noblk.golden | 21 ++ 6502/C64/tests/test-c64.golden | 284 ------------------ 10 files changed, 283 insertions(+), 323 deletions(-) create mode 100644 6502/C64/tests/golden/block.golden create mode 100644 6502/C64/tests/golden/core.golden create mode 100644 6502/C64/tests/golden/coreext.golden create mode 100644 6502/C64/tests/golden/double.golden rename 6502/C64/tests/{test-c16.golden => golden/prelim.golden} (60%) create mode 100644 6502/C64/tests/golden/report-blk.golden create mode 100644 6502/C64/tests/golden/report-noblk.golden delete mode 100644 6502/C64/tests/test-c64.golden diff --git a/6502/C64/Makefile b/6502/C64/Makefile index 9e8532d..c05f595 100644 --- a/6502/C64/Makefile +++ b/6502/C64/Makefile @@ -20,7 +20,8 @@ vf_blk_fth: $(vf_blk_fth_files) clean: - rm -f cbmfiles/*.fr cbmfiles/*.fth cbmfiles/*.log *.log *.result + rm -f cbmfiles/*.fr cbmfiles/*.fth cbmfiles/*.log + rm -f *.log *.result *.golden rm -f cbmfiles/c??-testbase rm -f disks/scratch.d64 @@ -69,7 +70,7 @@ cbmfiles/c16-vf-32k: emulator/tcbase.T64 emulator/build-vf.sh \ # Core test targets test-c64.result: emulator/c64-vf-latest.T64 $(test_files_petscii) \ - emulator/run-in-vice.sh tests/evaluate-test.sh tests/test-c64.golden + emulator/run-in-vice.sh tests/evaluate-test.sh test-c64.golden rm -f test-c64.log test-c64.result cp disks/empty.d64 disks/scratch.d64 DISK9=scratch emulator/run-in-vice.sh c64-vf-latest \ @@ -78,13 +79,24 @@ test-c64.result: emulator/c64-vf-latest.T64 $(test_files_petscii) \ tests/evaluate-test.sh test-c64 test-c16.result: emulator/c16-vf-latest.T64 $(test_files_petscii) \ - emulator/run-in-vice.sh tests/evaluate-test.sh tests/test-c16.golden + emulator/run-in-vice.sh tests/evaluate-test.sh test-c16.golden rm -f test-c16.log test-c16.result VICE=xplus4 emulator/run-in-vice.sh c16-vf-latest \ "include run-vf-tests.fth\n1234567890\n" petscii2ascii cbmfiles/test.log test-c16.log tests/evaluate-test.sh test-c16 +c64_golden_parts = prelim core coreext double block report-blk +c64_golden_files = $(patsubst %, tests/golden/%.golden, \ + $(c64_golden_parts)) +test-c64.golden: $(c64_golden_files) + cat $? > $@ + +c16_golden_parts = prelim core +c16_golden_files = $(patsubst %, tests/golden/%.golden, \ + $(c16_golden_parts)) +test-c16.golden: $(c16_golden_files) + cat $? > $@ # Rules for building Forth binaries on top of the plain vanilla # c64-volksforth83. diff --git a/6502/C64/tests/evaluate-test.sh b/6502/C64/tests/evaluate-test.sh index f76fd8e..144f661 100755 --- a/6502/C64/tests/evaluate-test.sh +++ b/6502/C64/tests/evaluate-test.sh @@ -5,7 +5,8 @@ basedir="$(realpath --relative-to="$PWD" "${testsdir}/..")" testname="$1" -diff "${testsdir}/${testname}.golden" "${basedir}/${testname}.log" > tmp.result +diff --ignore-trailing-space "${basedir}/${testname}.golden" \ + "${basedir}/${testname}.log" > tmp.result exitcode=$? test $exitcode -eq 0 \ && echo "PASS: ${testname}" >> tmp.result \ diff --git a/6502/C64/tests/golden/block.golden b/6502/C64/tests/golden/block.golden new file mode 100644 index 0000000..998ca33 --- /dev/null +++ b/6502/C64/tests/golden/block.golden @@ -0,0 +1,134 @@ + +blocktest.fth**=== NOT TESTED === *******Scr 21 Dr 1 + 0 Should show a (mostly) blank screen + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +Scr 20 Dr 1 + 0 List of the First test block + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +Scr 29 Dr 1 + 0 List of the Last test block + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +Scr 25 Dr 1 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 End of Screen +Scr 21 Dr 1 + 0 Should show another (mostly) blank scree + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +*** | exists Given Characters per Line: 41 +* +End of Block word tests diff --git a/6502/C64/tests/golden/core.golden b/6502/C64/tests/golden/core.golden new file mode 100644 index 0000000..ecb08b7 --- /dev/null +++ b/6502/C64/tests/golden/core.golden @@ -0,0 +1,32 @@ + +tester.fth ERROR exists +core.fr +*********************YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS: + !"#$%&'()*+,-./0123456789:;<=>?@ +abcdefghijklmnopqrstuvwxyz[\]^_` +ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~ +YOU SHOULD SEE 0-9 SEPARATED BY A SPACE: +0 1 2 3 4 5 6 7 8 9 +YOU SHOULD SEE 0-9 (WITH NO SPACES): +0123456789 +YOU SHOULD SEE A-G SEPARATED BY A SPACE: +A B C D E F G +YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES: +0 1 2 3 4 5 +YOU SHOULD SEE TWO SEPARATE LINES: +LINE 1 +LINE 2 +YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS: + SIGNED: -8000 7FFF +UNSIGNED: 0 FFFF +* +PLEASE TYPE UP TO 80 CHARACTERS: +1234567890 +RECEIVED: "1234567890" +* GDX exists +End of Core word set tests + +coreplustest.fth******** +You should see 2345: 2345 +***** +End of additional Core tests diff --git a/6502/C64/tests/golden/coreext.golden b/6502/C64/tests/golden/coreext.golden new file mode 100644 index 0000000..ddf90a8 --- /dev/null +++ b/6502/C64/tests/golden/coreext.golden @@ -0,0 +1,52 @@ + +utilities.fth ?DEFTEST1 exists +Test utilities loaded + +errorreport.fth +coreexttest.fth************** + +Output from .( +You should see -9876: -9876 +and again: -9876 + + +On the next 2 lines you should see First then Second messages: +First message via .( +Second message via ." + +* + +Output from .R and U.R +You should see lines duplicated: +indented by 0 spaces +30278 +30278 +-31871 +-31871 +30278 +30278 +33665 +33665 + +indented by 0 spaces +30278 +30278 +-31871 +-31871 +30278 +30278 +33665 +33665 + +indented by 5 spaces + 30278 + 30278 + -31871 + -31871 + 30278 + 30278 + 33665 + 33665 + +*** +End of Core Extension word tests diff --git a/6502/C64/tests/golden/double.golden b/6502/C64/tests/golden/double.golden new file mode 100644 index 0000000..ad02caf --- /dev/null +++ b/6502/C64/tests/golden/double.golden @@ -0,0 +1,3 @@ + +doubletest.fth***************** +End of Double-Number word tests diff --git a/6502/C64/tests/test-c16.golden b/6502/C64/tests/golden/prelim.golden similarity index 60% rename from 6502/C64/tests/test-c16.golden rename to 6502/C64/tests/golden/prelim.golden index 09682a7..4ab9c01 100644 --- a/6502/C64/tests/test-c16.golden +++ b/6502/C64/tests/golden/prelim.golden @@ -1,5 +1,5 @@ -ans-shim.fth CHAR exists 0> exists +ans-shim.fth CHAR exists 0> exists prelimtest.fth @@ -31,7 +31,7 @@ Pass #21: testing ?~ Pass #22: testing EMIT Pass #23: testing S" -Results: +Results: Pass messages #1 to #23 should be displayed above and no error messages @@ -39,36 +39,4 @@ and no error messages 0 tests failed out of 57 additional tests ---- End of Preliminary Tests --- - -tester.fth ERROR exists -core.fr -*********************YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS: - !"#$%&'()*+,-./0123456789:;<=>?@ -abcdefghijklmnopqrstuvwxyz[\]^_` -ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~ -YOU SHOULD SEE 0-9 SEPARATED BY A SPACE: -0 1 2 3 4 5 6 7 8 9 -YOU SHOULD SEE 0-9 (WITH NO SPACES): -0123456789 -YOU SHOULD SEE A-G SEPARATED BY A SPACE: -A B C D E F G -YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES: -0 1 2 3 4 5 -YOU SHOULD SEE TWO SEPARATE LINES: -LINE 1 -LINE 2 -YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS: - SIGNED: -8000 7FFF -UNSIGNED: 0 FFFF -* -PLEASE TYPE UP TO 80 CHARACTERS: -1234567890 -RECEIVED: "1234567890" -* GDX exists -End of Core word set tests - -coreplustest.fth******** -You should see 2345: 2345 -***** -End of additional Core tests +--- End of Preliminary Tests --- diff --git a/6502/C64/tests/golden/report-blk.golden b/6502/C64/tests/golden/report-blk.golden new file mode 100644 index 0000000..80361e9 --- /dev/null +++ b/6502/C64/tests/golden/report-blk.golden @@ -0,0 +1,21 @@ + +--------------------------- + Error Report +Word Set Errors +--------------------------- +Core 0 +Core extension 0 +Block 0 +Double number 0 +Exception - +Facility - +File-access - +Locals - +Memory-allocation - +Programming-tools - +Search-order - +String - +--------------------------- +Total 0 +--------------------------- + diff --git a/6502/C64/tests/golden/report-noblk.golden b/6502/C64/tests/golden/report-noblk.golden new file mode 100644 index 0000000..acdc397 --- /dev/null +++ b/6502/C64/tests/golden/report-noblk.golden @@ -0,0 +1,21 @@ + +--------------------------- + Error Report +Word Set Errors +--------------------------- +Core 0 +Core extension 0 +Block - +Double number 0 +Exception - +Facility - +File-access - +Locals - +Memory-allocation - +Programming-tools - +Search-order - +String - +--------------------------- +Total 0 +--------------------------- + diff --git a/6502/C64/tests/test-c64.golden b/6502/C64/tests/test-c64.golden deleted file mode 100644 index f08cfe5..0000000 --- a/6502/C64/tests/test-c64.golden +++ /dev/null @@ -1,284 +0,0 @@ - -ans-shim.fth CHAR exists 0> exists - -prelimtest.fth - -CR CR SOURCE TYPE ( Preliminary test ) CR -SOURCE ( These lines test SOURCE, TYPE, CR and parenthetic comments ) TYPE CR -( The next line of output should be blank to test CR ) SOURCE TYPE CR CR - -( Pass #1: testing 0 >IN +! ) 0 >IN +! SOURCE TYPE CR -( Pass #2: testing 1 >IN +! ) 1 >IN +! xSOURCE TYPE CR -( Pass #3: testing 1+ ) 1 1+ >IN +! xxSOURCE TYPE CR -( Pass #4: testing @ ! BASE ) 0 1+ 1+ BASE ! BASE @ >IN +! xxSOURCE TYPE CR -( Pass #5: testing decimal BASE ) BASE @ >IN +! xxxxxxxxxxSOURCE TYPE CR -( Pass #6: testing : ; ) : .SRC SOURCE TYPE CR ; 6 >IN +! xxxxxx.SRC -( Pass #7: testing number input ) 19 >IN +! xxxxxxxxxxxxxxxxxxx.SRC -( Pass #8: testing VARIABLE ) VARIABLE Y 2 Y ! Y @ >IN +! xx.SRC -( Pass #9: testing WORD COUNT ) 5 MSG abcdef) Y ! Y ! >IN +! xxxxx.SRC -( Pass #10: testing WORD COUNT ) MSG ab) >IN +! xxY ! .SRC -Pass #11: testing WORD COUNT .MSG -Pass #12: testing = returns all 1's for true -Pass #13: testing = returns 0 for false -Pass #14: testing -1 interpreted correctly -Pass #15: testing 2* -Pass #16: testing 2* -Pass #17: testing AND -Pass #18: testing AND -Pass #19: testing AND -Pass #20: testing ?F~ ?~~ Pass Error -Pass #21: testing ?~ -Pass #22: testing EMIT -Pass #23: testing S" - -Results: - -Pass messages #1 to #23 should be displayed above -and no error messages - -0 tests failed out of 57 additional tests - - ---- End of Preliminary Tests --- - -tester.fth ERROR exists -core.fr -*********************YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS: - !"#$%&'()*+,-./0123456789:;<=>?@ -abcdefghijklmnopqrstuvwxyz[\]^_` -ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~ -YOU SHOULD SEE 0-9 SEPARATED BY A SPACE: -0 1 2 3 4 5 6 7 8 9 -YOU SHOULD SEE 0-9 (WITH NO SPACES): -0123456789 -YOU SHOULD SEE A-G SEPARATED BY A SPACE: -A B C D E F G -YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES: -0 1 2 3 4 5 -YOU SHOULD SEE TWO SEPARATE LINES: -LINE 1 -LINE 2 -YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS: - SIGNED: -8000 7FFF -UNSIGNED: 0 FFFF -* -PLEASE TYPE UP TO 80 CHARACTERS: -1234567890 -RECEIVED: "1234567890" -* GDX exists -End of Core word set tests - -coreplustest.fth******** -You should see 2345: 2345 -***** -End of additional Core tests - -utilities.fth ?DEFTEST1 exists -Test utilities loaded - -errorreport.fth -coreexttest.fth************** - -Output from .( -You should see -9876: -9876 -and again: -9876 - - -On the next 2 lines you should see First then Second messages: -First message via .( -Second message via ." - -* - -Output from .R and U.R -You should see lines duplicated: -indented by 0 spaces -30278 -30278 --31871 --31871 -30278 -30278 -33665 -33665 - -indented by 0 spaces -30278 -30278 --31871 --31871 -30278 -30278 -33665 -33665 - -indented by 5 spaces - 30278 - 30278 - -31871 - -31871 - 30278 - 30278 - 33665 - 33665 - -*** -End of Core Extension word tests - -doubletest.fth***************** -End of Double-Number word tests - -blocktest.fth**=== NOT TESTED === *******Scr 21 Dr 1 - 0 Should show a (mostly) blank screen - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -Scr 20 Dr 1 - 0 List of the First test block - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -Scr 29 Dr 1 - 0 List of the Last test block - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -Scr 25 Dr 1 - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 End of Screen -Scr 21 Dr 1 - 0 Should show another (mostly) blank scree - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -*** | exists Given Characters per Line: 41 -* -End of Block word tests - ---------------------------- - Error Report -Word Set Errors ---------------------------- -Core 0 -Core extension 0 -Block 0 -Double number 0 -Exception - -Facility - -File-access - -Locals - -Memory-allocation - -Programming-tools - -Search-order - -String - ---------------------------- -Total 0 ---------------------------- -