Closed 3-24 closed 1 year ago
You example actually has 6 branches (you missed 2 branches BRANCH 5 and BRANCH 6 ;-)
if (A == true){ //BRANCH 5
if (B == true) {// BRANCH 6
if (C == true) {
// branch 1
} else {
// branch 2
}
} else {
// branch 3
}
} else {
// branch 4
}
Oh, now I realize that I missed them 👀
Suppose I have the following statement with AND clauses where A and B and C are boolean.
Then how do
gcc --coverage
andgcov
measure the branch coverage on this? I thought it should be unfolded as below because the C compiler creates CFG similar to that. (https://godbolt.org/z/Pnrzebvnz)However, the actual result says that it has six branches.