lundi 7 novembre 2016

Cyclomatic Complexity edges

So I'm trying to figure out if that blue line is in the right place, I know that I should have 9 edges but not sure if it's correct.

The code

public int getResult(int p1, int p2) {
int result = 0; // 1
if (p1 == 0) {  // 2
    result += 1; //3
} else {     
    result += 2; //4
}
if (p2 == 0) {   //5
    result += 3; //6
} else {
    result += 4; //7
}
    return result; //8 exit node
} 

so 8 nodes and it should have 9 edges, right? Did I do the right thing?

enter image description here

Aucun commentaire:

Enregistrer un commentaire