1.Identify the fault.
for循环的结束条件应该为i>=0,否则会漏掉检查数组第一个元素。
2.If possible, identify a test case that does not execute the fault. (Reachability)
test case: x = [], y = 2
3.If possible, identify a test case that executes the fault, but does not result in an error state.
test case: x = [3,2,5], y = 2
4.If possible identify a test case that results in an error, but not a failure.
test case: x = [3,2,5], y = 0
1.Identify the fault.
寻找最后一个0应该从后往前遍历数组,应为for( int i = x.length-1 ; i >= 0 ; i-- )
2.If possible, identify a test case that does not execute the fault. (Reachability)
test case: x = []
3.If possible, identify a test case that executes the fault, but does not result in an error state.
test case: x = [3]
4.If possible identify a test case that results in an error, but not a failure.
test case: x = [0,2,2]