首页 > 其他 > 详细

Homework2_3015218130_许鹏程

时间:2018-03-14 21:28:06      阅读:179      评论:0      收藏:0      [点我收藏+]

program 1 :

Identify the fault.
for (int i=x.length-1; i > 0; i--)
change to:
for (int i=x.length-1; i >= 0; i--)
 
If possible, identify a test case that does not execute the fault. (Reachability)
text: x=[ ]; y=2
Expected: NullPointerException
 
If possible, identify a test case that executes the fault, but does not result in an error state.
text: x=[2,3,5]; y=3
Expected= 1
 
If possible identify a test case that results in an error, but not a failure.
text: x=[2,3,5]; y=6
Expected= -1
 

program 2:

Identify the fault.
for (int i = 0; i < x.length; i++)
change to:
for (int i =x.length-1;i>=0; i--)
 
If possible, identify a test case that does not execute the fault. (Reachability)
text: x=[ ];
Expected: NullPointerException
 
If possible, identify a test case that executes the fault, but does not result in an error state.
text: x=[0,1,1];
Expected= 0
 
If possible identify a test case that results in an error, but not a failure.
text: x=[1,1,1];
Expected= -1

Homework2_3015218130_许鹏程

原文:https://www.cnblogs.com/picheng/p/8570130.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!