remade compare_machine_memory

This commit is contained in:
Rémi Rativel 2023-03-08 13:34:12 +01:00
parent 58890d85d1
commit de0013ad3e

View File

@ -220,17 +220,16 @@ impl MemChecker{
}
/// Compare sections of a memChecker and a machine memory
///
/// ### Parameters
///
/// - **m_c** contains section of the memory checker
/// - **machine** contains the main memory
pub fn compare_machine_memory(m_c: &MemChecker, machine: &Machine) -> bool {
for section in m_c.sections.iter() {
for i in 0..section.len {
if machine.main_memory[section.addr + i] != section.content[i] {
return false;
}
}
}
return true;
m_c.sections.iter().map(|section| {
!(0..section.len).into_iter().all(|i| machine.main_memory[section.addr + i] == section.content[i])
}).all(|e| e == true)
}