Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Nov 5, 2024
1 parent eea465f commit 98d3b74
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def test_all_opcodes_stack_overflow(
sorted(data_portion_opcodes),
)
@pytest.mark.parametrize(
"any_imm",
"trunc_all",
[False, True],
)
@pytest.mark.parametrize(
Expand All @@ -419,7 +419,7 @@ def test_all_opcodes_stack_overflow(
def test_truncated_data_portion_opcodes(
eof_test: EOFTestFiller,
opcode: Opcode,
any_imm: bool,
trunc_all: bool,
compute_max_stack_height: bool,
):
"""
Expand All @@ -428,11 +428,11 @@ def test_truncated_data_portion_opcodes(
"""
opcode_with_data_portion: bytes = bytes(opcode[1])

if len(opcode_with_data_portion) == 2 and any_imm:
if len(opcode_with_data_portion) == 2 and trunc_all:
pytest.skip("can only be truncated one-way")

# Compose imm bytes 1 byte shorter than expected, or empty.
opcode_bytes = opcode_with_data_portion[:-1] if any_imm else opcode_with_data_portion[0:1]
# Compose instruction bytes with empty imm bytes (trunc_all) or 1 byte shorter imm bytes.
opcode_bytes = opcode_with_data_portion[0:1] if trunc_all else opcode_with_data_portion[:-1]

if opcode.min_stack_height > 0:
opcode_bytes = bytes(Op.PUSH0 * opcode.min_stack_height) + opcode_bytes
Expand Down

0 comments on commit 98d3b74

Please sign in to comment.