Unique branch is the branch that have not been triggered before.
(&mut self, coverage: &CodeCoverage)
| 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) |
no test coverage detected