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()));