-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindMaxRectangleTest.java
66 lines (54 loc) · 1.7 KB
/
FindMaxRectangleTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
public class FindMaxRectangleTest {
@Test
public void constantHeight1() {
assertArrayEquals(
new int[] {0, 3}, new FindMaxRectangle(new int[] {2, 2, 2, 2}).findMaxRectangle());
}
@Test
public void constantHeight2() {
assertArrayEquals(
new int[] {2, 3}, new FindMaxRectangle(new int[] {1, 1, 5, 5, 1}).findMaxRectangle());
}
@Test
public void constantHeight3() {
assertArrayEquals(new int[] {0, 0}, new FindMaxRectangle(new int[] {5}).findMaxRectangle());
}
@Test
public void emptyInput() {
assertArrayEquals(new int[] {-1, -1}, new FindMaxRectangle(new int[] {}).findMaxRectangle());
}
@Test
public void handleZeroHeight() {
assertArrayEquals(
new int[] {0, 0}, new FindMaxRectangle(new int[] {8, 0, 1, 1}).findMaxRectangle());
}
@Test
public void zigzag1() {
assertArrayEquals(
new int[] {0, 2}, new FindMaxRectangle(new int[] {2, 4, 2, 1}).findMaxRectangle());
}
@Test
public void zigzag2() {
assertArrayEquals(
new int[] {4, 6},
new FindMaxRectangle(new int[] {2, 4, 2, 1, 10, 6, 10}).findMaxRectangle());
}
@Test
public void zigzag3() {
assertArrayEquals(
new int[] {2, 4}, new FindMaxRectangle(new int[] {6, 2, 5, 4, 5, 1, 6}).findMaxRectangle());
}
@Test
public void zigzag4() {
assertArrayEquals(
new int[] {0, 8},
new FindMaxRectangle(new int[] {7, 2, 1, 4, 5, 1, 3, 3, 1}).findMaxRectangle());
}
@Test
public void zigzag5() {
assertArrayEquals(
new int[] {2, 3}, new FindMaxRectangle(new int[] {2, 1, 4, 5, 1, 3, 3}).findMaxRectangle());
}
}