()
| 144 | |
| 145 | #[test] |
| 146 | fn test_array_write() { |
| 147 | let mut arrays = TeamArrayInfo::new(); |
| 148 | |
| 149 | // Writing is OK. |
| 150 | for index in 0..COMMUNICATION_ARRAY_LENGTH { |
| 151 | assert!(arrays.write(Planet::Earth, index, index as i32).is_ok()); |
| 152 | assert!(arrays.write(Planet::Mars, index, index as i32).is_ok()); |
| 153 | } |
| 154 | |
| 155 | // Read the values you wrote.. |
| 156 | let earth_first = arrays.first_array(Planet::Earth).clone(); |
| 157 | let earth_last = arrays.last_array(Planet::Earth).clone(); |
| 158 | let mars_first = arrays.first_array(Planet::Mars).clone(); |
| 159 | let mars_last = arrays.last_array(Planet::Mars).clone(); |
| 160 | for index in 0..COMMUNICATION_ARRAY_LENGTH { |
| 161 | assert_eq!(earth_first[index], index as i32); |
| 162 | assert_eq!(earth_last[index], 0); |
| 163 | assert_eq!(mars_first[index], index as i32); |
| 164 | assert_eq!(mars_last[index], 0); |
| 165 | } |
| 166 | |
| 167 | // Error when writing out of bounds. |
| 168 | let oob_index = COMMUNICATION_ARRAY_LENGTH; |
| 169 | assert_err!(arrays.write(Planet::Earth, oob_index, 0), GameError::ArrayOutOfBounds); |
| 170 | assert_err!(arrays.write(Planet::Mars, oob_index, 0), GameError::ArrayOutOfBounds); |
| 171 | } |
| 172 | |
| 173 | #[test] |
| 174 | fn test_array_end_round_filter() { |
nothing calls this directly
no test coverage detected