Guest User

Untitled

a guest
Feb 21st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. import org.junit.Assert;
  2. import org.junit.Before;
  3. import org.junit.Test;
  4.  
  5. public class GoldenChainTest {
  6.  
  7. protected GoldenChain solution;
  8.  
  9. @Before
  10. public void setUp() {
  11. solution = new GoldenChain();
  12. }
  13.  
  14. @Test(timeout = 2000)
  15. public void testCase0() {
  16. int[] sections = new int[]{3, 3, 3, 3};
  17.  
  18. int expected = 3;
  19. int actual = solution.minCuts(sections);
  20.  
  21. Assert.assertEquals(expected, actual);
  22. }
  23.  
  24. @Test(timeout = 2000)
  25. public void testCase1() {
  26. int[] sections = new int[]{2000000000};
  27.  
  28. int expected = 1;
  29. int actual = solution.minCuts(sections);
  30.  
  31. Assert.assertEquals(expected, actual);
  32. }
  33.  
  34. @Test(timeout = 2000)
  35. public void testCase2() {
  36. int[] sections = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50};
  37.  
  38. int expected = 42;
  39. int actual = solution.minCuts(sections);
  40.  
  41. Assert.assertEquals(expected, actual);
  42. }
  43.  
  44. @Test(timeout = 2000)
  45. public void testCase3() {
  46. int[] sections = new int[]{20000000, 20000000, 2000000000};
  47.  
  48. int expected = 3;
  49. int actual = solution.minCuts(sections);
  50.  
  51. Assert.assertEquals(expected, actual);
  52. }
  53.  
  54. @Test(timeout = 2000)
  55. public void testCase4() {
  56. int[] sections = new int[]{10, 10, 10, 10, 10, 1, 1, 1, 1, 1};
  57.  
  58. int expected = 5;
  59. int actual = solution.minCuts(sections);
  60.  
  61. Assert.assertEquals(expected, actual);
  62. }
  63.  
  64. @Test(timeout = 2000)
  65. public void testCase5() {
  66. int[] sections = new int[]{1, 10};
  67.  
  68. int expected = 1;
  69. int actual = solution.minCuts(sections);
  70.  
  71. Assert.assertEquals(expected, actual);
  72. }
  73.  
  74. }
Add Comment
Please, Sign In to add comment