Fixed tests from mem_cmp

This commit is contained in:
François Autin 2023-03-13 23:55:35 +01:00
parent 65ac9c6f06
commit 9318871c31

View File

@ -279,44 +279,16 @@ fn two_hex_to_u8(c1: char, c2: char) -> u8 {
16*a + b 16*a + b
} }
/*
* Juste pour voir si via BufReader les \n sont présent, apres test il s'avère que non
* De toute facon on limitera d'une section la lecture par len
*/
fn test_show_sections_file(){
let file = fs::File::open("test_file_section.txt").expect("Wrong filename");
let reader = BufReader::new(file);
for line in reader.lines() {
//println!("Tailles de la ligne : {}",
let current = line.unwrap();
//println!("Taille de la ligne : {}", current.len()); // En effet pas de \n dans chaque line, parfait
println!("{}", &current);
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
#[test] #[test]
fn test_fill_memory(){ fn test_fill_memory(){
let path = "osef".to_string(); let m_c = MemChecker::from("test/machine/memory.txt").unwrap();
let m_c = MemChecker::from(&path).unwrap();
let mut machine = Machine::init_machine(); let mut machine = Machine::init_machine();
MemChecker::fill_memory_from_mem_checker(&m_c, &mut machine); MemChecker::fill_memory_from_mem_checker(&m_c, &mut machine);
print!("\n Comparing memory from loaded context\n\n");
MemChecker::compare_print_m_c_machine(&m_c, &mut machine); MemChecker::compare_print_m_c_machine(&m_c, &mut machine);
} }
#[test] #[test]
@ -330,8 +302,7 @@ mod tests {
#[test] #[test]
fn test_create_mem_checker(){ fn test_create_mem_checker(){
let path: String = "osef".to_string(); let m_c = MemChecker::from("test/machine/memory.txt").unwrap();
let m_c = MemChecker::from(&path).unwrap();
MemChecker::print_mem_checker(&m_c); MemChecker::print_mem_checker(&m_c);
} }
@ -346,12 +317,6 @@ mod tests {
assert_eq!(expected,result); assert_eq!(expected,result);
} }
#[test]
fn tmp_fct_read_file(){
println!("Reading A file \n");
test_show_sections_file();
}
#[test] #[test]
fn test_create_section_content(){ fn test_create_section_content(){
let section_format = SectionFormat{ let section_format = SectionFormat{