Program 1:
Fault: for (int i = x.length -1; i > 0; i++);
The first of the array is never processed by the program.
a test case that does not execute the fault: x=null;
a test case that execute the fault, but does not result in an error state: x={1, 2, 3},y=5;
a test case that results in an error, but not a failure: x={1, 2, 3},y=1;
program 2:
fault: for (int i=0; I < x.length; i++ )
it can just return the index of the first zero.
a test case that does not execute the fault: x=null;
a test case that execute the fault, but does not result in an erroe state: x={0}
a test case that results in an error, but not a failure: x={3,4,5}
浙公网安备 33010602011771号