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

32 lines
502 B
Rust

extern crate qadapt;
use qadapt::QADAPT;
use qadapt::allocate_panic;
#[global_allocator]
static Q: QADAPT = QADAPT;
#[allocate_panic]
fn allocates() {
assert_eq!(::qadapt::protection_level(), 1);
let mut v = Vec::new();
v.push(1);
}
#[allocate_panic]
fn no_allocate() {
assert_eq!(::qadapt::protection_level(), 1);
let _v: Vec<()> = Vec::with_capacity(0);
}
#[test]
fn test_no_allocate() {
no_allocate();
}
#[test]
#[should_panic]
fn test_allocates() {
allocates();
}