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

Method has_unique_branch

src/feedback/observer.rs:94–114  ·  view source on GitHub ↗

Unique branch is the branch that have not been triggered before.

(&mut self, coverage: &CodeCoverage)

Source from the content-addressed store, hash-verified

92
93 // Unique branch is the branch that have not been triggered before.
94 pub fn has_unique_branch(&mut self, coverage: &CodeCoverage) -> HashMap<String, Vec<Branch>> {
95 {
96 let mut config = CONFIG_INSTANCE.get().unwrap().write().unwrap();
97 config.exponent_branch = false;
98 }
99
100 let unique_branche_states = self.branches.has_new(coverage);
101 {
102 let mut config = CONFIG_INSTANCE.get().unwrap().write().unwrap();
103 config.exponent_branch = true;
104 }
105 let mut unique_branches: HashMap<String, Vec<Branch>> = HashMap::new();
106 for (func, branch_states) in unique_branche_states {
107 let branches: Vec<Branch> = branch_states
108 .iter()
109 .map(|x: &BranchState| x.get_branch())
110 .collect();
111 unique_branches.insert(func, branches);
112 }
113 unique_branches
114 }
115
116 pub fn merge_new_branch(&mut self, new_branches: &HashMap<String, Vec<BranchState>>) {
117 self.branches.merge(new_branches)

Callers 4

minimizeFunction · 0.80
fuzz_loopMethod · 0.80
get_program_branchesMethod · 0.80

Calls 2

has_newMethod · 0.80
get_branchMethod · 0.80

Tested by

no test coverage detected