diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/TreeHeightTest.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/TreeHeightTest.java b/src/test/TreeHeightTest.java new file mode 100644 index 0000000..0fe3e57 --- /dev/null +++ b/src/test/TreeHeightTest.java @@ -0,0 +1,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)); + } +} |