I have the following piece of code (doesn't matter if it's a good method or not):
public boolean adjacent(Cell otherCell) {
boolean result;
boolean xdiffersone = Math.abs(getX() - otherCell.getX()) == 1;
boolean ydiffersone = Math.abs(getY() - otherCell.getY()) == 1;
if((xdiffersone && !ydiffersone) || (!xdiffersone && ydiffersone)) {
result = true;
}
else {
result = false;
}
return result;
}
The control flow graph of this method:

I know that statement coverage means whether all the nodes in a control flow graph have been executed/visited. But what exactly is branch coverage? How can I calculate/see that from a control flow graph (or from the code)?
Statement coverage is about graph nodes. Branch coverage is about graph edges.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With