add find sequence test

pull/603/head
Joran Honig 6 years ago
parent c4da715477
commit c4c9e56c6a
  1. 16
      tests/disassembler/asm.py

@ -42,3 +42,19 @@ def test_is_sequence_match(pattern, instruction_list, index, expected_result):
return_value = is_sequence_match(pattern, instruction_list, index)
# Assert
assert return_value == expected_result
find_sequence_match_test_data = [
# Normal no match
((["PUSH1"], ["EQ"]), [{"opcode": "PUSH1"}, {"opcode": "PUSH3"}, {"opcode": "EQ"}], []),
# Normal match
((["PUSH1"], ["EQ"]), [{"opcode": "PUSH1"}, {"opcode": "PUSH1"}, {"opcode": "EQ"}, {"opcode": "PUSH1"}, {"opcode": "EQ"}], [1, 3]),
]
@pytest.mark.parametrize("pattern, instruction_list, expected_result", find_sequence_match_test_data)
def test_find_op_code_sequence(pattern, instruction_list, expected_result):
# Act
return_value = list(find_op_code_sequence(pattern, instruction_list))
# Assert
assert return_value == expected_result

Loading…
Cancel
Save