forked from Rativel/BurritOS
add tests run programs
This commit is contained in:
@@ -2,6 +2,7 @@ use std::fs;
|
||||
use std::io::BufRead;
|
||||
use std::io::BufReader;
|
||||
use std::io::Lines;
|
||||
use std::io::Read;
|
||||
use crate::Machine;
|
||||
|
||||
const MEM_SIZE : usize = 4096;
|
||||
@@ -186,7 +187,7 @@ impl MemChecker{
|
||||
pub fn fill_memory_from_mem_checker(m_c: &MemChecker, machine: &mut Machine){
|
||||
|
||||
machine.sp = m_c.sp;
|
||||
machine.int_reg.set_reg(2, m_c.pc as i64);
|
||||
machine.int_reg.set_reg(2, m_c.sp as i64);
|
||||
machine.pc = m_c.pc as u64;
|
||||
|
||||
|
||||
@@ -228,11 +229,10 @@ impl MemChecker{
|
||||
/// - **machine** contains the main memory
|
||||
pub fn compare_machine_memory(m_c: &MemChecker, machine: &Machine) -> bool {
|
||||
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)
|
||||
(0..section.len).into_iter().all(|i| machine.main_memory[section.addr + i] == section.content[i])
|
||||
}).all(|e| e)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user