However, complexity is just one measure of quality. And there is one connective (&) used in the conditions. The example above has a STMCC value of 3:4. int divide (int x, int y)Įlse if (x = 0 & y > 2) /* Condition 2 Conditional expression 1 */ It's presented as two values separated by: The upper bound is defined as the total number of conditions in the code plus 1. It accounts for complexity caused by compound predicates. However, when you consider the side effect of the Boolean operator, there are actually two decisions. Two Cyclomatic Complexity Examples Cyclomatic Complexity Example 1Īt first, it looks like there is one decision in this example. For instance, one may be added if a Boolean operator is found within a conditional statement. This translates to the number of decisions + 1.īinary decisions - such as “if” and “while” statements - add 1 to complexity.īoolean operators can add either one or nothing to complexity.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |