1
0
mirror of https://github.com/bspeice/qadapt synced 2025-08-27 09:46:47 -04:00

no_std for the time being

Impossible to maintain long-term because of backtrace crate/thread ID
This commit is contained in:
2018-09-22 17:26:52 -04:00
parent aafec768ca
commit 5755eccae7
4 changed files with 52 additions and 32 deletions

View File

@ -25,20 +25,20 @@ struct NonEmpty {
#[test]
fn allocation_flag() {
A.clear_allocations();
assert!(!A.has_allocated.load(Ordering::SeqCst));
assert!(!A.has_allocated());
let _x = 24;
assert!(!A.has_allocated.load(Ordering::SeqCst));
assert!(!A.has_allocated());
let _x = Empty {};
assert!(!A.has_allocated.load(Ordering::SeqCst));
assert!(!A.has_allocated());
let _x = NonEmpty {
_x: 42,
_y: 84
};
assert!(!A.has_allocated.load(Ordering::SeqCst));
assert!(!A.has_allocated());
let _x = Box::new(42);
assert!(A.has_allocated.load(Ordering::SeqCst));
assert!(A.has_allocated());
}

View File

@ -8,7 +8,13 @@ static A: QADAPT = QADAPT::INIT;
#[test]
fn init() {
// Make sure that we don't have any allocations at the start
// that pollute other tests
assert!(!A.has_allocated.load(Ordering::SeqCst));
// 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());
}