Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 71c7431

Browse files
fix build
1 parent 9b9472c commit 71c7431

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/test/java/com/fishercoder/_200Test.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.fishercoder;
22

33
import com.fishercoder.solutions._200;
4-
import org.junit.BeforeClass;
4+
import org.junit.Before;
55
import org.junit.Test;
66

77
import static org.junit.Assert.assertEquals;
@@ -11,8 +11,8 @@ public class _200Test {
1111
private static _200.UnionFindSolution unionFindSolution;
1212
private static char[][] grid;
1313

14-
@BeforeClass
15-
public static void setup(){
14+
@Before
15+
public void setup(){
1616
dfsSolution = new _200.DFSSolution();
1717
unionFindSolution = new _200.UnionFindSolution();
1818
}
@@ -25,6 +25,12 @@ public void test1(){
2525
{'1','1','1'},
2626
};
2727
assertEquals(1, dfsSolution.numIslands(grid));
28+
29+
grid = new char[][]{
30+
{'1','1','1'},
31+
{'0','1','0'},
32+
{'1','1','1'},
33+
};
2834
assertEquals(1, unionFindSolution.numIslands(grid));
2935
}
3036

@@ -36,8 +42,15 @@ public void test2(){
3642
{'1','1','0','0','0'},
3743
{'0','0','0','0','0'},
3844
};
39-
assertEquals(0, dfsSolution.numIslands(grid));
40-
assertEquals(0, unionFindSolution.numIslands(grid));
45+
assertEquals(1, dfsSolution.numIslands(grid));
46+
47+
grid = new char[][]{
48+
{'1','1','1','1','0'},
49+
{'1','1','0','1','0'},
50+
{'1','1','0','0','0'},
51+
{'0','0','0','0','0'},
52+
};
53+
assertEquals(1, unionFindSolution.numIslands(grid));
4154
}
4255

4356
@Test
@@ -49,6 +62,13 @@ public void test3(){
4962
{'0','0','0','1','1'},
5063
};
5164
assertEquals(3, dfsSolution.numIslands(grid));
65+
66+
grid = new char[][]{
67+
{'1','1','0','0','0'},
68+
{'1','1','0','0','0'},
69+
{'0','0','1','0','0'},
70+
{'0','0','0','1','1'},
71+
};
5272
assertEquals(3, unionFindSolution.numIslands(grid));
5373
}
5474

0 commit comments

Comments
 (0)