add unit test for clear screen
This commit is contained in:
parent
d8878ef317
commit
60b52a29c1
1 changed files with 15 additions and 0 deletions
|
@ -515,4 +515,19 @@ mod tests {
|
||||||
// Assert
|
// Assert
|
||||||
assert_eq!(emulator.memory[0x200..0x200 + 132], rom_file_data)
|
assert_eq!(emulator.memory[0x200..0x200 + 132], rom_file_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_execute_clear_screen_instruction() {
|
||||||
|
// Setup
|
||||||
|
let mut emulator = Emulator::new(TerminalDisplay::new(), TerminalSound, NoInput);
|
||||||
|
for i in 10..30 {
|
||||||
|
emulator.display_data[i] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test
|
||||||
|
emulator.execute_instruction(Instruction::new([0x00, 0xE0])).expect("Failed to execute");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assert!(emulator.display_data.iter().all(|&pixel| { pixel == false}))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue