1
0
mirror of https://github.com/bspeice/qadapt synced 2024-09-21 09:21:30 -04:00
qadapt/tests/assert_macro.rs

27 lines
375 B
Rust

use qadapt::assert_no_alloc;
use qadapt::QADAPT;
#[global_allocator]
static Q: QADAPT = QADAPT;
#[test]
fn math() {
let x = assert_no_alloc!(2 + 2);
assert_eq!(x, 4);
}
fn early_return() -> usize {
assert_no_alloc!(return 8)
}
fn into_box() -> Box<usize> {
Box::new(early_return())
}
#[test]
#[should_panic]
fn early_return_boxing() {
into_box();
}