From: Dan White Date: Fri, 20 Feb 2015 15:38:16 +0000 (-0600) Subject: test documentation X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=081f01ab4e2e2ee21d45714d1a6810c3ee1b2e20;p=430.git test documentation --- diff --git a/msp4th/tests.4th b/msp4th/tests.4th index f3e4ac2..dc423f1 100644 --- a/msp4th/tests.4th +++ b/msp4th/tests.4th @@ -1,17 +1,18 @@ \ vim: ft=forth -: .. +: .. ( -- ) \ print TOS without consuming dup . ; -: fail ( -- ) +: fail ( -- ) \ print "FAIL" 0x46 emit 0x41 emit 0x49 emit 0x4c emit cr ; : cmp ( a b -- ) == not if fail s. then ; -: scmp ( x*2n n -- ) \ verify stack contents match +: scmp ( x*2n n -- ) \ verify n stack entries match, or are repeated 0 swap do - i roll cmp - -1 +loop ; + i roll cmp + -1 + +loop ; 5 6 7 8 5 6 7 8 4 scmp \ case 1: // bye