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
|
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class TreeHeightTest {
@Test
void test1() {
int[] a = {4, -1, 4, 1, 1};
assertEquals(3, TreeHeight.getHeight(a));
}
@Test
void test2() {
int[] a = {-1, 0, 4, 0, 3};
assertEquals(4, TreeHeight.getHeight(a));
}
@Test
void test3() {
int[] a = {4, -1, 4, 1, 1};
assertEquals(3, TreeHeight.getHeightNaive(a));
}
@Test
void test4() {
int[] a = {-1, 0, 4, 0, 3};
assertEquals(4, TreeHeight.getHeightNaive(a));
}
@Test
void test5() {
int[] a = {9, 7, 5, 5, 2, 9, 9, 9, 2, -1};
assertEquals(4, TreeHeight.getHeightNaive(a));
}
@Test
void test6() {
int[] a = {9, 7, 5, 5, 2, 9, 9, 9, 2, -1};
assertEquals(4, TreeHeight.getHeight(a));
}
@Test
void test7() {
int[] a = {8, 8, 5, 6, 7, 3, 1, 6, -1, 5};
assertEquals(6, TreeHeight.getHeight(a));
}
}
|