Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit71c7431

Browse files
fix build
1 parent9b9472c commit71c7431

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
packagecom.fishercoder;
22

33
importcom.fishercoder.solutions._200;
4-
importorg.junit.BeforeClass;
4+
importorg.junit.Before;
55
importorg.junit.Test;
66

77
importstaticorg.junit.Assert.assertEquals;
@@ -11,8 +11,8 @@ public class _200Test {
1111
privatestatic_200.UnionFindSolutionunionFindSolution;
1212
privatestaticchar[][]grid;
1313

14-
@BeforeClass
15-
publicstaticvoidsetup(){
14+
@Before
15+
publicvoidsetup(){
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 =newchar[][]{
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 =newchar[][]{
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 =newchar[][]{
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)

[8]ページ先頭

©2009-2025 Movatter.jp