(
&self,
func: &str,
cov_cache: &HashMap<String, (u32, u32)>,
visited: &mut HashSet<String>,
)
| 303 | } |
| 304 | |
| 305 | fn get_func_branch_coverage( |
| 306 | &self, |
| 307 | func: &str, |
| 308 | cov_cache: &HashMap<String, (u32, u32)>, |
| 309 | visited: &mut HashSet<String>, |
| 310 | ) -> eyre::Result<(u32, u32)> { |
| 311 | visited.insert(func.to_string()); |
| 312 | if let Some((func_covered, func_total)) = cov_cache.get(func) { |
| 313 | let callees = get_lib_call_graph().get_direct_callees(func); |
| 314 | let (callee_covered, callee_total) = |
| 315 | self.compute_callees_branch_coverage(callees, cov_cache, visited)?; |
| 316 | let branch = (func_covered + callee_covered, func_total + callee_total); |
| 317 | return Ok(branch); |
| 318 | } |
| 319 | // for standard library apis, directly return zeros. |
| 320 | Ok((0, 0)) |
| 321 | } |
| 322 | |
| 323 | /// compute the branch coverage for all callees. visited is avoid to count the coverage for duplicated calles, each callee only count once. |
| 324 | fn compute_callees_branch_coverage( |
no test coverage detected