0
790views
Question 2: Performing data flow testing

Draw a data flow graph for the binsearch() function given below . • Assuming that the input array V [ ] has at least one element in it, find an infeasible path in the data flow graph for the binsearch() function. • Find a set of complete paths satisfying the all-defs selection criterion with respect to variable mid. • Find a set of complete paths satisfying the all-defs selection criterion with respect to variable high. • Implement your test cases using JUnit.

int binsearch(int X, int V[], int n) { int low, high, mid; low = 0; high = n - 1; while (low <= high) { mid = (low + high)/2; if (X < V[mid]) high = mid - 1; else if (X > V[mid]) low = mid + 1; else return mid; } return -1;

Please log in to add an answer.