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

Commit66a51b2

Browse files
committed
074 (2) update tests
1 parentede59f7 commit66a51b2

File tree

1 file changed

+142
-12
lines changed

1 file changed

+142
-12
lines changed

‎test/_074_SearchA2DMatrix/SolutionConvertTo1DTest.java

Lines changed: 142 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ public void tearDown() throws Exception {
2828

2929
@Test
3030
publicvoidTest1() {
31-
int[][]matrix = { {1,3,5,7 }, {10,11,16,20 },
32-
{23,30,34,50 } };
31+
int[][]matrix = {
32+
{1,3,5,7 },
33+
{10,11,16,20 },
34+
{23,30,34,50 }
35+
};
3336
inttarget =3;
3437
booleanactual =solution.searchMatrix(matrix,target);
3538
booleanexpected =true;
@@ -38,8 +41,11 @@ public void Test1() {
3841

3942
@Test
4043
publicvoidTest2() {
41-
int[][]matrix = { {1,3,5,7 }, {10,11,16,20 },
42-
{23,30,34,50 } };
44+
int[][]matrix = {
45+
{1,3,5,7 },
46+
{10,11,16,20 },
47+
{23,30,34,50 }
48+
};
4349
inttarget =100;
4450
booleanactual =solution.searchMatrix(matrix,target);
4551
booleanexpected =false;
@@ -48,8 +54,11 @@ public void Test2() {
4854

4955
@Test
5056
publicvoidTest3() {
51-
int[][]matrix = { {1,3,5,7 }, {10,11,16,20 },
52-
{23,30,34,50 } };
57+
int[][]matrix = {
58+
{1,3,5,7 },
59+
{10,11,16,20 },
60+
{23,30,34,50 }
61+
};
5362
inttarget =15;
5463
booleanactual =solution.searchMatrix(matrix,target);
5564
booleanexpected =false;
@@ -58,8 +67,11 @@ public void Test3() {
5867

5968
@Test
6069
publicvoidTest4() {
61-
int[][]matrix = { {1,3,5,7 }, {10,11,16,20 },
62-
{23,30,34,50 } };
70+
int[][]matrix = {
71+
{1,3,5,7 },
72+
{10,11,16,20 },
73+
{23,30,34,50 }
74+
};
6375
inttarget =30;
6476
booleanactual =solution.searchMatrix(matrix,target);
6577
booleanexpected =true;
@@ -68,8 +80,11 @@ public void Test4() {
6880

6981
@Test
7082
publicvoidTest5() {
71-
int[][]matrix = { {1,3,5,7 }, {10,11,16,20 },
72-
{23,30,34,50 } };
83+
int[][]matrix = {
84+
{1,3,5,7 },
85+
{10,11,16,20 },
86+
{23,30,34,50 }
87+
};
7388
inttarget =0;
7489
booleanactual =solution.searchMatrix(matrix,target);
7590
booleanexpected =false;
@@ -78,12 +93,127 @@ public void Test5() {
7893

7994
@Test
8095
publicvoidTest6() {
81-
int[][]matrix = { {1,3,5,7 }, {10,11,16,20 },
82-
{23,30,34,50 } };
96+
int[][]matrix = {
97+
{1,3,5,7 },
98+
{10,11,16,20 },
99+
{23,30,34,50 }
100+
};
83101
inttarget =10;
84102
booleanactual =solution.searchMatrix(matrix,target);
85103
booleanexpected =true;
86104
assertEquals(expected,actual);
87105
}
88106

107+
@Test
108+
publicvoidTest7() {
109+
int[][]matrix = { {1,3,5,7 } };
110+
inttarget =10;
111+
assertFalse(solution.searchMatrix(matrix,target));
112+
}
113+
114+
@Test
115+
publicvoidTest8() {
116+
int[][]matrix = { {1,3,5,7 } };
117+
inttarget =7;
118+
assertTrue(solution.searchMatrix(matrix,target));
119+
}
120+
121+
@Test
122+
publicvoidTest9() {
123+
int[][]matrix = { {1,3,5,7 } };
124+
inttarget =1;
125+
assertTrue(solution.searchMatrix(matrix,target));
126+
}
127+
128+
@Test
129+
publicvoidTest10() {
130+
int[][]matrix = { {1,3,5,7 } };
131+
inttarget =4;
132+
assertFalse(solution.searchMatrix(matrix,target));
133+
}
134+
135+
@Test
136+
publicvoidTest11() {
137+
int[][]matrix = { {1,3,5,7 } };
138+
inttarget =5;
139+
assertTrue(solution.searchMatrix(matrix,target));
140+
}
141+
142+
@Test
143+
publicvoidTest12() {
144+
int[][]matrix = {
145+
{1 },
146+
{5 },
147+
{9 },
148+
};
149+
inttarget =9;
150+
assertTrue(solution.searchMatrix(matrix,target));
151+
}
152+
153+
@Test
154+
publicvoidTest13() {
155+
int[][]matrix = {
156+
{1 },
157+
{5 },
158+
{9 },
159+
};
160+
inttarget =1;
161+
assertTrue(solution.searchMatrix(matrix,target));
162+
}
163+
164+
@Test
165+
publicvoidTest14() {
166+
int[][]matrix = {
167+
{1 },
168+
{5 },
169+
{9 },
170+
};
171+
inttarget =5;
172+
assertTrue(solution.searchMatrix(matrix,target));
173+
}
174+
175+
@Test
176+
publicvoidTest15() {
177+
int[][]matrix = {
178+
{1 },
179+
{5 },
180+
{9 },
181+
};
182+
inttarget =18;
183+
assertFalse(solution.searchMatrix(matrix,target));
184+
}
185+
186+
@Test
187+
publicvoidTest16() {
188+
int[][]matrix = {
189+
{1 },
190+
{5 },
191+
{9 },
192+
};
193+
inttarget =0;
194+
assertFalse(solution.searchMatrix(matrix,target));
195+
}
196+
197+
@Test
198+
publicvoidTest17() {
199+
int[][]matrix = {
200+
{1 },
201+
{5 },
202+
{9 },
203+
};
204+
inttarget =3;
205+
assertFalse(solution.searchMatrix(matrix,target));
206+
}
207+
208+
@Test
209+
publicvoidTest18() {
210+
int[][]matrix = {
211+
{1 },
212+
{5 },
213+
{9 },
214+
};
215+
inttarget =7;
216+
assertFalse(solution.searchMatrix(matrix,target));
217+
}
218+
89219
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp