Skip to content

test_swapn_on_max_stack()

Documentation for tests/osaka/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_swapn.py::test_swapn_on_max_stack@49a16fac.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_swapn.py::test_swapn_on_max_stack --fork Osaka

Test case out of bounds SWAPN (max stack).

Source code in tests/osaka/eip7692_eof_v1/eip663_dupn_swapn_exchange/test_swapn.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@pytest.mark.parametrize(
    "swapn_operand",
    [
        0,
        2**8 - 1,
    ],
)
@pytest.mark.valid_from(EOF_FORK_NAME)
def test_swapn_on_max_stack(
    swapn_operand: int,
    eof_test: EOFTestFiller,
):
    """Test case out of bounds SWAPN (max stack)."""
    eof_code = Container(
        sections=[
            Section.Code(
                code=sum(Op.PUSH2[v] for v in range(0, MAX_OPERAND_STACK_HEIGHT))
                + Op.SWAPN[swapn_operand]
                + Op.STOP,
            )
        ],
    )
    eof_test(
        container=eof_code,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) swapn_operand
...fork_Osaka-eof_test-swapn_operand_0 0
...fork_Osaka-eof_test-swapn_operand_255 255