1#![no_std]
2
3include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
4
5#[cfg(test)]
6mod tests {
7 use core::ptr::null_mut;
8
9 use super::*;
10
11 #[test]
12 fn alloc() {
13 let buf = unsafe { KanameShiki_Alloc(32) };
14 assert_ne!(buf, null_mut());
15 }
16
17 #[test]
18 fn free() {
19 let buf = unsafe { KanameShiki_Alloc(32) };
20 assert_ne!(buf, null_mut());
21
22 unsafe {
23 KanameShiki_Free(buf);
24 }
25 }
26
27 #[test]
28 fn aligned() {
29 let buf = unsafe { KanameShiki_Align(4, 128) };
30 assert_ne!(buf, null_mut());
31 }
32
33 #[test]
34 fn realloc() {
35 let buf = unsafe { KanameShiki_Alloc(32) };
36 assert_ne!(buf, null_mut());
37
38 let new_buf = unsafe { KanameShiki_ReAlloc(buf, 64) };
39 assert_ne!(new_buf, null_mut());
40 }
41
42 #[test]
43 fn realloc_free() {
44 let buf = unsafe { KanameShiki_Alloc(32) };
45 assert_ne!(buf, null_mut());
46
47 let new_buf = unsafe { KanameShiki_ReAlloc(buf, 128) };
48 assert_ne!(new_buf, null_mut());
49
50 unsafe {
51 KanameShiki_Free(new_buf);
52 }
53 }
54}