♻️ Further simplified tests

This commit is contained in:
François Autin 2023-03-24 18:27:28 +01:00
parent 7bdde70989
commit 88e1921b3c
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

@ -638,7 +638,8 @@ mod test {
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); Machine::run(&mut m);
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();
(m, memory_after, expected_trace) assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
}}; }};
} }
@ -670,64 +671,46 @@ mod test {
#[test] #[test]
fn test_comp() { fn test_comp() {
let (m, memory_after, expected_trace) = init_test!("Comp"); init_test!("Comp")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_add() { fn test_add() {
let (m, memory_after, expected_trace) = init_test!("Add"); init_test!("Add")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_div() { fn test_div() {
let (m, memory_after, expected_trace) = init_test!("Div"); init_test!("Div")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_if() { fn test_if() {
let (m, memory_after, expected_trace) = init_test!("If"); init_test!("If")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_jump() { fn test_jump() {
let (m, memory_after, expected_trace) = init_test!("Jump"); init_test!("Jump")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_mul() { fn test_mul() {
let (m, memory_after, expected_trace) = init_test!("Mult"); init_test!("Mult")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_ret() { fn test_ret() {
let (m, memory_after, expected_trace) = init_test!("Ret"); init_test!("Ret")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_sub() { fn test_sub() {
let (m, memory_after, expected_trace) = init_test!("Sub"); init_test!("Sub")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
#[test] #[test]
fn test_switch() { fn test_switch() {
let (m, memory_after, expected_trace) = init_test!("Switch"); init_test!("Switch")
assert!(mem_cmp::MemChecker::compare_machine_memory(&memory_after, &m));
assert!(expected_trace.contains(m.registers_trace.as_str()));
} }
} }