Fault:

可能导致程序失败的因素,可理解成具体的代码。

Error:

在程序运行过程中与设计时的预先设想不一致的情况,如变量值错误,错误的运行路径等。

Failure:

当一程序不能完成所要求的功能时,即失败。

函数findLast:

  1. Identify the fault.

在边界判断时出错 在i=0 时退出循环,没有检验第一个int值。

for循环中的条件判断应为:(int i=x.length-1; i > =0; i--)。

2. If possible, identify a test case that does not execute the fault. (Reachability)

test: x=[]。

直接抛出空指针异常而不执行以后的代码,所以没有执行fault。

  1. If possible, identify a test case that executes the fault, but does not result in an error state.

test: x=[1, 2, 3]; y = 2

Expected= 1

执行了含有fault的代码在产生error返回了正确结果。

4. If possible identify a test case that results in an error, but not a failure.

test: x=[2, 4, 5]; y = 1

Expected = -1

没有遍历到x[0],直接返回了-1,因此执行了error但是没有产生 failure。

函数lastZero:

1、 Identify the fault.

应该从后往前遍历,for循环中的条件判断应为:(int i=x.length-1; i > =0; i--);

2、 If possible, identify a test case that does not execute the fault. (Reachability)

test: x=[]。

3、 If possible, identify a test case that executes the fault, but does not result in an error state.

test: x=[3, 2, 1];

Expected = -1

遍历了没有发现0 没有进入到error的情况。

4、 If possible identify a test case that results in an error, but not a failure.

test: x=[1, 2, 0]

Expected = 2

发生了error没有发生failure,

返回了第一个0的位置 但只有一个0,结果正确,代码逻辑错误。

转载于:https://www.cnblogs.com/scsji/p/8576854.html

Fault,Error与Failure的联系与区别相关推荐

  1. Fault、Error及Failure的解释

    1 背景 在讨论安全关键系统时,经常涉及3个术语,即Fault.Error.Failure. 它们是什么意思,有什么异同,有什么关系,常感到不清楚.本文整理标准中对三个术语的定义,并解释它们的关系. ...

  2. 关于 error: LNK1123: failure during conversion to COFF: file invalid or corrupt 错误的解决方案【Qt】【 VS2010】

    关于 error: LNK1123: failure during conversion to COFF: file invalid or corrupt 错误的解决方案[Qt][ VS2010] 参 ...

  3. fatal error LINK1123:failure during conversion to COFF:file invalid or corrupt

    Visual Studio 2010编译时出现:fatal error LINK1123:failure during conversion to COFF:file invalid or corru ...

  4. Junit中error和failure区别

    JUnit 中有两种错误类型,一个是 failure,另一个是 error.这两者之间的差别很微妙,但是我们如果能够理解这种差别的话,对我们使用 JUnit 将会非常有帮助的. 通常来说,failur ...

  5. linux c 打印错误信息error errno perror和strerror的区别

    1 perror  头文件:stdio.h  void perror(const char *msg);  它是基于errno的当前值,在标准错上产生一条出错信息,然后返回.  它先输出由msg字符串 ...

  6. asynchronous socket error 10053 socket和http的区别

    1.当终端连上了自己电脑的服务器,Androidstdio也连上了终端 2.当我切换WiFi的时候,WiFi是不同网段的,给电脑分配了不同网段的IP,这时候调试工具就会报"asynchron ...

  7. 分布式系统一致性的发展历史 (二)

    2019独角兽企业重金招聘Python工程师标准>>> 在本系列第一篇文章中我们提到了Lamport Clock如何启发人们在分布式系统中开始使用新的的思维方式, 并介绍了Seque ...

  8. fault、failure和error区别

    fault.failure和error 看上面那篇博文理解学习的. 作出个人的理解和总结: 1.fault(缺陷):程序段有缺陷但可以将就使用. 2.error(出错):程序段用错误的方式得出了正确的 ...

  9. 【ERROR】:LNK1123: failure during conversion to COFF

    解决Visual Studio 2010新建工程时出现『1>LINK : fatal error LNK1123: failure during conversion to COFF: file ...

最新文章

  1. Android 中的安全机制
  2. 如何加入IETF 如何发表自己的RFC
  3. string常用操作
  4. C# WPF MVVM开发框架Caliburn.Micro View / View Model 命名⑨
  5. NY : 括号匹配问题
  6. linux的find命令满屏权限不够提示
  7. cmd sc命令进行服务操作
  8. 李楠自曝已预定5.4寸iPhone 12 mini:Pro版还得等一个月
  9. Setting下的自定义控件LinearColorBar
  10. 使用CImage类将RGB图像转化为灰度图像
  11. java 堆有多少个_Java堆内存的十个要点
  12. 自动驾驶 2-3 软件架构 Software Architecture
  13. 类图和对象图(用户管理模块建模)
  14. python海词查单词
  15. resin服务器搭建
  16. RestTemplate请求oauth获取token报401错误
  17. “我爱淘”冲刺阶段Scrum站立会议8
  18. there is the flag
  19. 解决react antd design pro 二级图标不显示问题(v4版本)
  20. pppd详解_pppd命令使用详解

热门文章

  1. 深圳市中心迎来首批RoboTaxi,元戎启行正式开放运营
  2. 人工智能应用于建筑领域新前沿
  3. 干货|全面理解无监督学习基础知识
  4. 这是自动驾驶的战国时期,也是技术发展的黄金时期
  5. 机器学习笔试题精选(一)
  6. Tensorflow— saver_save
  7. (已解决torchvision中CIFAR10下载速度慢)如何下载以及使用torchvision导入
  8. 使用Android Studio的时候如何查看开发文档,API文档,doc文档,SDK文档
  9. Hinton的胶囊网络不太行?CVPR Oral论文:不比卷积网络更「强」
  10. 边缘AI是内存技术发展的催化剂