Replace an input in the input corpus with a new version.
(&mut self, id: InputId, state: &State)
| 195 | |
| 196 | /// Replace an input in the input corpus with a new version. |
| 197 | pub fn replace_input(&mut self, id: InputId, state: &State) { |
| 198 | self.remove_global_metadata(id); |
| 199 | self.add_to_global_metadata(id, state); |
| 200 | |
| 201 | let entry = &mut self.test_cases[id]; |
| 202 | entry.data.clone_from(&state.input); |
| 203 | entry.metadata.untrimed_len = entry.metadata.len; |
| 204 | entry.metadata.len = state.input.total_bytes() as u64; |
| 205 | entry.metadata.streams = entry.data.count_non_empty_streams() as u64; |
| 206 | entry.metadata.instructions = state.instructions; |
| 207 | |
| 208 | self.replaced.push(id); |
| 209 | } |
| 210 | |
| 211 | pub fn add(&mut self, state: &State) -> InputId { |
| 212 | let id = self.add_data(state.input.clone()); |
no test coverage detected