Software Testing Techniques Homework 2

时间:2023-03-09 09:03:49
Software Testing Techniques Homework 2

Problem 1

1. The fault is i > 0, it should be  i >= 0, because if the case is x = [0], y= 0, we expect = 1, but actually, we get -1;

2.  test: x = [], y = 1 does not execute the fault;

3.  test: x = [1,2,3], y = 3 executes the fault, but does not result in an error state;

4.  test: x = [1,2,3], y = 4 results in an error, but not a failure;

Problem 2

1. The fault is for (int i = 0; i < x.length; i++), it should be  for (int i = x.length-1; i >=0; i--), because it just find the fist zero;

2.  test: x = [] does not execute the fault;

3.  test: x = [0] executes the fault, but does not result in an error state;

4.  test: x = [1,2,0] results in an error, but not a failure;