Complexité cyclomatique avec deux IFS - Pourquoi est-ce 3?
https://softwareengineering.stackexchange.com/questions/183950
-
05-11-2019 - |
Question
J'ai lu un article avec l'exemple suivant:
void func()
{
if (condition1)
a = a + 1;
if (condition2)
a = a - 1;
}
Il dit que le CC est 3 car il y a trois chemins possibles. Comment venir? Pourquoi pas 4? Je m'attendrais à ce que c'est vrai, vrai; Faux, faux; Vrai, faux et faux, vrai.
Peu importe quelles sont les déclarations. CC = IFS-Endpoints + 2. Il est toujours 3 pour 2 IFS et une fin.
Pas de solution correcte
Licencié sous: CC-BY-SA avec attribution
Non affilié à softwareengineering.stackexchange