Question: Type the following code. Understand the three test cases in the main function. Run the code. What are the results of the three test cases?

 Type the following code. Understand the three test cases in the
main function. Run the code. What are the results of the three

Type the following code. Understand the three test cases in the main function. Run the code. What are the results of the three test cases? Are the test cases sufficient? Rewrite these test cases in Junit. blic class DebugPractice \} public static void fun1(int[] data) \{ int n= datalength: int 1=0; II compare the data at index i with data at index i*2+1, II if bigger, then swap them, repeat at index i* 2+1 II The sequence of index i that will be checked will be 0,1,3,7,15,31, while ( data[i]> data[i*2+1]) \{ int t=data[i[2+1); data [[+2+1]= data[i]: data[]=t; i=i+2+1; > 1 public static void main(String[] arges) \{ "First test % System.out.printin("*-Test \#11.."); int] a={1,2,3}; System.out.printin("Before: "): for (int e:a) System.out.print(e+ ","): System.out.printin(); DebugPractice.fun1(a): System.out.printin("After: "); for (int e:a) System.out.print(e+ ","); System.out.printin(); r : Second Test % System.out.printin("mest \#2-."); int] b={10,9,8,7,6,5,4,3,2,1} System.out.printin("Before: "); for (int e:b) System.out.print(e+ ","); System.out.printin(); DebugPractice.fun1(b); System.out.printin("After: "); for (int e:b) System.out.print(e+ ","); System.out.printin(); r - Third Test */ System.out.println("-Test \#3-.-"); int]] c= new int[20]; c[0]=4; c[1]=3; c[3]=1; c[7]=8; c(15)=6; System.out.printin("Before: "); for (int e:c) System.out.print(e+ ","); System.out.printin(); DebugPractice_fix.fun1(c); System.out.printin("After: "): for (int e:c) System.out.print(e+,") System.out.printin()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!