mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
add test that atomic read / write works
This commit is contained in:
parent
2b4c4459e0
commit
9fbd420089
|
@ -364,6 +364,8 @@ pub fn profiler(timer: &mut crate::timer::Timer, period: u16) -> InterruptHandle
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use portable_atomic::AtomicU8;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test_case]
|
#[test_case]
|
||||||
|
@ -381,4 +383,14 @@ mod tests {
|
||||||
assert_eq!(INTERRUPTS_ENABLED.get(), 0);
|
assert_eq!(INTERRUPTS_ENABLED.get(), 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test_case]
|
||||||
|
fn atomic_check(_gba: &mut crate::Gba) {
|
||||||
|
static ATOMIC: AtomicU8 = AtomicU8::new(8);
|
||||||
|
|
||||||
|
for i in 0..=255 {
|
||||||
|
ATOMIC.store(i, Ordering::SeqCst);
|
||||||
|
assert_eq!(ATOMIC.load(Ordering::SeqCst), i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue