use core::cmp;
use core::ops::Range;
use core::usize;
multiplex_alloc!(::alloc::alloc, ::std::alloc);
use crate::arbitrary::*;
use crate::strategy::statics::static_map;
use crate::strategy::*;
arbitrary!(self::alloc::Global; self::alloc::Global);
arbitrary!(self::alloc::Layout, SFnPtrMap<(Range<u8>, StrategyFor<usize>), Self>;
static_map((0u8..32u8, any::<usize>()), |(align_power, size)| {
let align = 1usize << align_power;
let max_size = 0usize.wrapping_sub(align);
self::alloc::Layout::from_size_align(cmp::min(max_size, size), align).unwrap()
})
);
arbitrary!(self::alloc::AllocError, Just<Self>; Just(self::alloc::AllocError));
#[cfg(test)]
mod test {
multiplex_alloc!(::alloc::alloc, ::std::alloc);
no_panic_test!(
layout => self::alloc::Layout,
alloc_err => self::alloc::AllocErr
);
}