Software Testing 2

软件测试作业2

王浩宇 3014218161 软工四班

 

 

  1. Fault in Program 1 lies in that x > 0, which should be corrected to: x >=0.

Fault in Program 2 lies in that it iterates from the beginning so it only outputs the first 0 in the integer array. In order to get the last index of 0, we should iterates from the end to the beginning, just like the first program.

 

  1. In order to avoid reaching the faults, both programs could set a test case where x is NULL.
  2. Program1 : Test case which reaches the fault but doesn’t generate an error :

X =[1,2,3], Y =3;

Program2 : Test case which reaches the fault but doesn’t generate an error :

X = [1,2,0];

 

  1. Program1 : Test case which results in an error but not a failure:

X=[1,2,3] y = 4;

Program2 : Test case which results in an error but not a failure:

X=[1,2,3]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值