Skip to content

Commit fe6abd9

Browse files
authored
fix(tests): de-duplicate EOF stack underflow tests (#1392)
1 parent d3dfac5 commit fe6abd9

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

tests/osaka/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_dupn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_dupn_all_valid_immediates(eof_state_test: EOFStateTestFiller):
5555
@pytest.mark.parametrize(
5656
"stack_height,max_stack_height",
5757
[
58-
[0, 0],
58+
# [0, 0] is tested in test_all_opcodes_stack_underflow()
5959
[0, 1],
6060
[1, 1],
6161
[1, 2],

tests/osaka/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_exchange.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ def test_exchange_all_valid_immediates(eof_state_test: EOFStateTestFiller):
6565
@pytest.mark.parametrize(
6666
"stack_height,x,y",
6767
[
68-
# 2 and 3 are the lowest valid values for x and y, which translates to a
69-
# zero immediate value.
70-
pytest.param(0, 2, 3, id="stack_height=0_n=1_m=1"),
68+
# 2 and 3 are the lowest valid values for x and y,
69+
# which translates to the zero immediate value.
70+
# (0, 2, 3) is tested in test_all_opcodes_stack_underflow()
7171
pytest.param(1, 2, 3, id="stack_height=1_n=1_m=1"),
7272
pytest.param(2, 2, 3, id="stack_height=2_n=1_m=1"),
7373
pytest.param(17, 2, 18, id="stack_height=17_n=1_m=16"),
7474
pytest.param(17, 17, 18, id="stack_height=17_n=16_m=1"),
7575
pytest.param(32, 17, 33, id="stack_height=32_n=16_m=16"),
7676
],
7777
)
78-
def test_exchange_all_invalid_immediates(
78+
def test_exchange_stack_underflow(
7979
eof_test: EOFTestFiller,
8080
stack_height: int,
8181
x: int,
8282
y: int,
8383
):
84-
"""Test case for all invalid EXCHANGE immediates."""
84+
"""Test case the EXCHANGE causing stack underflow."""
8585
eof_code = Container(
8686
sections=[
8787
Section.Code(

tests/osaka/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_swapn.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def test_swapn_stack_underflow(
9999
code=sum(Op.PUSH2[v] for v in range(0, stack_height))
100100
+ Op.SWAPN[stack_height]
101101
+ Op.STOP,
102-
max_stack_height=stack_height,
102+
# This is also tested in test_all_opcodes_stack_underflow()
103+
# so make it differ by the declared stack height.
104+
max_stack_height=stack_height + 1,
103105
)
104106
],
105107
)

0 commit comments

Comments
 (0)