🐛 Readded check for system instructions in order to pass tests

This commit is contained in:
François Autin 2023-03-27 10:34:10 +02:00
parent 8ba63d38a3
commit a8bbc13142
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

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