From 5a07354e041c89d68b60b7f90310023df65e4671 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 10 Apr 2023 15:09:17 -0700 Subject: [PATCH] (stdlib) Added tests --- cli/stdlib/stdlib.tal | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/cli/stdlib/stdlib.tal b/cli/stdlib/stdlib.tal index 86d5d66..9114df3 100644 --- a/cli/stdlib/stdlib.tal +++ b/cli/stdlib/stdlib.tal @@ -15,20 +15,22 @@ BRK JMP2r -@tests - =test-dec1 - =test-dec2 - =test-hex1 - =test-hex2 - &end +@tests [ + =test-dec1 =test-dec2 =test-dec3 =test-dec4 + =test-hex1 =test-hex2 =test-hex3 =test-hex4 +] &end ( @|tests ) -@test-dec1 ;dict/dec1 sdec #1234 EQU2 JMP2r -@test-dec2 ;dict/dec2 sdec #0123 EQU2 JMP2r -@test-hex1 ;dict/hex1 shex #12c0 EQU2 JMP2r -@test-hex2 ;dict/hex2 shex #034f EQU2 JMP2r + @test-dec1 ;dict/dec1 sdec #1234 EQU2 JMP2r + @test-dec2 ;dict/dec2 sdec #0123 EQU2 JMP2r + @test-dec3 ;dict/dec3 sdec #0000 EQU2 JMP2r + @test-dec4 ;dict/dec4 sdec #0000 EQU2 JMP2r + @test-hex1 ;dict/hex1 shex #12c0 EQU2 JMP2r + @test-hex2 ;dict/hex2 shex #034f EQU2 JMP2r + @test-hex3 ;dict/dec3 sdec #0000 EQU2 JMP2r + @test-hex4 ;dict/dec4 sdec #0000 EQU2 JMP2r ( @|stdlib ) @@ -61,15 +63,20 @@ JMP2r @chex ( c -- val|ff ) - LIT "0 SUB DUP #09 GTH JMP JMP2r - #27 SUB DUP #0f GTH JMP JMP2r + LIT "0 SUB DUP #09 GTH [ JMP JMP2r ] + #27 SUB DUP #0f GTH [ JMP JMP2r ] POP #ff JMP2r -@dict +@dict [ &dec1 "4660 $1 &dec2 "291 $1 + &dec3 "0 $1 + &dec4 "q2x*63? $1 &hex1 "12c0 $1 &hex2 "34f $1 + &hex3 "0 $1 + &hex4 "q2x*63? $1 +]