zoukankan      html  css  js  c++  java
  • 软件测试:Homework 2

    Homework 2:

         

        

    Questions:


    Identify the fault.

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

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

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

     

    Answer:

    左边程序的第六行改为:for (int i=x.length-1; i >= 0; i--)

       右边程序的第五行改为:for (int i=x.length-1; i >= 0; i--)

    左边程序:All inputs execute the fault - even the null input. 

       右边程序:All inputs execute the fault - even the null input. 

    左边程序 :如果不执行循环,那么就不会出现error,所以输入为空或者只含有一个元素。

                         input:x = [3]; y = 2

                         Expected Output: -1

                         Actual Output: -1

       右边程序 :如果不执行循环,那么就不会出现error; 如果循环只执行一次,那么从左到右和从右到左遍历的结果是一样的,也不会出现error。

                         input:x = [2]

                         Expected Output: -1

                         Actual Output: -1

    左边程序测试实例:当输入超过一个元素时,便会出现error;当期望值与实际值相等时,便不会出现failure。

                         input: x = [3,2,5] ; y = 2

                         Expected Output: 1

                         Actual Output: 1

       右边程序测试实例:当输入超过一个元素时,便会出现error;当期望值与实际值相等时,便不会出现failure。

                         input:x = [5,2,0]

                         Expected Output: 2

                         Actual Output: 2

  • 相关阅读:
    BZOJ.2199.[USACO2011 Jan]奶牛议会(2-SAT)
    BZOJ.1997.[HNOI2010]Planar(2-SAT)
    POJ.3648.Wedding(2-SAT)
    POJ.3678.Katu Puzzle(2-SAT)
    POJ.3207.Ikki's Story IV-Panda's Trick(2-SAT)
    洛谷.4180.[模板]次小生成树Tree(Kruskal LCA 倍增)
    BZOJ.4766.文艺计算姬(Prufer)
    zabbix 微信告警机制
    网络地址
    tcp与udp的区别
  • 原文地址:https://www.cnblogs.com/meiqin970126/p/8550620.html
Copyright © 2011-2022 走看看