From f77ee15559ad3088b47eeb9ef86a9584e61b162e Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 8 Jan 2024 20:08:24 -0800 Subject: [PATCH] Added tests for scmp --- cli/stdlib/stdlib.tal | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/cli/stdlib/stdlib.tal b/cli/stdlib/stdlib.tal index 7a71528..a50248a 100644 --- a/cli/stdlib/stdlib.tal +++ b/cli/stdlib/stdlib.tal @@ -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