Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1.  
  2.  
  3. import java.util.Random;
  4. import org.junit.*;
  5. import org.junit.Test;
  6. import static org.junit.Assert.*;
  7.  
  8.  
  9. public class HeapSortTest {
  10.  
  11. @Test
  12. public void testSort() throws Exception {
  13. System.out.println("sort");
  14. int[] arr = new int[10];
  15. Random r = new Random();
  16. for(int i = 0; i<arr.length; i++){
  17. arr[i] = r.nextInt(100);
  18. }
  19. HeapSort.sort(arr);
  20. for(int i = 0; i<arr.length-1;i++){
  21. if(arr[i] > arr[i+1]) throw new Exception();
  22. }
  23.  
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement