zoukankan      html  css  js  c++  java
  • falut error failure 的区别与理解

    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

    希望大家多多指教!

  • 相关阅读:
    from __future__ import *
    每日一题力扣102
    每日一题力扣228
    每日一题力扣409
    每日一题力扣135 分糖果 中级
    【K短路】牛慢跑
    【2021-06-12】只有团队作战,才能更好生存
    【2021-06-11】不怕事情被砸,就怕团队不愿意承压
    【2021-06-10】压力需主动承受,才能进步
    【2021-06-09】日记和睡觉治疗法
  • 原文地址:https://www.cnblogs.com/wutong2/p/5260255.html
Copyright © 2011-2022 走看看