Software Testing Homework2

This homework is analysis two faulty programs.

 The first program:

the fault: the loop cann't reach the first element of x[], the correct statement should be for(int i=x.length-1;i>=0;i--);

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=[3,2,5],y=2, return 1;

a test case that results in an error, but not a failure: x=[3,3,5],y=2, return -1;

 

second program:

fault: It will find the first 0, and the loop should be changed into for(int i=x.lenght-1;i>=0;i--);

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,1,1], return 0;

a test case that results in an error, but not a failure: x=[1,1,2], return -1;

posted @ 2017-02-27 13:32  柯德尔  阅读(130)  评论(0)    收藏  举报