Skip to content

Commit

Permalink
Test floating point stack underflow too
Browse files Browse the repository at this point in the history
  • Loading branch information
nomennescio committed Oct 23, 2023
1 parent 84ce55e commit d024e5a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 6 deletions.
28 changes: 28 additions & 0 deletions test/test-stack-underflow.4th
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,24 @@ s" no underflow" describe#{
balance$
reset-stacks

\ prefill stack to prevent runtime stack underflow error
0

s" simple underflow" describe#{
s" single test" it#{
<{ drop -> 0 }>
}#
}#

drop

balance$
reset-stacks

\ prefill stacks to prevent runtime stack underflow error
12 34 56 78
12e 34e 56e 78e

s" stack underflow" describe#{
s" single test" it#{
<{ drop -> 0 }>
Expand All @@ -48,6 +57,25 @@ s" stack underflow" describe#{
<{ drop -> 0 0 }>
<{ drop drop -> 0 }>
}#

s" float test" it#{
<{ fdrop -> 0e }>
}#
s" double float test" it#{
<{ fdrop -> 0e }>
<{ fdrop fdrop -> 0e }>
}#
s" double float test" it#{
<{ fdrop -> 0e 0e }>
<{ fdrop fdrop -> 0e 0e }>
}#
s" double float test" it#{
<{ fdrop -> 0e 0e }>
<{ fdrop fdrop -> 0e }>
}#
}#

drop drop drop drop
fdrop fdrop fdrop fdrop

balance$
42 changes: 36 additions & 6 deletions test/test-stack-underflow.expected
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ float stack unbalanced

<COMPLETEDIN::>0.010 ms

<COMPLETEDIN::>0.015 ms
<COMPLETEDIN::>0.016 ms
cell stack balanced
float stack balanced

Expand All @@ -33,32 +33,62 @@ float stack balanced

<FAILED::>Wrong number of cell results, expected 1 , got a 1 cell stack underflow

<COMPLETEDIN::>0.007 ms
<COMPLETEDIN::>0.008 ms

<IT::>double test

<FAILED::>Wrong number of cell results, expected 1 , got a 1 cell stack underflow

<FAILED::>Wrong number of cell results, expected 1 , got a 2 cell stack underflow

<COMPLETEDIN::>1698095100262.642 ms
<COMPLETEDIN::>1698095971439.486 ms

<IT::>double test

<FAILED::>Wrong number of cell results, expected 2 , got a 1 cell stack underflow

<FAILED::>Wrong number of cell results, expected 2 , got a 2 cell stack underflow

<COMPLETEDIN::>1698095100262.660 ms
<COMPLETEDIN::>1698095971439.504 ms

<IT::>double test

<FAILED::>Wrong number of cell results, expected 2 , got a 1 cell stack underflow

<FAILED::>Wrong number of cell results, expected 1 , got a 2 cell stack underflow

<COMPLETEDIN::>1698095100262.677 ms
<COMPLETEDIN::>1698095971439.522 ms

<IT::>float test

<FAILED::>Wrong number of float results, expected 1 , got a 1 float stack underflow

<COMPLETEDIN::>0.008 ms

<IT::>double float test

<FAILED::>Wrong number of float results, expected 1 , got a 1 float stack underflow

<FAILED::>Wrong number of float results, expected 1 , got a 2 float stack underflow

<COMPLETEDIN::>0.022 ms

<IT::>double float test

<FAILED::>Wrong number of float results, expected 2 , got a 1 float stack underflow

<FAILED::>Wrong number of float results, expected 2 , got a 2 float stack underflow

<COMPLETEDIN::>0.015 ms

<IT::>double float test

<FAILED::>Wrong number of float results, expected 2 , got a 1 float stack underflow

<FAILED::>Wrong number of float results, expected 1 , got a 2 float stack underflow

<COMPLETEDIN::>0.015 ms

<COMPLETEDIN::>0.065 ms
<COMPLETEDIN::>0.142 ms
cell stack balanced
float stack balanced

0 comments on commit d024e5a

Please # to comment.