0
2.1kviews
Example of Basis Path Testing
1 Answer
1
176views

Example:

Function fn_delete_element (int value, int array_size, int array[])

{

1 int i;

location = array_size + 1;

2 for i = 1 to array_size

3 if ( array[i] == value )

4 location = i;

end if;

end for;

5 for i = location to array_size

6 array[i] = array[i+1];

end for;

7 array_size --;

}

Steps to Calculate the independent paths

Step 1 : Draw the Flow Graph of the Function/Program under consideration as shown below:

enter image description here

Step 2 : Determine the independent paths.

Path 1: 1 - 2 - 5 - 7

Path 2: 1 - 2 - 5 - 6 - 7

Path 3: 1 - 2 - 3 - 2 - 5 - 6 - 7

Path 4: 1 - 2 - 3 - 4 - 2 - 5 - 6 - 7

Please log in to add an answer.