additional tests

This commit is contained in:
mgcaret 2020-01-08 12:25:03 -08:00
parent 85e2c0122c
commit d456f722f1
2 changed files with 35 additions and 4 deletions

View File

@ -19,7 +19,24 @@ T{ 8000 F RSHIFT -> 1 }T \ BIGGEST
T{ MSB 1 RSHIFT MSB AND -> 0 }T \ RSHIFT ZERO FILLS MSBS
T{ MSB 1 RSHIFT 2* -> MSB }T
\ todo: >>a << >>
t{ 1 1 >>a -> 0 }t
t{ 0 1 >>a -> 0 }t
t{ 0 invert 1 >> 1 >>a 0< -> false }t
t{ -1 1 >>a -> -1 }t
t{ -1 2 >>a -> -1 }t
t{ -1 4 >>a -> -1 }t
t{ -2 1 >>a -> -1 }t
t{ -4 1 >>a -> -2 }t
\ << >> are synonyms for lshift and rshift, do abbreviated test
T{ 1 0 << -> 1 }T
T{ 1 1 << -> 2 }T
T{ 1 2 << -> 4 }T
T{ 1 0 >> -> 1 }T
T{ 1 1 >> -> 0 }T
T{ 2 1 >> -> 1 }T
T{ 4 2 >> -> 1 }T
T{ 0S 2* -> 0S }T
T{ 1 2* -> 2 }T
@ -27,8 +44,6 @@ T{ 4000 2* -> 8000 }T
T{ 1S 2* 1 XOR -> 1S }T
T{ MSB 2* -> 0S }T
\ todo: u2/
T{ 0S 2/ -> 0S }T
T{ 1 2/ -> 0 }T
T{ 4000 2/ -> 2000 }T
@ -36,6 +51,9 @@ T{ 1S 2/ -> 1S }T \ MSB PROPOGATED
T{ 1S 1 XOR 2/ -> 1S }T
T{ MSB 2/ MSB AND -> MSB }T
t{ 0 invert u2/ 0< -> false }t
t{ 0 invert u2/ u2/ -> 0 invert 2 >> }t
T{ 0 0 AND -> 0 }T
T{ 0 1 AND -> 0 }T
T{ 1 0 AND -> 0 }T

View File

@ -1,6 +1,8 @@
testing OF816 words
hex
\ excluding FCode-related words
t{ binary base @ hex -> 2 }t
: s= ( str len str len )
2 pick over = if
@ -45,6 +47,9 @@ t{ fbbb free-mem -> }t
t{ $hex( 414243) 2dup $2value -> }t
t{ abc s" ABC" s= -> true }t
\ Case-independent comparison
t{ s" foo" drop s" FoO" cicomp -> 0 }t
\ Memory debug, good time to run it after the above
t{ debug-mem -> }t
@ -58,3 +63,11 @@ t{ qt1 execute -> 123 }t
\ Existence of a couple of words that are hard to test
t{ ' $empty-wl 0= -> false }t
t{ ' $env?-wl 0= -> false }t
\ square root
decimal
t{ 0 sqrtrem -> 0 0 }t
t{ 4 sqrtrem -> 2 0 }t
t{ 25 sqrtrem -> 5 0 }t
t{ 31 sqrtrem -> 5 6 }t
hex