| 130 | iter_mut_test(); |
| 131 | |
| 132 | fn basic_test() { |
| 133 | let mut list = List::new(); |
| 134 | list.push(1); list.push(2); list.push(3); |
| 135 | |
| 136 | assert_eq!(list.len(), 3); |
| 137 | assert_eq!(list.is_empty(), false); |
| 138 | assert_eq!(list.pop(), Some(3)); |
| 139 | assert_eq!(list.peek(), Some(&2)); |
| 140 | assert_eq!(list.peek_mut(), Some(&mut 2)); |
| 141 | |
| 142 | list.peek_mut().map(|val| { |
| 143 | *val = 4; |
| 144 | }); |
| 145 | assert_eq!(list.peek(), Some(&4)); |
| 146 | |
| 147 | list.clear(); |
| 148 | println!("basics test Ok!"); |
| 149 | } |
| 150 | |
| 151 | fn into_iter_test() { |
| 152 | let mut list = List::new(); |