Guest User

Untitled

a guest
May 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. import org.junit.jupiter.api.Test;
  2. import static org.junit.jupiter.api.Assertions.*;
  3.  
  4. class testprTest {
  5.  
  6. @Test
  7. void nullInArgs() {
  8. int[] a1 = new int[0];
  9. int[] a2 = new int[0];
  10. assertNull(testpr.merge(null, null));
  11. assertEquals(a1, testpr.merge(a1, null));
  12. assertEquals(a2, testpr.merge(null, a2));
  13. }
  14.  
  15. @Test
  16. void emptyArray() {
  17. int[] a1 = new int[0];
  18. int[] a2 = new int[0];
  19. int[] a22 = new int[1];
  20. assertEquals(a1, testpr.merge(a1, a2));
  21. assertEquals(a22, testpr.merge(a1, a22));
  22. }
  23.  
  24. @Test
  25. void Test1(){
  26. int[] a1 = new int[]{3,2,1};
  27. int[] a2 = new int[] {3,2,1};
  28. int[] result = new int[] {3,3,2,2,1,1};
  29. assertArrayEquals(result, testpr.merge(a1, a2));
  30. }
  31.  
  32. @Test
  33. void Test2(){
  34. int[] a1 = new int[]{3,2,1};
  35. int[] a2 = new int[] {4,3,2};
  36. int[] result = new int[] {4,3,3,2,2,1};
  37. assertArrayEquals(result, testpr.merge(a1, a2));
  38. }
  39.  
  40.  
  41. @Test
  42. void Test3(){
  43. int[] a1 = new int[]{3,3,3,3};
  44. int[] a2 = new int[]{4,4};
  45. int[] result = new int[] {4,4,3,3,3,3};
  46. assertArrayEquals(result, testpr.merge(a1, a2));
  47. }
  48.  
  49. @Test
  50. void Test4(){
  51. int[] a1 = new int[]{3};
  52. int[] a2 = new int[]{4};
  53. int[] result = new int[] {4,3};
  54. assertArrayEquals(result, testpr.merge(a1, a2));
  55. }
  56.  
  57. @Test
  58. void Test5(){
  59. int[] a1 = new int[]{5,3,1};
  60. int[] a2 = new int[]{8,7,6,4,2};
  61. int[] result = new int[] {8,7,6,5,4,3,2,1};
  62. assertArrayEquals(result, testpr.merge(a1, a2));
  63. }
  64.  
  65. }
Add Comment
Please, Sign In to add comment