xref: /relibc/ralloc/tests/box.rs (revision 7e2039cf02971c0450fb490b64f1257f983bea31)
1 extern crate ralloc;
2 
3 fn alloc_box() -> Box<u32> {
4     Box::new(0xDEADBEAF)
5 }
6 
7 #[test]
8 fn test() {
9     let mut a = Box::new(1);
10     let mut b = Box::new(2);
11     let mut c = Box::new(3);
12 
13     assert_eq!(*a, 1);
14     assert_eq!(*b, 2);
15     assert_eq!(*c, 3);
16     assert_eq!(*alloc_box(), 0xDEADBEAF);
17 
18     *a = 0;
19     *b = 0;
20     *c = 0;
21     assert_eq!(*a, 0);
22     assert_eq!(*b, 0);
23     assert_eq!(*c, 0);
24 }
25