--- gforth/test/ttester.fs 2007/11/03 08:20:32 1.8 +++ gforth/test/ttester.fs 2008/11/08 18:28:22 1.12 @@ -180,7 +180,7 @@ HAS-FLOATING-STACK [IF] : F} ( ... -- ... ) FDEPTH ACTUAL-FDEPTH @ = IF FDEPTH START-FDEPTH @ > IF - FDEPTH START-FDEPTH @ DO + FDEPTH START-FDEPTH @ - 0 DO ACTUAL-FRESULTS I FLOATS + F@ FCONF= INVERT IF S" INCORRECT FP RESULT: " ERROR LEAVE THEN @@ -192,7 +192,7 @@ HAS-FLOATING-STACK [IF] : F...}T ( -- ) 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 ELSE FDEPTH START-FDEPTH @ = 0= IF S" NUMBER OF FLOAT RESULTS BEFORE AND AFTER '->' DOES NOT MATCH: " ERROR THEN THEN ; @@ -202,8 +202,8 @@ HAS-FLOATING-STACK [IF] FDEPTH 0= ACTUAL-FDEPTH @ FCURSOR @ START-FDEPTH @ + 1+ < OR IF S" NUMBER OF FLOAT RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR ELSE ACTUAL-FRESULTS FCURSOR @ FLOATS + F@ FCONF= 0= IF - S" INCORRECT FP RESULT: " ERROR - THEN THEN + S" INCORRECT FP RESULT: " ERROR + THEN THEN 1 FCURSOR +! ; [ELSE] @@ -213,22 +213,23 @@ HAS-FLOATING-STACK [IF] : F} ; : F...}T ; + HAS-FLOATING [IF] DECIMAL : COMPUTE-CELLS-PER-FP ( -- U ) DEPTH 0E DEPTH 1- >R FDROP R> SWAP - ; HEX COMPUTE-CELLS-PER-FP CONSTANT CELLS-PER-FP - + : FTESTER ( R -- ) 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 + ELSE ACTUAL-RESULTS XCURSOR @ CELLS + F@ FCONF= 0= IF S" INCORRECT FP RESULT: " ERROR - THEN + THEN THEN CELLS-PER-FP XCURSOR +! ; - [THEN] + [THEN] +[THEN] : EMPTY-STACK \ ( ... -- ) EMPTY STACK: HANDLES UNDERFLOWED STACK TOO. DEPTH START-DEPTH @ < IF @@ -261,7 +262,7 @@ HAS-FLOATING-STACK [IF] \ (ACTUAL) CONTENTS. DEPTH ACTUAL-DEPTH @ = IF \ IF DEPTHS MATCH 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 <> IF S" INCORRECT RESULT: " ERROR LEAVE THEN LOOP @@ -283,17 +284,20 @@ HAS-FLOATING-STACK [IF] DEPTH 0= ACTUAL-DEPTH @ XCURSOR @ START-DEPTH @ + 1+ < OR IF S" NUMBER OF CELL RESULTS AFTER '->' BELOW ...}T SPECIFICATION: " ERROR EXIT ELSE ACTUAL-RESULTS XCURSOR @ CELLS + @ <> IF - S" INCORRECT CELL RESULT: " ERROR - THEN THEN + S" INCORRECT CELL RESULT: " ERROR + THEN THEN 1 XCURSOR +! ; : X}T XTESTER ...}T ; -: R}T FTESTER ...}T ; : XX}T XTESTER XTESTER ...}T ; +: XXX}T XTESTER XTESTER XTESTER ...}T ; +: XXXX}T XTESTER XTESTER XTESTER XTESTER ...}T ; + +HAS-FLOATING [IF] +: R}T FTESTER ...}T ; : XR}T FTESTER XTESTER ...}T ; : RX}T XTESTER FTESTER ...}T ; : RR}T FTESTER FTESTER ...}T ; -: XXX}T XTESTER XTESTER XTESTER ...}T ; : XXR}T FTESTER XTESTER XTESTER ...}T ; : XRX}T XTESTER FTESTER XTESTER ...}T ; : XRR}T FTESTER FTESTER XTESTER ...}T ; @@ -301,7 +305,6 @@ HAS-FLOATING-STACK [IF] : RXR}T FTESTER XTESTER FTESTER ...}T ; : RRX}T XTESTER FTESTER FTESTER ...}T ; : RRR}T FTESTER FTESTER FTESTER ...}T ; -: XXXX}T XTESTER XTESTER XTESTER XTESTER ...}T ; : XXXR}T FTESTER XTESTER XTESTER XTESTER ...}T ; : XXRX}T XTESTER FTESTER XTESTER XTESTER ...}T ; : XXRR}T FTESTER FTESTER XTESTER XTESTER ...}T ; @@ -317,6 +320,7 @@ HAS-FLOATING-STACK [IF] : RRXR}T FTESTER XTESTER FTESTER FTESTER ...}T ; : RRRX}T XTESTER FTESTER FTESTER FTESTER ...}T ; : RRRR}T FTESTER FTESTER FTESTER FTESTER ...}T ; +[THEN] : TESTING \ ( -- ) TALKING COMMENT. SOURCE VERBOSE @