Skip to content

Commit

Permalink
Add test cases for WITHIN, closes #47
Browse files Browse the repository at this point in the history
  • Loading branch information
scotws committed Jun 12, 2018
1 parent 8a07752 commit 344e4cd
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
30 changes: 29 additions & 1 deletion tests/results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ testing 2* 2/ lshift rshift ok
{ msb 1 rshift 2* -> msb } ok
ok
\ ------------------------------------------------------------------------ ok
testing comparisons: 0= = <> 0< < > u< min max ok
testing comparisons: 0= = <> 0< < > u< min max within ok
( TODO we need to add max-2int and min-2int for further tests) ok
0 invert constant max-uint ok
0 invert 1 rshift constant max-int ok
Expand Down Expand Up @@ -299,6 +299,34 @@ testing comparisons: 0= = <> 0< < > u< min max ok
{ max-int min-int max -> max-int } ok
{ max-int 0 max -> max-int } ok
ok
{ 1 2 4 within -> <false> } ok
{ 2 2 4 within -> <true> } ok
{ 3 2 4 within -> <true> } ok
{ 4 2 4 within -> <false> } ok
{ 5 2 4 within -> <false> } ok
ok
{ 0 2 4 within -> <false> } ok
{ 1 0 4 within -> <true> } ok
{ 0 0 4 within -> <true> } ok
{ 4 0 4 within -> <false> } ok
{ 5 0 4 within -> <false> } ok
ok
{ -1 -3 -1 within -> <false> } ok
{ -2 -3 -1 within -> <true> } ok
{ -3 -3 -1 within -> <true> } ok
{ -4 -3 -1 within -> <false> } ok
ok
{ -2 -2 0 within -> <true> } ok
{ -1 -2 0 within -> <true> } ok
{ 0 -2 0 within -> <false> } ok
{ 1 -2 0 within -> <false> } ok
ok
{ 0 min-int max-int within -> <true> } ok
{ 1 min-int max-int within -> <true> } ok
{ -1 min-int max-int within -> <true> } ok
{ min-int min-int max-int within -> <true> } ok
{ max-int min-int max-int within -> <false> } ok
ok
\ ------------------------------------------------------------------------ ok
testing stack ops: 2drop 2dup 2over 2swap ?dup depth drop dup nip over rot -rot swap ok
ok
Expand Down
30 changes: 29 additions & 1 deletion tests/talitests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ testing 2* 2/ lshift rshift
{ msb 1 rshift 2* -> msb }

\ ------------------------------------------------------------------------
testing comparisons: 0= = <> 0< < > u< min max
testing comparisons: 0= = <> 0< < > u< min max within
( TODO we need to add max-2int and min-2int for further tests)
0 invert constant max-uint
0 invert 1 rshift constant max-int
Expand Down Expand Up @@ -219,6 +219,34 @@ testing comparisons: 0= = <> 0< < > u< min max
{ max-int min-int max -> max-int }
{ max-int 0 max -> max-int }

{ 1 2 4 within -> <false> }
{ 2 2 4 within -> <true> }
{ 3 2 4 within -> <true> }
{ 4 2 4 within -> <false> }
{ 5 2 4 within -> <false> }

{ 0 2 4 within -> <false> }
{ 1 0 4 within -> <true> }
{ 0 0 4 within -> <true> }
{ 4 0 4 within -> <false> }
{ 5 0 4 within -> <false> }

{ -1 -3 -1 within -> <false> }
{ -2 -3 -1 within -> <true> }
{ -3 -3 -1 within -> <true> }
{ -4 -3 -1 within -> <false> }

{ -2 -2 0 within -> <true> }
{ -1 -2 0 within -> <true> }
{ 0 -2 0 within -> <false> }
{ 1 -2 0 within -> <false> }

{ 0 min-int max-int within -> <true> }
{ 1 min-int max-int within -> <true> }
{ -1 min-int max-int within -> <true> }
{ min-int min-int max-int within -> <true> }
{ max-int min-int max-int within -> <false> }

\ ------------------------------------------------------------------------
testing stack ops: 2drop 2dup 2over 2swap ?dup depth drop dup nip over rot -rot swap

Expand Down

0 comments on commit 344e4cd

Please sign in to comment.