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

    希望大家多多指教!

  • 相关阅读:
    Linux中断的系统调用
    线程的概念
    C++ 虚函数表浅析
    C++虚函数工作原理
    深入浅出单实例Singleton设计模式
    《角斗士》一个帝国的史诗绝唱
    《妖猫传》大唐盛世背后那些事
    程序员之路
    职业规划
    一些重要的算法
  • 原文地址:https://www.cnblogs.com/wutong2/p/5260255.html
Copyright © 2011-2022 走看看