-And the answer in this case is no. And - -2
-the reason for this is because this code is - -3
-unreachable. This is dead code because no matter the - -4
-value of j, this condition will always be false because - -5
-i will always be 0. And notice that this - -6
-is a small example, but another important truth is - -7
-that any non-trivial program contains dead or unreachable code, - -8
-code that no matter how well we test our system, - -9
-we will never be able to exercise. Why is that? Various - -10
-reasons. For example, defensive programming or, - -11
-for example, developing for future releases. - -12
-So there might be pieces of code that are added, but they're - -13
-still not activated. They're still not invoked by any other part of - -14
-the code because of modifications to the code. There are some - -15
-parts that were executed before and in the new version of the - -16
-program, they are no longer exercised. They are no longer executable. But - -17
-they still remain in the code base. And this is a very, - -18
-very normal situation for this reason and many more. And this is - -19
-an important concept because this affects - -20
-the very meaning of coverage measures. If - -21
-there is some unreachable code, we will never be able to reach - -22
-100% code coverage. And in fact, if you remember, at the beginning of - -23
-the lesson, we discussed this concept and asked you why you think - -24
-that, in the industry, the target for coverage is not 100% but less - -25
-that that. And that's the answer, to account for the fact that there - -26
-are infeasibility problems that I have to take into account when I test - -27
-the code, infeasible paths, unexecutable statements, conditions that can never - -28
-be true, and so on. So most criteria, if not - -29
-all, are affected, and we need to take that into - -30
-account when we try to achieve a given coverage target. -- cgit 1.4.1