Skip to content

Commit

Permalink
Add PeterLemon cartridge/banking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
twvd committed Dec 13, 2023
1 parent 25b84fe commit 1e9a4ff
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod peterlemon_65816;
pub mod peterlemon_bank;
pub mod peterlemon_ppu;
pub mod processortests_65816;
pub mod processortests_spc700;
Expand All @@ -14,10 +15,10 @@ use crate::snes::cpu_65816::cpu::Cpu65816;
use crate::snes::joypad::Joypad;
use crate::snes::ppu::{SCREEN_HEIGHT, SCREEN_WIDTH};

fn test_display(rom: &[u8], pass_hash: &[u8], time_limit: u128, stable: bool) {
fn test_display(rom: &[u8], pass_hash: &[u8], time_limit: u128, stable: bool, hirom: bool) {
let (display, dispstatus) = TestRenderer::new_test(SCREEN_WIDTH, SCREEN_HEIGHT);
let (joypads, _) = Joypad::new_channel_all();
let cart = Cartridge::load_nohdr(rom, false);
let cart = Cartridge::load_nohdr(rom, hirom);
let bus = Mainbus::<TestRenderer>::new(cart, BusTrace::None, display, joypads, false);
let reset = bus.read16(0xFFFC);
let mut cpu = Cpu65816::<Mainbus<TestRenderer>>::new(bus, reset);
Expand Down
1 change: 1 addition & 0 deletions src/test/peterlemon_65816.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ macro_rules! test {
&hex!($hash),
20000,
true,
false,
);
}
};
Expand Down
59 changes: 59 additions & 0 deletions src/test/peterlemon_bank.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
use super::test_display;

use hex_literal::hex;

macro_rules! lorom_test {
($testname:ident, $testfn:expr, $hash:expr) => {
#[allow(non_snake_case)]
#[test]
fn $testname() {
test_display(
include_bytes!(concat!("../../../siena_tests/SNES/BANK/", $testfn)),
&hex!($hash),
60000,
true,
false,
);
}
};
}
macro_rules! hirom_test {
($testname:ident, $testfn:expr, $hash:expr) => {
#[allow(non_snake_case)]
#[test]
fn $testname() {
test_display(
include_bytes!(concat!("../../../siena_tests/SNES/BANK/", $testfn)),
&hex!($hash),
60000,
true,
true,
);
}
};
}
hirom_test!(
BANKHiROMFastROM,
"HiROMFastROM/BANKHiROMFastROM.sfc",
"2ab4871e60935c6fcaf06a40849912f7b8ad23f8e850bb0f03d2576e96664536"
);
hirom_test!(
BANKHiROMSlowROM,
"HiROMSlowROM/BANKHiROMSlowROM.sfc",
"36ab039767172d7a452d6337f7703627e912e8ffc833b10e3eb3467b1cc38e60"
);
lorom_test!(
BANKLoROMFastROM,
"LoROMFastROM/BANKLoROMFastROM.sfc",
"1f2385252686bc02246eed8d670ee46d1bd01e25ad3c0a217dcb84a180e2f045"
);
lorom_test!(
BANKLoROMSlowROM,
"LoROMSlowROM/BANKLoROMSlowROM.sfc",
"89b0ae2ce790bceaa0ea97f780b78e69546e812c0539a39b810d6e87f7d2f379"
);
lorom_test!(
BANKWRAM,
"WRAM/BANKWRAM.sfc",
"c54861d958c14c00b9eadfe2727b0ce9c4b6e25411cf1b833efe337714b61a6c"
);
2 changes: 2 additions & 0 deletions src/test/peterlemon_ppu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ macro_rules! ppu_test {
&hex!($hash),
60000,
true,
false,
);
}
};
Expand All @@ -27,6 +28,7 @@ macro_rules! ppu_test_ns {
&hex!($hash),
60000,
false,
false,
);
}
};
Expand Down

0 comments on commit 1e9a4ff

Please sign in to comment.