zoukankan      html  css  js  c++  java
  • ST:(homework 2)

    Below are two faulty programs. Each includes a test case that results in failure. Answer the following questions (in the next slide) about each program.

    Questions:

    1.Identify the fault.

    The left one : i should >= 0,not only > 0;

    The right one : is should be " for( int i = x.lenght -1; i >= 0; i--)"

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

    the left one :    test: x = []; y =1; expected = -1; actual = -1 

    the right one :  test: x = [] ; expected = -1; actual = -1
    3.If possible, identify a test case that executes the fault, but does not result in an error state.

    the left one :  test: x = [2,3,4];y = 4;expected = 2; actual = 2

    the right one:   test: x = [0]; expected = 0; actual = 0
    4.If possible identify a test case that results in an error, but not a failure.

    the left one :   test: x = [2,3,4];y = 5;expected = -1; actual = -1

    the right one:  test: x = [0,3,4]; expected = 0; actual = 0

  • 相关阅读:
    vi
    head
    uniq
    sort
    所谓静态绑定
    债务
    不确
    tar
    VMWare虚拟系统上网设置 及 三种模式详解
    awk
  • 原文地址:https://www.cnblogs.com/superjn/p/5244287.html
Copyright © 2011-2022 走看看