trevors_chip8_toy/gemma/tests/computer_tests.rs

23 lines
706 B
Rust

use gemma::chip8::computer::Chip8Computer;
#[test]
fn smoke() { assert!(true) }
#[test]
fn test_rom_1_works() {
let mut x = Chip8Computer::new();
// Load the IBM rom and run it.
// it takes 39 cycles to get to the end so lets run it 40.
let test_rom_to_run = std::fs::read("../resources/roms/2-ibm-logo.ch8").unwrap();
x.load_bytes_to_memory(0x200, test_rom_to_run.into());
for i in 0..40 {
x.step_system();
}
// ...then verify that the current video memory of the chip-8
// simulator matches what we expect it to be
assert_eq!(x.dump_video_to_string(), std::fs::read_to_string("../resources/test/gemma_integration_ibm_rom_output.asc").unwrap());
}