Question: Consider the following program that uses binary search to check whether the input array contains a specific input value. (4* 20 points) public class BinarySearch

Consider the following program that uses binary search to check whether the input array contains a specific input value. (4* 20 points) public class BinarySearch public boolean contains(int] a, int b) if (a. Length = 0) { //bl(true), b2(false) s2 return false 53 S4 int low-0 int high -a.length 1; $5 while (low high) { //b3(true), b4(falseJ int middl Clow+high) 2; if Cb a[middle]) /b5(true), b6(false) low middle 1; high middle 1; return true; s8 s9 else if (ba[middle])b7(true), b8(false) s11 s12 else s13 return false; a. Draw the control-flow graph of the program b. Complete the following coverage matrix for both statement (marked on the left side of the code) and branch coverage (marked on the right side of the code) of the following four tests: i. t1:as(1,2,3), b=2 ii, t2:as(1,2,3), b-1 ii. t3:a-1,2,3), b-3 iv. t4: a-1,2,3), b-4 t2 t3 Statement coverage matrix t1 t2 t3 Branch coverage matrix c. Please apply both the total and additional test prioritization (based on statement coverage) on your tests to decide their execution ordering. Please show the priority for each test in each step. d. Please apply test-suite reduction (based on the branch coverage) on your tests to remove redundant tests. Please show your encoding of the problem in terms integer linear programming (ILP) constraints and objective formulas, and thern manually solve the constraints and generate the reduced test suite. If s10 is changed during software evolution, mark the dangerous edge in the CFG that you drew in (a) and apply regression test selection (RTS) to select the set of affected tests. e
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
