SE homework2

1. (1) Fault: for循环语句中的条件表达式i > 0,不能检查到数组的第一个元素,应该为 i >= 0 。

    (2) test:x=[];y=3

           Expected = -1

           Actual = -1

  (3) Impossible,只要执行了fault,一定会有error

  (4) test:x=[2,3,5];y=4

           Expected = -1

           Actual = -1

2. (1) fault:for循环语句应该从高位向低位检查,for(int i = x.length – 1; i >= 0; i --)

  (2) Impossible, 所有的测试都会执行fault

  (3) 当数组只有一个元素时,测试不会产生error状态

         test:x =[0]

     Expected = 0

     Actual = 0

  (4) test:x=[1,0,1]

    Expected = 1

    Actual = 1

原文地址:https://www.cnblogs.com/Veronica226/p/5247271.html