1 extern crate ralloc; 2 3 #[global_allocator] 4 static ALLOCATOR: ralloc::Allocator = ralloc::Allocator; 5 6 mod util; 7 8 #[inline(never)] 9 fn alloc_box() -> Box<u32> { 10 Box::new(0xDEADBEAF) 11 } 12 13 #[test] 14 fn simple_box() { 15 util::multiply(|| { 16 let mut a = Box::new(1); 17 let mut b = Box::new(2); 18 let mut c = Box::new(3); 19 20 assert_eq!(*a, 1); 21 assert_eq!(*b, 2); 22 assert_eq!(*c, 3); 23 assert_eq!(*alloc_box(), 0xDEADBEAF); 24 25 util::acid(|| { 26 *a = 0; 27 *b = 0; 28 *c = 0; 29 }); 30 assert_eq!(*a, 0); 31 assert_eq!(*b, 0); 32 assert_eq!(*c, 0); 33 }); 34 } 35