1
0
mirror of https://github.com/bspeice/qadapt synced 2024-11-21 21:38:10 -05:00

More tests

This commit is contained in:
Bradlee Speice 2018-09-22 19:57:58 -04:00
parent 5755eccae7
commit 6c3ebfa433

View File

@ -42,3 +42,29 @@ fn allocation_flag() {
let _x = Box::new(42); let _x = Box::new(42);
assert!(A.has_allocated()); assert!(A.has_allocated());
} }
#[inline(never)]
fn no_op() {}
#[test]
fn no_alloc_during_noop() {
A.clear_allocations();
assert!(!A.has_allocated());
no_op();
assert!(!A.has_allocated());
}
#[inline(never)]
fn allocates() {
let _x = Box::new(42);
}
#[test]
fn alloc_during_func_call() {
A.clear_allocations();
assert!(!A.has_allocated());
allocates();
assert!(A.has_allocated());
}