Skip to content

Commit

Permalink
test memory dump
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantoineg committed May 2, 2024
1 parent d869286 commit cd1a790
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,22 @@ mod tests {

assert_eq!(mem.memory[0x8000..0x8005], program);
}

#[test]
fn test_hex_dump_debug_on() {
let mut mem = Memory::new();
mem.set_debug();
mem.load_program(vec![0x01, 0x02]);
mem.read(0x8000);

assert_eq!(mem.dump(), &vec![0x01]);
}

#[test]
fn test_hex_dump_debug_off() {
let mut mem = Memory::new();
mem.load_program(vec![0x01, 0x02]);
mem.read(0x8000);
assert_eq!(mem.dump(), &vec![]);
}
}

0 comments on commit cd1a790

Please sign in to comment.