Always check the address to make sure that things work as expected

This commit is contained in:
Gwilym Inzani 2023-10-17 23:51:40 +01:00
parent 5feb67285d
commit ce233f7d62

View file

@ -8,12 +8,18 @@ fn hello() {}
#[test_case] #[test_case]
fn multiboot_test(_gba: &mut agb::Gba) { fn multiboot_test(_gba: &mut agb::Gba) {
let address: usize = hello as usize;
if option_env!("AGB_MULTIBOOT").is_some() { if option_env!("AGB_MULTIBOOT").is_some() {
let address = hello as usize;
assert!( assert!(
(0x0200_0000..0x0204_0000).contains(&address), (0x0200_0000..0x0204_0000).contains(&address),
"multiboot functions should all be in ewram 0x0300_0000 and 0x0300_8000, but was actually found to be at {address:#010X}" "multiboot functions should all be in ewram 0x0300_0000 and 0x0300_8000, but was actually found to be at {address:#010X}"
); );
} else {
assert!(
address >= 0x0800_0000,
"functions should all be in ROM >= 0x0800_0000, but was actually found to be at {address:#010X}"
);
} }
} }