(&mut self, coverage: &CodeCoverage)
| 177 | } |
| 178 | |
| 179 | pub fn has_new(&mut self, coverage: &CodeCoverage) -> HashMap<String, Vec<BranchState>> { |
| 180 | if self.is_empty() { |
| 181 | self.init(coverage); |
| 182 | } |
| 183 | let mut new_branches: HashMap<String, Vec<BranchState>> = HashMap::new(); |
| 184 | let mut visited = HashSet::new(); |
| 185 | for func in coverage.iter_function_covs() { |
| 186 | let func_name = func.get_name(); |
| 187 | if visited.contains(func_name) { |
| 188 | continue; |
| 189 | } |
| 190 | visited.insert(func_name); |
| 191 | let func_states = llvm_branches_to_internal(&func.branches); |
| 192 | if let Some(global_states) = self.branches.get(func_name) { |
| 193 | let has_new = Self::check_branch_states(global_states, &func_states); |
| 194 | if !has_new.is_empty() { |
| 195 | new_branches.insert(func_name.to_string(), has_new); |
| 196 | } |
| 197 | } else { |
| 198 | log::error!("cannot found {func_name} in branch tracking, maybe there is name mangling issue"); |
| 199 | } |
| 200 | } |
| 201 | new_branches |
| 202 | } |
| 203 | |
| 204 | pub fn merge(&mut self, new_branches: &HashMap<String, Vec<BranchState>>) { |
| 205 | for (func, new_branches) in new_branches.iter() { |
no test coverage detected