test_clz_push_operation_same_value()
Documentation for tests/osaka/eip7939_count_leading_zeros/test_count_leading_zeros.py::test_clz_push_operation_same_value@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/osaka/eip7939_count_leading_zeros/test_count_leading_zeros.py::test_clz_push_operation_same_value --fork Bogota
Test CLZ opcode returns the same value via different push operations.
Source code in tests/osaka/eip7939_count_leading_zeros/test_count_leading_zeros.py
| @pytest.mark.valid_from("Osaka")
def test_clz_push_operation_same_value(
state_test: StateTestFiller, pre: Alloc
) -> None:
"""Test CLZ opcode returns the same value via different push operations."""
storage = {}
code = Op.SSTORE(0, Op.CLZ(Op.PUSH0))
storage[0x00] = 256
for bit in range(1, 33): # PUSH value
for push_n in range(bit, 33): # PUSHn opcode
op = getattr(Op, f"PUSH{push_n}")
key = 100 * bit + push_n
code += Op.SSTORE(key, Op.CLZ(op[1 << bit]))
storage[key] = 255 - bit
code_address = pre.deploy_contract(code=code)
tx = Transaction(to=code_address, sender=pre.fund_eoa())
post = {
code_address: Account(
storage=storage,
)
}
state_test(pre=pre, post=post, tx=tx)
|
Parametrized Test Cases
This test generates 1 parametrized test case across 3 forks.