Skip to content

Commit

Permalink
feat(tests): Example EVM code type parametrized test
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Jun 18, 2024
1 parent 89f66a4 commit 37a9edc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/frontier/opcodes/test_dup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"""
import pytest

from ethereum_test_forks import Frontier, Homestead
from ethereum_test_forks import EVMCodeType, Frontier, Homestead
from ethereum_test_tools import Account, Alloc, Environment
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools import StateTestFiller, Storage, Transaction
from ethereum_test_tools.eof.v1 import Container


@pytest.mark.parametrize(
Expand All @@ -33,8 +34,10 @@
],
ids=lambda op: str(op),
)
@pytest.mark.with_all_evm_code_types
def test_dup(
state_test: StateTestFiller,
evm_code_type: EVMCodeType,
fork: str,
dup_opcode: Op,
pre: Alloc,
Expand All @@ -58,9 +61,11 @@ def test_dup(
account_code += dup_opcode

# Save each stack value into different keys in storage
account_code += sum(Op.PUSH1(i) + Op.SSTORE for i in range(0x11))
account_code += sum(Op.PUSH1(i) + Op.SSTORE for i in range(0x11)) + Op.STOP

account = pre.deploy_contract(account_code)
account = pre.deploy_contract(
account_code if evm_code_type == EVMCodeType.LEGACY else Container.Code(account_code)
)

tx = Transaction(
ty=0x0,
Expand Down

0 comments on commit 37a9edc

Please sign in to comment.