From 19ae021e3c221f9272dfd5a65e61625614c0d5a6 Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Fri, 29 Sep 2023 19:10:52 +0200 Subject: [PATCH] deal with illegal arguments in test instruction explicitly --- triton-vm/src/instruction.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/triton-vm/src/instruction.rs b/triton-vm/src/instruction.rs index 873cb8169..929451da1 100644 --- a/triton-vm/src/instruction.rs +++ b/triton-vm/src/instruction.rs @@ -501,7 +501,7 @@ const fn all_instructions_without_args() -> [AnInstruction; Instr Push(BFIELD_ZERO), Divine, Dup(ST0), - Swap(ST1), + Swap(ST0), Nop, Skiz, Call(BFIELD_ZERO), @@ -814,6 +814,7 @@ mod instruction_tests { #[test] fn instructions_act_on_op_stack_as_indicated() { for test_instruction in all_instructions_without_args() { + let test_instruction = replace_illegal_arguments_in_instruction(test_instruction); let (program, stack_size_before_test_instruction) = construct_test_program_for_instruction(test_instruction); let stack_size_after_test_instruction = terminal_op_stack_size_for_program(program); @@ -827,6 +828,15 @@ mod instruction_tests { } } + fn replace_illegal_arguments_in_instruction( + instruction: AnInstruction, + ) -> AnInstruction { + match instruction { + Swap(ST0) => Swap(ST1), + _ => instruction, + } + } + fn construct_test_program_for_instruction( instruction: AnInstruction, ) -> (Program, usize) {