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

falut error failure 的区别与理解

时间:2016-03-09 23:50:34      阅读:489      评论:0      收藏:0      [点我收藏+]

标签:

Fault的定义:可能导致系统或功能失效的异常条件(Abnormal condition that can cause an element or an item tofail.),可译为“故障”
Error的定义:计算、观察或测量值或条件,与真实、规定或理论上正确的值或条件之间的差异(Discrepancy between a computed, observed or measured value or condition and the true, specified, or theoretically correct value or condition.),可译为“错误”。Error是能够导致系统出现Failure的系统内部状态

Failure的定义:当一个系统不能执行所要求的功能时,即为Failure,可译为“失效”。(Termination of the ability of an element or an item to perform a function as required.)

技术分享技术分享

 

1, findLast()

(1) 循环时缺少一个i=0的情况,应该为:

 

for(int i = x.length-1;i >= 0;i--)

(2) does not execute the fault

Test case: x=null y=2

Expected: NullPointerException

Actual: NullPointerException

 

(3) execute the fault but not cause error:

Test case: x = [1,2,5] y = 2

Expected: 1

     Actual: 1

(4) result error but not a failure:

Test case: x = [1,2,3] y = 5

Expected: -1

Actual: -1

 

2,lastZero()

 

(1) 要循环到最后一个,应该为

            for(int i = x.length – 1;i>=0;i--)

(2) i=0应该被先执行

(3) Test case: x = [2,1,4]

Expected: i = -1

Actual: i = -1

(4)Test case: x = [0,1,2]

Expected: i = 0

Actual: I = 0

希望大家多多指教!

 

falut error failure 的区别与理解

标签:

原文地址:http://www.cnblogs.com/wutong2/p/5260255.html

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