Initial setup to run actual tests. Seems my INCLUDE is crashing yet, though.

This commit is contained in:
Philip Zembrod 2020-06-13 00:00:30 +02:00
parent 410e6f06a5
commit 6629fa6ff5
5 changed files with 1107 additions and 0 deletions

View File

@ -6,6 +6,9 @@
vf_blk_d64_files = $(wildcard disks/*.d64)
vf_blk_fth_files = $(patsubst %.d64, %.fth, $(vf_blk_d64_files))
test_files = $(wildcard tests/*.fth)
test_files_petscii = $(patsubst tests/%, cbmfiles/%, $(test_files))
# Target to convert all .d64 images into .fth files for easier reading.
vf_blk_fth: $(vf_blk_fth_files)
@ -19,6 +22,10 @@ run-devenv: emulator/devenv.T64
run-testbase: emulator/testbase.T64
emulator/run-in-vice.sh testbase
run-tests: emulator/testbase.T64 $(test_files_petscii)
emulator/run-in-vice.sh testbase \
"include run-vf-tests.fth\n"
# Rules for building Forth binaries on top of the plain vanilla
# c64-volksforth83.
@ -38,6 +45,12 @@ emulator/%.T64: cbmfiles/%
bin2t64 $< $@
# Generic rule for populating cbmfiles/ with PETSCII text files
cbmfiles/%.fth: tests/%.fth
ascii2petscii $< $@
# Generic rule for converting .d64 blk sources into .fth files.
disks/%.fth: disks/%.d64

View File

@ -0,0 +1,9 @@
: cells 2* ;
: s" [compile] " ; immediate
: [char] [compile] ascii ; immediate
: invert not ;

1009
6502/C64/tests/core.fr Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
: \vf [compile] \ ; immediate
include ans-shim.fth
include tester.fth
1 verbose !
include core.fth

66
6502/C64/tests/tester.fth Normal file
View File

@ -0,0 +1,66 @@
\ From: John Hayes S1I
\ Subject: tester.fr
\ Date: Mon, 27 Nov 95 13:10:09 PST
\ (C) 1995 JOHNS HOPKINS UNIVERSITY / APPLIED PHYSICS LABORATORY
\ MAY BE DISTRIBUTED FREELY AS LONG AS THIS COPYRIGHT NOTICE REMAINS.
\ VERSION 1.2
\ 24/11/2015 Replaced Core Ext word <> with = 0=
\ 31/3/2015 Variable #ERRORS added and incremented for each error reported.
\ 22/1/09 The words { and } have been changed to T{ and }T respectively to
\ agree with the Forth 200X file ttester.fs. This avoids clashes with
\ locals using { ... } and the FSL use of }
HEX
\ SET THE FOLLOWING FLAG TO TRUE FOR MORE VERBOSE OUTPUT; THIS MAY
\ ALLOW YOU TO TELL WHICH TEST CAUSED YOUR SYSTEM TO HANG.
VARIABLE VERBOSE
FALSE VERBOSE !
\ TRUE VERBOSE !
: EMPTY-STACK \ ( ... -- ) EMPTY STACK: HANDLES UNDERFLOWED STACK TOO.
DEPTH ?DUP IF DUP 0< IF NEGATE 0 DO 0 LOOP ELSE 0 DO DROP LOOP THEN THEN ;
VARIABLE #ERRORS 0 #ERRORS !
: ERROR \ ( C-ADDR U -- ) DISPLAY AN ERROR MESSAGE FOLLOWED BY
\ THE LINE THAT HAD THE ERROR.
CR TYPE SOURCE TYPE \ DISPLAY LINE CORRESPONDING TO ERROR
EMPTY-STACK \ THROW AWAY EVERY THING ELSE
#ERRORS @ 1 + #ERRORS !
\ QUIT \ *** Uncomment this line to QUIT on an error
;
VARIABLE ACTUAL-DEPTH \ STACK RECORD
CREATE ACTUAL-RESULTS 20 CELLS ALLOT
: T{ \ ( -- ) SYNTACTIC SUGAR.
;
: -> \ ( ... -- ) RECORD DEPTH AND CONTENT OF STACK.
DEPTH DUP ACTUAL-DEPTH ! \ RECORD DEPTH
?DUP IF \ IF THERE IS SOMETHING ON STACK
0 DO ACTUAL-RESULTS I CELLS + ! LOOP \ SAVE THEM
THEN ;
: }T \ ( ... -- ) COMPARE STACK (EXPECTED) CONTENTS WITH SAVED
\ (ACTUAL) CONTENTS.
DEPTH ACTUAL-DEPTH @ = IF \ IF DEPTHS MATCH
DEPTH ?DUP IF \ IF THERE IS SOMETHING ON THE STACK
0 DO \ FOR EACH STACK ITEM
ACTUAL-RESULTS I CELLS + @ \ COMPARE ACTUAL WITH EXPECTED
= 0= IF S" INCORRECT RESULT: " ERROR LEAVE THEN
LOOP
THEN
ELSE \ DEPTH MISMATCH
S" WRONG NUMBER OF RESULTS: " ERROR
THEN ;
: TESTING \ ( -- ) TALKING COMMENT.
SOURCE VERBOSE @
IF DUP >R TYPE CR R> >IN !
ELSE >IN ! DROP [CHAR] * EMIT
THEN ;