Guest User

Untitled

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