White-Box Testing: This is the binary search code int binsearch (int x, int v[], int n){ /*
Question:
White-Box Testing:This is the binary search code int binsearch(int x, int v[], int n){ /* The input array v[] is assumed to be sorted in ascending order and n is the array size. You want to find the index of an element x in the array. If x is not found in the array, the routine is supposed to return -1. Answer the questions following the routine. */ a int low, high, mid; b low = 0; c high = n - 1; d while (low <= high) { e mid = (low + high)/2; f if (x < v[mid]) high = mid - 1; g else if (x > v[mid]) low = mid + 1; h else return mid; } i return -1; }
(a) Draw the control flow graph corresponding to the methodbinsearch.
(b) Describe the minimum set of test cases (or paths) through the control flow graph that is adequate for statement coverage but not edge/branch coverage.
(c) What additional test cases (if any) are required for branch coverage?