ajout de fichiers mémoire et des registre en cours d'execution

This commit is contained in:
amaury 2023-03-13 19:00:54 +01:00
parent edf52a7b63
commit c0765270d7
26 changed files with 10 additions and 74 deletions

View File

@ -757,7 +757,7 @@ 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("test/machine/memoryCompTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceComp.txt").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()));
@ -771,7 +771,7 @@ 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("test/machine/memoryDivTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceDiv.txt").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()));
@ -785,7 +785,7 @@ 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("test/machine/memoryIfTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceIf.txt").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()));
@ -799,7 +799,7 @@ 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("test/machine/memoryJumpTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceJump.txt").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()));
@ -808,12 +808,12 @@ mod test {
#[test] #[test]
fn test_mul() { fn test_mul() {
let mut m = Machine::init_machine(); let mut m = Machine::init_machine();
let memory_before = mem_cmp::MemChecker::from("test/machine/memoryMul.txt").unwrap(); let memory_before = mem_cmp::MemChecker::from("test/machine/memoryMult.txt").unwrap();
let memory_after = mem_cmp::MemChecker::from("test/machine/memoryMulEnd.txt").unwrap(); let memory_after = mem_cmp::MemChecker::from("test/machine/memoryMultEnd.txt").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); Machine::run(&mut m);
let expected_trace = fs::read_to_string("test/machine/memoryMulTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceMult.txt").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()));
@ -827,7 +827,7 @@ 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("test/machine/memoryRetTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceRet.txt").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()));
@ -841,7 +841,7 @@ 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("test/machine/memorySubTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceSub.txt").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()));
@ -855,7 +855,7 @@ 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("test/machine/memorySwitchTrace.txt").unwrap(); let expected_trace = fs::read_to_string("test/machine/reg_traceSwitch.txt").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()));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long