mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 00:01:34 +11:00
move single file module out of directory
This commit is contained in:
parent
10575f28a6
commit
fb247aa8f2
|
@ -142,3 +142,28 @@ impl<'a, T> DerefMut for LockGuard<'a, T> {
|
|||
#[no_mangle]
|
||||
#[inline(always)]
|
||||
pub unsafe extern "C" fn __sync_synchronize() {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
#[derive(Default)]
|
||||
#[allow(dead_code)]
|
||||
struct Storage([u32; 16 / 4]);
|
||||
|
||||
#[test_case]
|
||||
fn check_init_once(_: &mut crate::Gba) {
|
||||
static CELL: OnceCell<Storage> = OnceCell::new();
|
||||
|
||||
core::hint::black_box(CELL.get_or_init(Default::default));
|
||||
}
|
||||
|
||||
#[test_case]
|
||||
fn check_init_once_many(_: &mut crate::Gba) {
|
||||
static CELL: OnceCell<Storage> = OnceCell::new();
|
||||
|
||||
for _ in 0..1000 {
|
||||
core::hint::black_box(CELL.get_or_init(Default::default));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue