diff --git a/tests/disassembler/asm.py b/tests/disassembler/asm.py index 4c9a9ee2..1bd3c286 100644 --- a/tests/disassembler/asm.py +++ b/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