From d456f722f18bb0c90f897a700f3a10340d2f5bfd Mon Sep 17 00:00:00 2001 From: mgcaret Date: Wed, 8 Jan 2020 12:25:03 -0800 Subject: [PATCH] additional tests --- test/7.3.2.2.fs | 24 +++++++++++++++++++++--- test/of816-words.fs | 15 ++++++++++++++- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/test/7.3.2.2.fs b/test/7.3.2.2.fs index 7498792..b1862b4 100644 --- a/test/7.3.2.2.fs +++ b/test/7.3.2.2.fs @@ -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 diff --git a/test/of816-words.fs b/test/of816-words.fs index 64895eb..5b87557 100644 --- a/test/of816-words.fs +++ b/test/of816-words.fs @@ -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