--- gforth/test/ttester.fs 2007/08/28 19:15:03 1.4
+++ gforth/test/ttester.fs 2007/11/02 12:44:49 1.7
@@ -41,11 +41,10 @@
\ There are a few things to be noted:
-\ - Following the despicable practice of the original, this version
-\ sets the base to HEX for everything that gets loaded later.
-\ Floating-point input is ambiguous when the base is not decimal, so
-\ you have to set it to decimal yourself when you want to deal with
-\ decimal numbers.
+\ - Loading ttester.fs does not change BASE. Loading tester.fs
+\ changes BASE to HEX (like the original tester). Floating-point
+\ input is ambiguous when the base is not decimal, so you have to set
+\ it to decimal yourself when you want to deal with decimal numbers.
\ - For FP it is often useful to use approximate equality for checking
\ the results. You can turn on approximate matching with SET-NEAR
@@ -101,8 +100,7 @@ HAS-FLOATING [IF]
\ SET THE FOLLOWING TO THE RELATIVE AND ABSOLUTE TOLERANCES YOU
\ WANT FOR APPROXIMATE FLOAT EQUALITY, TO BE USED WITH F~ IN
\ FNEARLY=. KEEP THE SIGNS, BECAUSE F~ NEEDS THEM.
- FVARIABLE FSENSITIVITY DECIMAL 1E-12 HEX FSENSITIVITY F!
- : REL-NEAR FSENSITIVITY ;
+ FVARIABLE REL-NEAR DECIMAL 1E-12 HEX REL-NEAR F!
FVARIABLE ABS-NEAR DECIMAL 0E HEX ABS-NEAR F!
\ WHEN EXACT? IS TRUE, }F USES FEXACTLY=, OTHERWISE FNEARLY=.
@@ -194,15 +192,15 @@ HAS-FLOATING-STACK [IF]
: F...}T ( -- )
FDEPTH START-FDEPTH @ = 0= IF
- S" WRONG NUMBER OF FP RESULTS" ERROR
+ S" NUMBER OF FLOAT RESULTS BEFORE AND AFTER '->' DOES NOT MATCH: " ERROR
THEN
- FCURSOR @ ACTUAL-FDEPTH @ <> IF
- S" WRONG NUMBER OF FP RESULTS" ERROR
+ FCURSOR @ START-FDEPTH @ + ACTUAL-FDEPTH @ <> IF
+ S" NUMBER OF FLOAT RESULTS BEFORE '->' DOES NOT MATCH ...}T SPRECIFICATION: " ERROR
THEN ;
: FTESTER ( R -- )
- FDEPTH 0= ACTUAL-FDEPTH @ FCURSOR @ 1+ < OR IF
- S" WRONG NUMBER OF FP RESULTS: " ERROR EXIT
+ FDEPTH 0= ACTUAL-FDEPTH @ FCURSOR @ START-FDEPTH @ + 1+ < OR IF
+ S" NUMBER OF FLOAT RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT
THEN
ACTUAL-FRESULTS FCURSOR @ FLOATS + F@ FCONF= 0= IF
S" INCORRECT FP RESULT: " ERROR
@@ -224,8 +222,8 @@ HAS-FLOATING-STACK [IF]
COMPUTE-CELLS-PER-FP CONSTANT CELLS-PER-FP
: FTESTER ( R -- )
- DEPTH CELLS-PER-FP < ACTUAL-DEPTH @ XCURSOR @ CELLS-PER-FP + < OR IF
- S" WRONG NUMBER OF RESULTS: " ERROR EXIT
+ DEPTH CELLS-PER-FP < ACTUAL-DEPTH @ XCURSOR @ START-DEPTH @ + CELLS-PER-FP + < OR IF
+ S" NUMBER OF RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT
THEN
ACTUAL-RESULTS XCURSOR @ CELLS + F@ FCONF= 0= IF
S" INCORRECT FP RESULT: " ERROR
@@ -276,16 +274,16 @@ HAS-FLOATING-STACK [IF]
: ...}T ( -- )
DEPTH START-DEPTH @ = 0= IF
- S" WRONG NUMBER OF RESULTS" ERROR
+ S" NUMBER OF CELL RESULTS BEFORE AND AFTER '->' DOES NOT MATCH: " ERROR
THEN
- XCURSOR @ ACTUAL-DEPTH @ <> IF
- S" WRONG NUMBER OF RESULTS" ERROR
+ XCURSOR @ START-DEPTH @ + ACTUAL-DEPTH @ <> IF
+ S" NUMBER OF CELL RESULTS BEFORE '->' DOES NOT MATCH ...}T SPECIFICATION: " ERROR
THEN
F...}T ;
: XTESTER ( X -- )
- DEPTH 0= ACTUAL-DEPTH @ XCURSOR @ 1+ < OR IF
- S" WRONG NUMBER OF RESULTS: " ERROR EXIT
+ DEPTH 0= ACTUAL-DEPTH @ XCURSOR @ START-DEPTH @ + 1+ < OR IF
+ S" NUMBER OF CELL RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT
THEN
ACTUAL-RESULTS XCURSOR @ CELLS + @ <> IF
S" INCORRECT CELL RESULT: " ERROR
@@ -329,4 +327,4 @@ HAS-FLOATING-STACK [IF]
ELSE >IN ! DROP
THEN ;
-BASE !
\ No newline at end of file
+BASE !