码迷,mamicode.com
首页 > 其他好文 > 详细

Homework 2

时间:2017-03-03 01:17:28      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:--   bsp   ted   null   home   int   pointer   expec   expected   

  • No.1

  1. Fault:
    for (int i=x.length-1; i > 0; i--)
    should be
    for (int i=x.length-1; i >= 0; i--)
  2. Test: x = NULL; y=1
    Expected: NullPointerException
    Actual: NullPointerException
  3. Test: x=[1, 2, 3]; y=3
    Expected is 2;
    Actual is 2;
  4. Test: x=[1, 2, 3]; y=4
    Expected is -1;
    Actual is -1;

 

  • No.2

  1. Fault
    for (int i = 0; i < x.length; i++)
    should be
    for (int i = x.length-1; i>=0; i--)
  2. Test: x=[ ];
    Expected: NullPointerException
    Actual: NullPointerException
  3. Test: x=[0];
    Expected is 0;
    Actual is 0;
  4. Test: x=[1, 2, 3];
    Expected is -1;
    Actual is -1;

Homework 2

标签:--   bsp   ted   null   home   int   pointer   expec   expected   

原文地址:http://www.cnblogs.com/yuzhenhuan1996/p/6493188.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!