1
0
mirror of https://github.com/bspeice/qadapt synced 2024-09-21 09:21:30 -04:00
qadapt/tests/initial.rs
Bradlee Speice 5755eccae7 no_std for the time being
Impossible to maintain long-term because of backtrace crate/thread ID
2018-09-22 17:26:52 -04:00

20 lines
472 B
Rust

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());
}