- Fault:
for (int i=x.length-1; i > 0; i--)
should be
for (int i=x.length-1; i >= 0; i--)
- Test: x = NULL; y=1
Expected: NullPointerException
Actual: NullPointerException
- Test: x=[1, 2, 3]; y=3
Expected is 2;
Actual is 2;
- Test: x=[1, 2, 3]; y=4
Expected is -1;
Actual is -1;
- Fault
for (int i = 0; i < x.length; i++)
should be
for (int i = x.length-1; i>=0; i--)
- Test: x=[ ];
Expected: NullPointerException
Actual: NullPointerException
- Test: x=[0];
Expected is 0;
Actual is 0;
- Test: x=[1, 2, 3];
Expected is -1;
Actual is -1;
Homework 2
原文:http://www.cnblogs.com/yuzhenhuan1996/p/6493188.html