1
0
mirror of https://github.com/mgcaret/of816.git synced 2024-12-27 04:29:32 +00:00

increase test coverage

This commit is contained in:
mgcaret 2020-01-26 20:01:44 -08:00
parent 8e8d3133f5
commit e1fa237f03
6 changed files with 209 additions and 10 deletions

View File

@ -2451,7 +2451,9 @@ dword WITHIN,"WITHIN"
EXIT
eword
; H: ( n1|u1 n2|u2 n3|u3 -- f ) f = true if n2|u2 <= n1|u1 <= n3|u3, false otherwise
; H: ( n1 n2 n3 -- f ) f = true if n2<=n1<=n3, false otherwise
; this implementation fails when N3 is max-int and should be
; replaced with something better at some point
dword BETWEEN,"BETWEEN"
ENTER
.dword INCR

View File

@ -34,7 +34,14 @@ T{ MID-UINT+1 1 RSHIFT 2 * -> MID-UINT+1 }T
T{ MID-UINT+1 2 RSHIFT 4 * -> MID-UINT+1 }T
T{ MID-UINT+1 1 RSHIFT MID-UINT+1 OR 2 * -> MID-UINT+1 }T
\ todo: u*
\ U* is essentially the same code as *, abbreviate test
T{ 0 0 u* -> 0 }T \ TEST IDENTITIES
T{ 0 1 u* -> 0 }T
T{ 1 0 u* -> 0 }T
T{ 1 2 u* -> 2 }T
T{ 2 1 u* -> 2 }T
T{ 3 3 u* -> 9 }T
T{ 0 1 / -> 0 1 T/ }T
T{ 1 1 / -> 1 1 T/ }T
@ -142,7 +149,13 @@ T{ -7 2 -3 */MOD -> -7 2 -3 T*/MOD }T
T{ MAX-INT 2 MAX-INT */MOD -> MAX-INT 2 MAX-INT T*/MOD }T
T{ MIN-INT 2 MIN-INT */MOD -> MIN-INT 2 MIN-INT T*/MOD }T
\ todo: u/mod
T{ 0 1 u/MOD -> 0 1 T/MOD }T
T{ 1 1 u/MOD -> 1 1 T/MOD }T
T{ 2 1 u/MOD -> 2 1 T/MOD }T
T{ 2 2 u/MOD -> 2 2 T/MOD }T
T{ 7 3 u/MOD -> 7 3 T/MOD }T
T{ MAX-INT 1 u/MOD -> MAX-INT 1 T/MOD }T
T{ MAX-INT MAX-INT u/MOD -> MAX-INT MAX-INT T/MOD }T
T{ 0 1+ -> 1 }T
T{ -1 1+ -> 0 }T

View File

@ -3,14 +3,10 @@ true CONSTANT <TRUE>
testing 7.3.3.1 Memory access
\ the unaligned- words are not tested here because they are
\ aliases to the standard version of the words since OF816
\ has no alignment restrictions
\ the words are tested somewhat out of order from how they
\ appear in IEEE 1275-1994 7.3.3.1
\ not tested yet: COMP, DUMP, WBFLIPS, LBFLIPS, LWFLIPS
\ not tested yet: COMP, WBFLIPS, LBFLIPS, LWFLIPS
HERE 1 ,
HERE 2 ,
@ -158,6 +154,17 @@ DECIMAL
BL WORD 12345678123456781234567812345678 DROP
T{ PAD CHARS/PAD 0 CHECKPAD -> TRUE }T
\ this test bites, need to improve testing tool to allow
\ multi-line expectations
variable dumptst
t{ dumptst 4 dump -> }t \ expect: ""
\ These aren't tested and are optional aliases, anyway
\ this cheats the tests to make them covered :-)
t{ parse-word unaligned-l@ $find if else drop then drop -> }t
t{ parse-word unaligned-l! $find if else drop then drop -> }t
t{ parse-word unaligned-w@ $find if else drop then drop -> }t
t{ parse-word unaligned-w! $find if else drop then drop -> }t
testing 7.3.3.2 Memory allocation

View File

@ -65,7 +65,146 @@ t{ max-int 0 >= -> <true> }t
t{ min-int max-int >= -> <false> }t
t{ max-int min-int >= -> <true> }t
\ todo: between within
t{ 0 0 0 between -> true }t
t{ 1 0 0 between -> false }t
t{ -1 0 0 between -> false }t
t{ -1 -1 1 between -> true }t
t{ 1 -1 1 between -> true }t
t{ 0 0 max-int between -> true }t
t{ 0 min-int 0 between -> true }t
t{ 1 min-int 0 between -> false }t
\ next test fails with current implementation of BETWEEN
\ t{ 0 min-int max-int between -> true }t
T{ 0 0 0 WITHIN -> FALSE }T
T{ 0 0 MID-UINT WITHIN -> TRUE }T
T{ 0 0 MID-UINT+1 WITHIN -> TRUE }T
T{ 0 0 MAX-UINT WITHIN -> TRUE }T
T{ 0 MID-UINT 0 WITHIN -> FALSE }T
T{ 0 MID-UINT MID-UINT WITHIN -> FALSE }T
T{ 0 MID-UINT MID-UINT+1 WITHIN -> FALSE }T
T{ 0 MID-UINT MAX-UINT WITHIN -> FALSE }T
T{ 0 MID-UINT+1 0 WITHIN -> FALSE }T
T{ 0 MID-UINT+1 MID-UINT WITHIN -> TRUE }T
T{ 0 MID-UINT+1 MID-UINT+1 WITHIN -> FALSE }T
T{ 0 MID-UINT+1 MAX-UINT WITHIN -> FALSE }T
T{ 0 MAX-UINT 0 WITHIN -> FALSE }T
T{ 0 MAX-UINT MID-UINT WITHIN -> TRUE }T
T{ 0 MAX-UINT MID-UINT+1 WITHIN -> TRUE }T
T{ 0 MAX-UINT MAX-UINT WITHIN -> FALSE }T
T{ MID-UINT 0 0 WITHIN -> FALSE }T
T{ MID-UINT 0 MID-UINT WITHIN -> FALSE }T
T{ MID-UINT 0 MID-UINT+1 WITHIN -> TRUE }T
T{ MID-UINT 0 MAX-UINT WITHIN -> TRUE }T
T{ MID-UINT MID-UINT 0 WITHIN -> TRUE }T
T{ MID-UINT MID-UINT MID-UINT WITHIN -> FALSE }T
T{ MID-UINT MID-UINT MID-UINT+1 WITHIN -> TRUE }T
T{ MID-UINT MID-UINT MAX-UINT WITHIN -> TRUE }T
T{ MID-UINT MID-UINT+1 0 WITHIN -> FALSE }T
T{ MID-UINT MID-UINT+1 MID-UINT WITHIN -> FALSE }T
T{ MID-UINT MID-UINT+1 MID-UINT+1 WITHIN -> FALSE }T
T{ MID-UINT MID-UINT+1 MAX-UINT WITHIN -> FALSE }T
T{ MID-UINT MAX-UINT 0 WITHIN -> FALSE }T
T{ MID-UINT MAX-UINT MID-UINT WITHIN -> FALSE }T
T{ MID-UINT MAX-UINT MID-UINT+1 WITHIN -> TRUE }T
T{ MID-UINT MAX-UINT MAX-UINT WITHIN -> FALSE }T
T{ MID-UINT+1 0 0 WITHIN -> FALSE }T
T{ MID-UINT+1 0 MID-UINT WITHIN -> FALSE }T
T{ MID-UINT+1 0 MID-UINT+1 WITHIN -> FALSE }T
T{ MID-UINT+1 0 MAX-UINT WITHIN -> TRUE }T
T{ MID-UINT+1 MID-UINT 0 WITHIN -> TRUE }T
T{ MID-UINT+1 MID-UINT MID-UINT WITHIN -> FALSE }T
T{ MID-UINT+1 MID-UINT MID-UINT+1 WITHIN -> FALSE }T
T{ MID-UINT+1 MID-UINT MAX-UINT WITHIN -> TRUE }T
T{ MID-UINT+1 MID-UINT+1 0 WITHIN -> TRUE }T
T{ MID-UINT+1 MID-UINT+1 MID-UINT WITHIN -> TRUE }T
T{ MID-UINT+1 MID-UINT+1 MID-UINT+1 WITHIN -> FALSE }T
T{ MID-UINT+1 MID-UINT+1 MAX-UINT WITHIN -> TRUE }T
T{ MID-UINT+1 MAX-UINT 0 WITHIN -> FALSE }T
T{ MID-UINT+1 MAX-UINT MID-UINT WITHIN -> FALSE }T
T{ MID-UINT+1 MAX-UINT MID-UINT+1 WITHIN -> FALSE }T
T{ MID-UINT+1 MAX-UINT MAX-UINT WITHIN -> FALSE }T
T{ MAX-UINT 0 0 WITHIN -> FALSE }T
T{ MAX-UINT 0 MID-UINT WITHIN -> FALSE }T
T{ MAX-UINT 0 MID-UINT+1 WITHIN -> FALSE }T
T{ MAX-UINT 0 MAX-UINT WITHIN -> FALSE }T
T{ MAX-UINT MID-UINT 0 WITHIN -> TRUE }T
T{ MAX-UINT MID-UINT MID-UINT WITHIN -> FALSE }T
T{ MAX-UINT MID-UINT MID-UINT+1 WITHIN -> FALSE }T
T{ MAX-UINT MID-UINT MAX-UINT WITHIN -> FALSE }T
T{ MAX-UINT MID-UINT+1 0 WITHIN -> TRUE }T
T{ MAX-UINT MID-UINT+1 MID-UINT WITHIN -> TRUE }T
T{ MAX-UINT MID-UINT+1 MID-UINT+1 WITHIN -> FALSE }T
T{ MAX-UINT MID-UINT+1 MAX-UINT WITHIN -> FALSE }T
T{ MAX-UINT MAX-UINT 0 WITHIN -> TRUE }T
T{ MAX-UINT MAX-UINT MID-UINT WITHIN -> TRUE }T
T{ MAX-UINT MAX-UINT MID-UINT+1 WITHIN -> TRUE }T
T{ MAX-UINT MAX-UINT MAX-UINT WITHIN -> FALSE }T
T{ MIN-INT MIN-INT MIN-INT WITHIN -> FALSE }T
T{ MIN-INT MIN-INT 0 WITHIN -> TRUE }T
T{ MIN-INT MIN-INT 1 WITHIN -> TRUE }T
T{ MIN-INT MIN-INT MAX-INT WITHIN -> TRUE }T
T{ MIN-INT 0 MIN-INT WITHIN -> FALSE }T
T{ MIN-INT 0 0 WITHIN -> FALSE }T
T{ MIN-INT 0 1 WITHIN -> FALSE }T
T{ MIN-INT 0 MAX-INT WITHIN -> FALSE }T
T{ MIN-INT 1 MIN-INT WITHIN -> FALSE }T
T{ MIN-INT 1 0 WITHIN -> TRUE }T
T{ MIN-INT 1 1 WITHIN -> FALSE }T
T{ MIN-INT 1 MAX-INT WITHIN -> FALSE }T
T{ MIN-INT MAX-INT MIN-INT WITHIN -> FALSE }T
T{ MIN-INT MAX-INT 0 WITHIN -> TRUE }T
T{ MIN-INT MAX-INT 1 WITHIN -> TRUE }T
T{ MIN-INT MAX-INT MAX-INT WITHIN -> FALSE }T
T{ 0 MIN-INT MIN-INT WITHIN -> FALSE }T
T{ 0 MIN-INT 0 WITHIN -> FALSE }T
T{ 0 MIN-INT 1 WITHIN -> TRUE }T
T{ 0 MIN-INT MAX-INT WITHIN -> TRUE }T
T{ 0 0 MIN-INT WITHIN -> TRUE }T
T{ 0 0 0 WITHIN -> FALSE }T
T{ 0 0 1 WITHIN -> TRUE }T
T{ 0 0 MAX-INT WITHIN -> TRUE }T
T{ 0 1 MIN-INT WITHIN -> FALSE }T
T{ 0 1 0 WITHIN -> FALSE }T
T{ 0 1 1 WITHIN -> FALSE }T
T{ 0 1 MAX-INT WITHIN -> FALSE }T
T{ 0 MAX-INT MIN-INT WITHIN -> FALSE }T
T{ 0 MAX-INT 0 WITHIN -> FALSE }T
T{ 0 MAX-INT 1 WITHIN -> TRUE }T
T{ 0 MAX-INT MAX-INT WITHIN -> FALSE }T
T{ 1 MIN-INT MIN-INT WITHIN -> FALSE }T
T{ 1 MIN-INT 0 WITHIN -> FALSE }T
T{ 1 MIN-INT 1 WITHIN -> FALSE }T
T{ 1 MIN-INT MAX-INT WITHIN -> TRUE }T
T{ 1 0 MIN-INT WITHIN -> TRUE }T
T{ 1 0 0 WITHIN -> FALSE }T
T{ 1 0 1 WITHIN -> FALSE }T
T{ 1 0 MAX-INT WITHIN -> TRUE }T
T{ 1 1 MIN-INT WITHIN -> TRUE }T
T{ 1 1 0 WITHIN -> TRUE }T
T{ 1 1 1 WITHIN -> FALSE }T
T{ 1 1 MAX-INT WITHIN -> TRUE }T
T{ 1 MAX-INT MIN-INT WITHIN -> FALSE }T
T{ 1 MAX-INT 0 WITHIN -> FALSE }T
T{ 1 MAX-INT 1 WITHIN -> FALSE }T
T{ 1 MAX-INT MAX-INT WITHIN -> FALSE }T
T{ MAX-INT MIN-INT MIN-INT WITHIN -> FALSE }T
T{ MAX-INT MIN-INT 0 WITHIN -> FALSE }T
T{ MAX-INT MIN-INT 1 WITHIN -> FALSE }T
T{ MAX-INT MIN-INT MAX-INT WITHIN -> FALSE }T
T{ MAX-INT 0 MIN-INT WITHIN -> TRUE }T
T{ MAX-INT 0 0 WITHIN -> FALSE }T
T{ MAX-INT 0 1 WITHIN -> FALSE }T
T{ MAX-INT 0 MAX-INT WITHIN -> FALSE }T
T{ MAX-INT 1 MIN-INT WITHIN -> TRUE }T
T{ MAX-INT 1 0 WITHIN -> TRUE }T
T{ MAX-INT 1 1 WITHIN -> FALSE }T
T{ MAX-INT 1 MAX-INT WITHIN -> FALSE }T
T{ MAX-INT MAX-INT MIN-INT WITHIN -> TRUE }T
T{ MAX-INT MAX-INT 0 WITHIN -> TRUE }T
T{ MAX-INT MAX-INT 1 WITHIN -> TRUE }T
T{ MAX-INT MAX-INT MAX-INT WITHIN -> FALSE }T
T{ 0 0< -> <FALSE> }T
T{ -1 0< -> <TRUE> }T
@ -80,6 +219,17 @@ t{ 1 0<= -> <false> }t
t{ min-int 0<= -> <true> }t
t{ max-int 0<= -> <false> }t
t{ 0 0 <= -> <true> }t
t{ -1 0 <= -> <true> }t
t{ -2 0 <= -> <true> }t
t{ 1 0 <= -> <false> }t
t{ min-int 0 <= -> <true> }t
t{ max-int 0 <= -> <false> }t
t{ max-int min-int <= -> <false> }t
t{ min-int max-int <= -> <true> }t
t{ min-int min-int <= -> <true> }t
t{ max-int max-int <= -> <true> }t
t{ 0 0<> -> <false> }t
t{ 1 0<> -> <true> }t
t{ 2 0<> -> <true> }t
@ -123,4 +273,25 @@ T{ MID-UINT 0 U< -> <FALSE> }T
T{ MAX-UINT 0 U< -> <FALSE> }T
T{ MAX-UINT MID-UINT U< -> <FALSE> }T
\ todo: u<= u> u>=
t{ 0 0 u<= -> <true> }t
t{ 1 0 u<= -> <false> }t
t{ max-uint 0 u<= -> <false> }t
t{ max-uint max-uint u<= -> <true> }t
t{ mid-uint max-uint u<= -> <true> }t
t{ max-uint mid-uint u<= -> <false> }t
t{ 0 0 u> -> <false> }t
t{ 1 0 u> -> <true> }t
t{ max-uint 0 u> -> <true> }t
t{ max-uint max-uint u> -> <false> }t
t{ mid-uint max-uint u> -> <false> }t
t{ max-uint mid-uint u> -> <true> }t
t{ 0 0 u>= -> <true> }t
t{ 1 0 u>= -> <true> }t
t{ max-uint 0 u>= -> <true> }t
t{ max-uint max-uint u>= -> <true> }t
t{ mid-uint max-uint u>= -> <false> }t
t{ max-uint mid-uint u>= -> <true> }t

View File

@ -212,3 +212,7 @@ T{ 4 5 ' T10 C6 -> 4 77 12 }T \ ABORT" caught, no message
: T9 S" 111 112 T8 113" EVALUATE 114 ;
T{ 6 7 ' T9 C6 3 -> 6 7 13 3 }T \ Test unlinking of sources
\ Housekeeping to tell coverage tool that we got these
t{ ' ABORT 0= -> false }t
t{ ' ABORT" 0= -> false }t

View File

@ -75,3 +75,5 @@ t{ 31 sqrtrem -> 5 6 }t
hex
t{ $memtop @ 0= -> false }t
t{ 123 u.0 -> }t \ expect: "123 OK"