use super::mock_test_prelude::*;
use crate::plan::AllocationSemantics;
#[test]
pub fn allocate_nonmoving() {
with_mockvm(
|| -> MockVM {
MockVM {
is_collection_enabled: MockMethod::new_fixed(Box::new(|_| false)),
..MockVM::default()
}
},
|| {
const MB: usize = 1024 * 1024;
let mut fixture = MutatorFixture::create_with_heapsize(MB);
let addr =
memory_manager::alloc(&mut fixture.mutator, 16, 8, 0, AllocationSemantics::Default);
assert!(!addr.is_zero());
info!("Allocated default at: {:#x}", addr);
let addr = memory_manager::alloc(
&mut fixture.mutator,
16,
8,
0,
AllocationSemantics::NonMoving,
);
assert!(!addr.is_zero());
info!("Allocated nonmoving at: {:#x}", addr);
},
no_cleanup,
)
}