()
| 198 | } |
| 199 | #[test] |
| 200 | fn uninitialized_global_pool_test() { |
| 201 | { |
| 202 | let mut ags = GlobalAllocatedFreelist::<u8>::new_allocator(uninitialized); |
| 203 | unsafe { |
| 204 | bind_global_buffers_to_allocator!(ags, global_buffer, u8); |
| 205 | } |
| 206 | { |
| 207 | let mut x = ags.alloc_cell(9999); |
| 208 | x.slice_mut()[0] = 4; |
| 209 | let mut y = ags.alloc_cell(4); |
| 210 | y[0] = 5; |
| 211 | ags.free_cell(y); |
| 212 | |
| 213 | let mut three = ags.alloc_cell(3); |
| 214 | three[0] = 6; |
| 215 | ags.free_cell(three); |
| 216 | |
| 217 | let mut z = ags.alloc_cell(4); |
| 218 | z.slice_mut()[1] = 8; |
| 219 | let mut reget_three = ags.alloc_cell(4); |
| 220 | reget_three.slice_mut()[1] = 9; |
| 221 | //y.mem[0] = 6; // <-- this is an error (use after free) |
| 222 | assert_eq!(x[0], 4); |
| 223 | assert_eq!(z[0], 6); |
| 224 | assert_eq!(z[1], 8); |
| 225 | assert_eq!(reget_three[0], 0); |
| 226 | assert_eq!(reget_three[1], 9); |
| 227 | let mut _z = ags.alloc_cell(1); |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | #[test] |
| 233 | fn stack_pool_test() { |
nothing calls this directly
no test coverage detected