1
0
mirror of https://github.com/bspeice/qadapt synced 2024-11-14 18:18:08 -05:00
qadapt/tests/initial.rs

20 lines
472 B
Rust
Raw Normal View History

extern crate qadapt;
use qadapt::QADAPT;
use std::sync::atomic::Ordering;
#[global_allocator]
static A: QADAPT = QADAPT::INIT;
#[test]
fn init() {
// Because the Allocator and its internals isn't the only "pre-main" allocation
// that happens, when starting up we expect to see that A has in fact allocated
assert!(A.has_allocated());
A.clear_allocations();
assert!(!A.has_allocated());
let _x = Box::new(42);
assert!(A.has_allocated());
}