🐛 Readded check for system instructions in order to pass tests
This commit is contained in:
parent
8ba63d38a3
commit
a8bbc13142
@ -210,9 +210,9 @@ impl Machine {
|
|||||||
/// - **machine** which contains a table of instructions
|
/// - **machine** which contains a table of instructions
|
||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) {
|
||||||
loop {
|
loop {
|
||||||
match Machine::one_instruction(self) {
|
match self.one_instruction() {
|
||||||
Ok(()) => (),
|
Ok(_) => println!("hello"),
|
||||||
Err(e) => panic!("FATAL at pc {} -> {}", self.pc, e)
|
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_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();
|
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);
|
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();
|
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!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
|
||||||
assert!(expected_trace.contains(m.registers_trace.as_str()));
|
assert!(expected_trace.contains(m.registers_trace.as_str()));
|
||||||
|
Loading…
Reference in New Issue
Block a user