mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
test address is in expected bounds
This commit is contained in:
parent
20c8541e36
commit
066088a74c
15
src/lib.rs
15
src/lib.rs
|
@ -149,11 +149,18 @@ mod test {
|
|||
#[test_case]
|
||||
fn ewram_static_test(_gba: &mut Gba) {
|
||||
unsafe {
|
||||
let content = (&EWRAM_TEST as *const u32).read_volatile();
|
||||
let ewram_ptr = &mut EWRAM_TEST as *mut u32;
|
||||
let content = ewram_ptr.read_volatile();
|
||||
assert_eq!(content, 5, "expected data in ewram to be 5");
|
||||
(&mut EWRAM_TEST as *mut u32).write_volatile(content + 1);
|
||||
let content = (&EWRAM_TEST as *const u32).read_volatile();
|
||||
assert_eq!(content, 6, "expected data to have increased by one")
|
||||
ewram_ptr.write_volatile(content + 1);
|
||||
let content = ewram_ptr.read_volatile();
|
||||
assert_eq!(content, 6, "expected data to have increased by one");
|
||||
let address = ewram_ptr as usize;
|
||||
assert!(
|
||||
address >= 0x0200_0000 && address < 0x0204_0000,
|
||||
"ewram is located between 0x0200_0000 and 0x0204_0000, address was actually found to be {:#010X}",
|
||||
address
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue