Skip to content

Commit d024e5a

Browse files
committed
Test floating point stack underflow too
1 parent 84ce55e commit d024e5a

File tree

2 files changed

+64
-6
lines changed

2 files changed

+64
-6
lines changed

test/test-stack-underflow.4th

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,24 @@ s" no underflow" describe#{
2323
balance$
2424
reset-stacks
2525

26+
\ prefill stack to prevent runtime stack underflow error
27+
0
28+
2629
s" simple underflow" describe#{
2730
s" single test" it#{
2831
<{ drop -> 0 }>
2932
}#
3033
}#
3134

35+
drop
36+
3237
balance$
3338
reset-stacks
3439

40+
\ prefill stacks to prevent runtime stack underflow error
41+
12 34 56 78
42+
12e 34e 56e 78e
43+
3544
s" stack underflow" describe#{
3645
s" single test" it#{
3746
<{ drop -> 0 }>
@@ -48,6 +57,25 @@ s" stack underflow" describe#{
4857
<{ drop -> 0 0 }>
4958
<{ drop drop -> 0 }>
5059
}#
60+
61+
s" float test" it#{
62+
<{ fdrop -> 0e }>
63+
}#
64+
s" double float test" it#{
65+
<{ fdrop -> 0e }>
66+
<{ fdrop fdrop -> 0e }>
67+
}#
68+
s" double float test" it#{
69+
<{ fdrop -> 0e 0e }>
70+
<{ fdrop fdrop -> 0e 0e }>
71+
}#
72+
s" double float test" it#{
73+
<{ fdrop -> 0e 0e }>
74+
<{ fdrop fdrop -> 0e }>
75+
}#
5176
}#
5277

78+
drop drop drop drop
79+
fdrop fdrop fdrop fdrop
80+
5381
balance$

test/test-stack-underflow.expected

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ float stack unbalanced
1111

1212
<COMPLETEDIN::>0.010 ms
1313

14-
<COMPLETEDIN::>0.015 ms
14+
<COMPLETEDIN::>0.016 ms
1515
cell stack balanced
1616
float stack balanced
1717

@@ -33,32 +33,62 @@ float stack balanced
3333

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

36-
<COMPLETEDIN::>0.007 ms
36+
<COMPLETEDIN::>0.008 ms
3737

3838
<IT::>double test
3939

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

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

44-
<COMPLETEDIN::>1698095100262.642 ms
44+
<COMPLETEDIN::>1698095971439.486 ms
4545

4646
<IT::>double test
4747

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

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

52-
<COMPLETEDIN::>1698095100262.660 ms
52+
<COMPLETEDIN::>1698095971439.504 ms
5353

5454
<IT::>double test
5555

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

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

60-
<COMPLETEDIN::>1698095100262.677 ms
60+
<COMPLETEDIN::>1698095971439.522 ms
61+
62+
<IT::>float test
63+
64+
<FAILED::>Wrong number of float results, expected 1 , got a 1 float stack underflow
65+
66+
<COMPLETEDIN::>0.008 ms
67+
68+
<IT::>double float test
69+
70+
<FAILED::>Wrong number of float results, expected 1 , got a 1 float stack underflow
71+
72+
<FAILED::>Wrong number of float results, expected 1 , got a 2 float stack underflow
73+
74+
<COMPLETEDIN::>0.022 ms
75+
76+
<IT::>double float test
77+
78+
<FAILED::>Wrong number of float results, expected 2 , got a 1 float stack underflow
79+
80+
<FAILED::>Wrong number of float results, expected 2 , got a 2 float stack underflow
81+
82+
<COMPLETEDIN::>0.015 ms
83+
84+
<IT::>double float test
85+
86+
<FAILED::>Wrong number of float results, expected 2 , got a 1 float stack underflow
87+
88+
<FAILED::>Wrong number of float results, expected 1 , got a 2 float stack underflow
89+
90+
<COMPLETEDIN::>0.015 ms
6191

62-
<COMPLETEDIN::>0.065 ms
92+
<COMPLETEDIN::>0.142 ms
6393
cell stack balanced
6494
float stack balanced

0 commit comments

Comments
 (0)