MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / get_func_branch_coverage

Method get_func_branch_coverage

src/feedback/branches.rs:305–321  ·  view source on GitHub ↗
(
        &self,
        func: &str,
        cov_cache: &HashMap<String, (u32, u32)>,
        visited: &mut HashSet<String>,
    )

Source from the content-addressed store, hash-verified

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(

Calls 3

get_lib_call_graphFunction · 0.85
get_direct_calleesMethod · 0.80

Tested by

no test coverage detected