| 26 | |
| 27 | #[test] |
| 28 | fn std_test() { |
| 29 | let mut halloc = StandardAlloc::default(); |
| 30 | for _i in 1..10 { // heap test |
| 31 | let mut x = <StandardAlloc as Allocator<u8>>::alloc_cell(&mut halloc, 100000); |
| 32 | x.slice_mut()[0] = 4; |
| 33 | let mut y = <StandardAlloc as Allocator<u8>>::alloc_cell(&mut halloc, 110000); |
| 34 | y.slice_mut()[0] = 5; |
| 35 | let mut z = <StandardAlloc as Allocator<u8>>::alloc_cell(&mut halloc, 120000); |
| 36 | z.slice_mut()[0] = 6; |
| 37 | assert_eq!(y.slice()[0], 5); |
| 38 | halloc.free_cell(y); |
| 39 | assert_eq!(x.slice()[0], 4); |
| 40 | assert_eq!(x.slice()[9], 0); |
| 41 | assert_eq!(z.slice()[0], 6); |
| 42 | } |
| 43 | |
| 44 | } |
| 45 | |
| 46 | |
| 47 | #[cfg(feature="unsafe")] |