|
7 | 7 | import static org.junit.Assert.assertEquals;
|
8 | 8 |
|
9 | 9 | public class _605Test {
|
10 |
| - private static _605 test; |
| 10 | + private static _605.Solution1 solution1; |
| 11 | + private static _605.Solution2 solution2; |
11 | 12 | private static int[] flowerbed;
|
12 | 13 | private static int n;
|
13 | 14 |
|
14 | 15 | @BeforeClass
|
15 | 16 | public static void setup() {
|
16 |
| - test = new _605(); |
| 17 | + solution1 = new _605.Solution1(); |
| 18 | + solution2 = new _605.Solution2(); |
17 | 19 | }
|
18 | 20 |
|
19 | 21 | @Test
|
20 | 22 | public void test1() {
|
21 | 23 | flowerbed = new int[]{1, 0, 0, 0, 1};
|
22 | 24 | n = 1;
|
23 |
| - assertEquals(true, test.canPlaceFlowers(flowerbed, n)); |
| 25 | + assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); |
24 | 26 | }
|
25 | 27 |
|
26 | 28 | @Test
|
27 | 29 | public void test2() {
|
28 | 30 | flowerbed = new int[]{1, 0, 0, 0, 1};
|
29 | 31 | n = 2;
|
30 |
| - assertEquals(false, test.canPlaceFlowers(flowerbed, n)); |
| 32 | + assertEquals(false, solution1.canPlaceFlowers(flowerbed, n)); |
31 | 33 | }
|
32 | 34 |
|
33 | 35 | @Test
|
34 | 36 | public void test3() {
|
35 | 37 | flowerbed = new int[]{1, 0, 0, 0, 0, 1};
|
36 | 38 | n = 2;
|
37 |
| - assertEquals(false, test.canPlaceFlowers(flowerbed, n)); |
| 39 | + assertEquals(false, solution1.canPlaceFlowers(flowerbed, n)); |
38 | 40 | }
|
39 | 41 |
|
40 | 42 | @Test
|
41 | 43 | public void test4() {
|
42 | 44 | flowerbed = new int[]{1, 0, 1, 0, 1, 0, 1};
|
43 | 45 | n = 1;
|
44 |
| - assertEquals(false, test.canPlaceFlowers(flowerbed, n)); |
| 46 | + assertEquals(false, solution1.canPlaceFlowers(flowerbed, n)); |
45 | 47 | }
|
46 | 48 |
|
47 | 49 | @Test
|
48 | 50 | public void test5() {
|
49 | 51 | flowerbed = new int[]{0, 0, 1, 0, 1};
|
50 | 52 | n = 1;
|
51 |
| - assertEquals(true, test.canPlaceFlowers(flowerbed, n)); |
| 53 | + assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); |
52 | 54 | }
|
53 | 55 |
|
54 | 56 | @Test
|
55 | 57 | public void test6() {
|
56 | 58 | flowerbed = new int[]{1, 0, 0, 0, 1, 0, 0};
|
57 | 59 | n = 2;
|
58 |
| - assertEquals(true, test.canPlaceFlowers(flowerbed, n)); |
| 60 | + assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); |
59 | 61 | }
|
60 | 62 |
|
61 | 63 | @Test
|
62 | 64 | public void test7() {
|
63 | 65 | flowerbed = new int[]{0, 0, 1, 0, 0};
|
64 | 66 | n = 2;
|
65 |
| - assertEquals(true, test.canPlaceFlowers(flowerbed, n)); |
| 67 | + assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); |
66 | 68 | }
|
67 | 69 |
|
68 | 70 | @Test
|
69 | 71 | public void test8() {
|
70 | 72 | flowerbed = new int[]{1};
|
71 | 73 | n = 0;
|
72 |
| - assertEquals(true, test.canPlaceFlowers(flowerbed, n)); |
| 74 | + assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); |
73 | 75 | }
|
74 | 76 |
|
75 | 77 | @Test
|
76 | 78 | public void test9() {
|
77 | 79 | flowerbed = new int[]{0};
|
78 | 80 | n = 0;
|
79 |
| - assertEquals(true, test.canPlaceFlowers(flowerbed, n)); |
| 81 | + assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); |
80 | 82 | }
|
81 | 83 |
|
82 | 84 | @Test
|
83 | 85 | public void test10() {
|
84 | 86 | flowerbed = new int[]{0};
|
85 | 87 | n = 1;
|
86 |
| - assertEquals(true, test.canPlaceFlowers(flowerbed, n)); |
| 88 | + assertEquals(true, solution1.canPlaceFlowers(flowerbed, n)); |
| 89 | + } |
| 90 | + |
| 91 | + @Test |
| 92 | + public void test11() { |
| 93 | + flowerbed = new int[]{1, 0, 0, 0, 1}; |
| 94 | + n = 1; |
| 95 | + assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); |
| 96 | + } |
| 97 | + |
| 98 | + @Test |
| 99 | + public void test12() { |
| 100 | + flowerbed = new int[]{1, 0, 0, 0, 1}; |
| 101 | + n = 2; |
| 102 | + assertEquals(false, solution2.canPlaceFlowers(flowerbed, n)); |
| 103 | + } |
| 104 | + |
| 105 | + @Test |
| 106 | + public void test13() { |
| 107 | + flowerbed = new int[]{1, 0, 0, 0, 0, 1}; |
| 108 | + n = 2; |
| 109 | + assertEquals(false, solution2.canPlaceFlowers(flowerbed, n)); |
| 110 | + } |
| 111 | + |
| 112 | + @Test |
| 113 | + public void test14() { |
| 114 | + flowerbed = new int[]{1, 0, 1, 0, 1, 0, 1}; |
| 115 | + n = 1; |
| 116 | + assertEquals(false, solution2.canPlaceFlowers(flowerbed, n)); |
| 117 | + } |
| 118 | + |
| 119 | + @Test |
| 120 | + public void test15() { |
| 121 | + flowerbed = new int[]{0, 0, 1, 0, 1}; |
| 122 | + n = 1; |
| 123 | + assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); |
| 124 | + } |
| 125 | + |
| 126 | + @Test |
| 127 | + public void test16() { |
| 128 | + flowerbed = new int[]{1, 0, 0, 0, 1, 0, 0}; |
| 129 | + n = 2; |
| 130 | + assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); |
| 131 | + } |
| 132 | + |
| 133 | + @Test |
| 134 | + public void test17() { |
| 135 | + flowerbed = new int[]{0, 0, 1, 0, 0}; |
| 136 | + n = 2; |
| 137 | + assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); |
| 138 | + } |
| 139 | + |
| 140 | + @Test |
| 141 | + public void test18() { |
| 142 | + flowerbed = new int[]{1}; |
| 143 | + n = 0; |
| 144 | + assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); |
| 145 | + } |
| 146 | + |
| 147 | + @Test |
| 148 | + public void test19() { |
| 149 | + flowerbed = new int[]{0}; |
| 150 | + n = 0; |
| 151 | + assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); |
| 152 | + } |
| 153 | + |
| 154 | + @Test |
| 155 | + public void test20() { |
| 156 | + flowerbed = new int[]{0}; |
| 157 | + n = 1; |
| 158 | + assertEquals(true, solution2.canPlaceFlowers(flowerbed, n)); |
87 | 159 | }
|
88 | 160 | }
|
0 commit comments