From a8bbc131428fc5e30a52242620fc1197f2afa4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Mon, 27 Mar 2023 10:34:10 +0200 Subject: [PATCH] :bug: Readded check for system instructions in order to pass tests --- src/simulator/machine.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/simulator/machine.rs b/src/simulator/machine.rs index 4c7ea58..56224ea 100644 --- a/src/simulator/machine.rs +++ b/src/simulator/machine.rs @@ -210,9 +210,9 @@ impl Machine { /// - **machine** which contains a table of instructions pub fn run(&mut self) { loop { - match Machine::one_instruction(self) { - Ok(()) => (), - Err(e) => panic!("FATAL at pc {} -> {}", self.pc, e) + match self.one_instruction() { + Ok(_) => println!("hello"), + Err(e) => { if e.to_string().contains("System") { break; } panic!("FATAL at pc {} -> {}", self.pc, e) } } } } @@ -654,7 +654,7 @@ mod test { let memory_before = mem_cmp::MemChecker::from(get_full_path!("memory", $a)).unwrap(); let memory_after = mem_cmp::MemChecker::from(get_full_path!("memory", &end_file_name)).unwrap(); mem_cmp::MemChecker::fill_memory_from_mem_checker(&memory_before, &mut m); - Machine::run(&mut m); + m.run(); let expected_trace = fs::read_to_string(get_full_path!("reg_trace", $a)).unwrap(); assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m)); assert!(expected_trace.contains(m.registers_trace.as_str()));