error,fault, failure

1, findLast()

(1) The fault is that the state of the loop should be:

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

Because if the expected index is in x[0], when i=0 the loop will not be execute because it doesn’t fit the state that I > 0.

(2) We must make sure it will not execute the i>0, so let x be null,

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

To cause the error, we should let it execute the state i = 0, but I = 0 will cause the return -1, because it will be push out of the loop, at the same time ,there is no expected number in the array, so the actual result also is -1.

2,lastZero()

(1) The question says that finding the last zero, so we should start with the last index in the array, so for(int i = x.length – 1;i>=0;i--)

(2) Whatever the case is ,the int i=0 will be execute at first.

(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

时间: 2024-08-12 19:07:00

error,fault, failure的相关文章

结对编程--fault,error,failure

结对编程对象:张忠玉 结对照片: 结对题目:输入一定个数的数字,对其排序后输出最大值. 1 package com.jkxy.zy.selectsort; 2 3 import java.util.Scanner; 4 5 /** 6 * 7 * 构造程序,分别是: 8 •不能触发Fault. 9 •触发Fault,但是不能触发Error. 10 •触发Error,但是不能产生Failure.*/ 11 public class Selectsort { 12 13 public static

软件测试作业2:fault,error,failure 的区别

定义: Software Fault : A static defect in the software  可能导致系统或功能失效的异常条件,可译为"故障". Software Error : An incorrect internal state that is the manifestation of some fault     计算.观察或测量值或条件,与真实.规定或理论上正确的值或条件之间的差异,可译为"错误".Error是能够导致系统出现Failure的

“command line option syntax error,Type command/?for help

VS2010安装WDT时出现"command line option syntax error,Type command/?for help错误 解决:可能是因为你的安装源文件所在的路径中有中文,所以你可将安装文件放在一个没有中文的路径. "command line option syntax error,Type command/?for help,布布扣,bubuko.com

四种常见的提示弹出框(success,warning,error,loading)原生JavaScript和jQuery分别实现

虽然说现在官方的自带插件已经有很多了,但是有时候往往不能满足我们的需求,下面我简单介绍一些 常见的四种提示弹出框(success,loading,error,warning),我分别用原生JavaScript和jQuery来介绍分享给各位博友! 一.首先介绍原生JavaScript来实现四种提示弹出框: 第一步:先看看html的建立 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:

winedt打开.tex文件时会出现reading error,看不到任何文字

winedt打开.tex文件时会出现reading error,然后看不到任何文字.   解决办法:先打开空白的winedt,然后点击open,找到该.tex文件,将文件名右侧的 default 改为 UFT8 ,点击打开,OK.    

表单提交是ajax提交,PC提交没问题但是手机提交就会一直跳到error,并且也没状态码一直是0

真是被自己蠢死了button标签他会自动提交刷新页面 <form id="baoming_from"> <p>请填写您的个人信息</p> <ul> <li><label>姓       名:</label><input type="text" name="name" myAttr="姓名" maxlength="5"&

Jquery Ajax的时候 老是返回到 error,是因为json格式不正规的原因

Jquery Ajax的时候 老是返回到 error,是因为json格式不正规的原因: 怪不得不执行,原来我返回的是{success:true,id:1} 这种不规则的字符串,不是严格的json格式,改成{"success":true,"id":"1"} 就可以正常执行success回调了.    JSON格式总结下,详细的去json.org 查看.  1)键名称:用双引号 括起  2)字符串:用使用双引号 括起  3)数字,布尔类型不需要 使用

spring boot注入error,Consider defining a bean of type &#39;xxx&#39; in your configuration问题解决方案

经常出现这问题一定是非spring生态圈的@标签 没被spring引入,如mybatis等 因为在默认情况下只能扫描与控制器在同一个包下以及其子包下的@Component注解,以及能将指定注解的类自动注册为Bean的@[email protected]和@ Repository 那个这个时候就需要@ComponentScan或者@MapperScan了 要是xml配置注入有这问题,麻烦一遍一遍看xml文件的配置,绝对是哪里没写匹配. spring boot注入error,Consider def

软件测试第二次作业——区分fault,error,failure

fault:代码中存在的逻辑错误: error:测试用例执行时遇到的逻辑错误: failure:错误的测试结果: Program1: 1.fault:最终索引i应在-1时停止,而不是0: 2.X=null,y=0; 3.X=[2,3,1],y=1 4.X=[2,3,4],y=1 Program2: 1.fault:因为是要找最后一个为0的元素索引,所以应从后往前找,而不是从前往后找; 2.X=null; 3.X=[0]; 4.X=[2,1,0];