public class BubbleSort { public static int bubble_sort(int array) { int n = array.length; int k, temp; screener.

public class BubbleSort {

public static int[] bubble_sort(int array[]) {

int n = array.length;

int k, temp;

screener.printNumbers(array);

for (int m = n; m > 0; m–) {

for (int i = 0; i < n – 1; i++) {

k = i + 1;

if (array[i] > array[k]) {

temp = array[i];

array[i] = array[k];

array[k] = temp;

}

}

}

screener.printNumbers(array);

return array;

}

}

1. Code coverage test

(i) Using the bubble_sort method, draw its flow-chart.

(ii) Label the nodes in the flow-chart and list all the possible paths in the flow of the method.

You only need to determine the number of independent paths through the code/flowchart. In the

case of a circular path B–>C–>B, the paths ABCBD and ABCBCBD are the same; therefore you

should only list the first.

(iii) For each path, design one test case as follows:

Define values for the method argument (such as array values) so that the path is chosen. Write the

expected return value from the method and the value of each field after the conclusion of the

particular path for the test case you suggested.

in the form of a table that defines each test case based on the following

format:

Path Test Case Expected Result

Path through the flow

graph for test case 1

Input values for variables Output values for

variables

For test case 2 … Etc Etc

Etc Etc Etc

(iv) Based on a boundary analysis of the possible unsorted array values, suggest some additional

test cases that can be used to test your BubbleSort class. Justify why you have chosen each of these

additional test cases (and the values chosen).