Homework2 of Software Testing
Program1:
The fault is : for(int i=x.length-1;i>0;i--)
We should change i>0 into i>=0
identify a test case that does not execute the fault:x=null
identify a test case that executes the fault, but does not result in an error state: x[3]={2,3,5} y=5
identify a test case that results in an error, but not a failure: x[3]={2,3,5} y=6
program2:
The fault is : for(int i=0;i<x.length;i++)
We should change it into for(int i=x.length-1; i>=0;i--)
identify a test case that does not execute the fault: x=null
identify a test case that executes the fault, but does not result in an error state: x[3]={2,0,5}
identify a test case that results in an error, but not a failure: x[3]={2,3,5}