Diff for /gforth/test/ttester.fs between versions 1.7 and 1.11

version 1.7, 2007/11/02 12:44:49 version 1.11, 2008/03/06 19:24:30
Line 174  HAS-FLOATING-STACK [IF] Line 174  HAS-FLOATING-STACK [IF]
: F-> ( ... -- ... )      : F-> ( ... -- ... )
FDEPTH DUP ACTUAL-FDEPTH !          FDEPTH DUP ACTUAL-FDEPTH !
START-FDEPTH @ > IF          START-FDEPTH @ > IF
FDEPTH START-FDEPTH @ DO ACTUAL-FRESULTS I FLOATS + F! LOOP              FDEPTH START-FDEPTH @ - 0 DO ACTUAL-FRESULTS I FLOATS + F! LOOP
THEN ;          THEN ;

: F} ( ... -- ... )      : F} ( ... -- ... )
FDEPTH ACTUAL-FDEPTH @ = IF          FDEPTH ACTUAL-FDEPTH @ = IF
FDEPTH START-FDEPTH @ > IF              FDEPTH START-FDEPTH @ > IF
FDEPTH START-FDEPTH @ DO                  FDEPTH START-FDEPTH @ - 0 DO
ACTUAL-FRESULTS I FLOATS + F@ FCONF= INVERT IF                      ACTUAL-FRESULTS I FLOATS + F@ FCONF= INVERT IF
S" INCORRECT FP RESULT: " ERROR LEAVE                          S" INCORRECT FP RESULT: " ERROR LEAVE
THEN                      THEN
Line 191  HAS-FLOATING-STACK [IF] Line 191  HAS-FLOATING-STACK [IF]
THEN ;          THEN ;

: F...}T ( -- )      : F...}T ( -- )
FDEPTH START-FDEPTH @ = 0= IF
S" NUMBER OF FLOAT RESULTS BEFORE AND AFTER '->' DOES NOT MATCH: " ERROR
THEN
FCURSOR @ START-FDEPTH @ + ACTUAL-FDEPTH @ <> IF          FCURSOR @ START-FDEPTH @ + ACTUAL-FDEPTH @ <> IF
S" NUMBER OF FLOAT RESULTS BEFORE '->' DOES NOT MATCH ...}T SPRECIFICATION: " ERROR              S" NUMBER OF FLOAT RESULTS BEFORE '->' DOES NOT MATCH ...}T SPECIFICATION: " ERROR
THEN ;          ELSE FDEPTH START-FDEPTH @ = 0= IF
S" NUMBER OF FLOAT RESULTS BEFORE AND AFTER '->' DOES NOT MATCH: " ERROR
THEN THEN ;

: FTESTER ( R -- )      : FTESTER ( R -- )
FDEPTH 0= ACTUAL-FDEPTH @ FCURSOR @ START-FDEPTH @ + 1+ < OR IF          FDEPTH 0= ACTUAL-FDEPTH @ FCURSOR @ START-FDEPTH @ + 1+ < OR IF
S" NUMBER OF FLOAT RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT              S" NUMBER OF FLOAT RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR
THEN          ELSE ACTUAL-FRESULTS FCURSOR @ FLOATS + F@ FCONF= 0= IF
ACTUAL-FRESULTS FCURSOR @ FLOATS + F@ FCONF= 0= IF
S" INCORRECT FP RESULT: " ERROR              S" INCORRECT FP RESULT: " ERROR
THEN          THEN THEN
1 FCURSOR +! ;          1 FCURSOR +! ;

[ELSE]  [ELSE]
Line 224  HAS-FLOATING-STACK [IF] Line 223  HAS-FLOATING-STACK [IF]
: FTESTER ( R -- )      : FTESTER ( R -- )
DEPTH CELLS-PER-FP < ACTUAL-DEPTH @ XCURSOR @ START-DEPTH @ + CELLS-PER-FP + < OR IF          DEPTH CELLS-PER-FP < ACTUAL-DEPTH @ XCURSOR @ START-DEPTH @ + CELLS-PER-FP + < OR IF
S" NUMBER OF RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT              S" NUMBER OF RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT
THEN          ELSE ACTUAL-RESULTS XCURSOR @ CELLS + F@ FCONF= 0= IF
ACTUAL-RESULTS XCURSOR @ CELLS + F@ FCONF= 0= IF
S" INCORRECT FP RESULT: " ERROR              S" INCORRECT FP RESULT: " ERROR
THEN          THEN THEN
CELLS-PER-FP XCURSOR +! ;          CELLS-PER-FP XCURSOR +! ;
[THEN]       [THEN]

Line 254  HAS-FLOATING-STACK [IF] Line 252  HAS-FLOATING-STACK [IF]
: ->            \ ( ... -- ) RECORD DEPTH AND CONTENT OF STACK.  : ->            \ ( ... -- ) RECORD DEPTH AND CONTENT OF STACK.
DEPTH DUP ACTUAL-DEPTH !             \ RECORD DEPTH     DEPTH DUP ACTUAL-DEPTH !             \ RECORD DEPTH
START-DEPTH @ > IF           \ IF THERE IS SOMETHING ON STACK     START-DEPTH @ > IF           \ IF THERE IS SOMETHING ON STACK
DEPTH START-DEPTH @ DO ACTUAL-RESULTS I CELLS + ! LOOP \ SAVE THEM         DEPTH START-DEPTH @ - 0 DO ACTUAL-RESULTS I CELLS + ! LOOP \ SAVE THEM
THEN     THEN
F-> ;     F-> ;

Line 262  HAS-FLOATING-STACK [IF] Line 260  HAS-FLOATING-STACK [IF]
\ (ACTUAL) CONTENTS.                  \ (ACTUAL) CONTENTS.
DEPTH ACTUAL-DEPTH @ = IF            \ IF DEPTHS MATCH     DEPTH ACTUAL-DEPTH @ = IF            \ IF DEPTHS MATCH
DEPTH START-DEPTH @ > IF          \ IF THERE IS SOMETHING ON THE STACK        DEPTH START-DEPTH @ > IF          \ IF THERE IS SOMETHING ON THE STACK
DEPTH START-DEPTH @ DO         \ FOR EACH STACK ITEM           DEPTH START-DEPTH @ - 0 DO     \ FOR EACH STACK ITEM
ACTUAL-RESULTS I CELLS + @  \ COMPARE ACTUAL WITH EXPECTED              ACTUAL-RESULTS I CELLS + @  \ COMPARE ACTUAL WITH EXPECTED
<> IF S" INCORRECT RESULT: " ERROR LEAVE THEN              <> IF S" INCORRECT RESULT: " ERROR LEAVE THEN
LOOP           LOOP
Line 273  HAS-FLOATING-STACK [IF] Line 271  HAS-FLOATING-STACK [IF]
F} ;     F} ;

: ...}T ( -- )  : ...}T ( -- )
DEPTH START-DEPTH @ = 0= IF
S" NUMBER OF CELL RESULTS BEFORE AND AFTER '->' DOES NOT MATCH: " ERROR
THEN
XCURSOR @ START-DEPTH @ + ACTUAL-DEPTH @ <> IF      XCURSOR @ START-DEPTH @ + ACTUAL-DEPTH @ <> IF
S" NUMBER OF CELL RESULTS BEFORE '->' DOES NOT MATCH ...}T SPECIFICATION: " ERROR          S" NUMBER OF CELL RESULTS BEFORE '->' DOES NOT MATCH ...}T SPECIFICATION: " ERROR
THEN      ELSE DEPTH START-DEPTH @ = 0= IF
S" NUMBER OF CELL RESULTS BEFORE AND AFTER '->' DOES NOT MATCH: " ERROR
THEN THEN
F...}T ;      F...}T ;

: XTESTER ( X -- )  : XTESTER ( X -- )
DEPTH 0= ACTUAL-DEPTH @ XCURSOR @ START-DEPTH @ + 1+ < OR IF      DEPTH 0= ACTUAL-DEPTH @ XCURSOR @ START-DEPTH @ + 1+ < OR IF
S" NUMBER OF CELL RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT          S" NUMBER OF CELL RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT
THEN      ELSE ACTUAL-RESULTS XCURSOR @ CELLS + @ <> IF
ACTUAL-RESULTS XCURSOR @ CELLS + @ <> IF
S" INCORRECT CELL RESULT: " ERROR          S" INCORRECT CELL RESULT: " ERROR
THEN      THEN THEN
1 XCURSOR +! ;      1 XCURSOR +! ;

: X}T XTESTER ...}T ;  : X}T XTESTER ...}T ;

 Removed from v.1.7 changed lines Added in v.1.11

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>