Added tests for scmp

This commit is contained in:
Devine Lu Linvega 2024-01-08 20:08:24 -08:00
parent 124109101f
commit f77ee15559
1 changed files with 30 additions and 4 deletions

View File

@ -5,13 +5,13 @@
&l ( -- )
LDA2k JSR2 test INC2 INC2 GTH2k ?&l
POP2 POP2
( lb ) #0a18 DEO
( debugger ) #010e DEO
( exit ) #800f DEO
BRK
@test ( f -- )
#30 ADD #18 DEO
#0a18 DEO
JMP2r
(
@ -19,9 +19,11 @@
@tests [
=test-dec1 =test-dec2 =test-dec3 =test-dec4
=test-hex1 =test-hex2 =test-hex3 =test-hex4 ] &end
=test-hex1 =test-hex2 =test-hex3 =test-hex4
=test-scmp1 =test-scmp2 =test-scmp3 =test-scmp4 ] &end
@test-dec1
#0a18 DEO
;dict/dec1 sdec #1234 EQU2 JMP2r
@test-dec2
@ -34,6 +36,7 @@
;dict/dec4 sdec #0000 EQU2 JMP2r
@test-hex1
#0a18 DEO
;dict/hex1 shex #12c0 EQU2 JMP2r
@test-hex2
@ -45,6 +48,27 @@
@test-hex4
;dict/dec4 sdec #0000 EQU2 JMP2r
@test-scmp1
#0a18 DEO
{ "text 00 }
STH2r { "text 00 }
STH2r scmp #01 EQU JMP2r
@test-scmp2
{ "text 00 }
STH2r { "te 00 }
STH2r scmp #00 EQU JMP2r
@test-scmp3
{ "textext 00 }
STH2r { "text 00 }
STH2r scmp #00 EQU JMP2r
@test-scmp4
{ 00 "ext 00 }
STH2r { "text 00 }
STH2r scmp #00 EQU JMP2r
(
@|stdlib )
@ -97,7 +121,8 @@
&w ( -- )
( validate ) LDAk [ LIT "0 ] SUB #09 GTH ?&end
( accumulate ) [ LIT2r 000a ] MUL2r
( combine ) LDAk [ LIT "0 ] SUB [ LITr 00 ] STH ADD2r
( combine ) LDAk [ LIT "0 ] SUB [ LITr 00 ] STH
ADD2r
( continue ) INC2 LDAk ?&w
&end POP2 STH2r JMP2r
@ -106,7 +131,8 @@
&w ( -- )
( validate ) LDAk chex INC #00 EQU ?&end
( accumulate ) [ LITr 40 ] SFT2r
( combine ) LDAk chex [ LITr 00 ] STH ADD2r
( combine ) LDAk chex [ LITr 00 ] STH
ADD2r
( continue ) INC2 LDAk ?&w
&end POP2 STH2r JMP2r