summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorHaidong Ji2019-03-23 21:12:13 -0500
committerHaidong Ji2019-03-23 21:12:13 -0500
commitbf7d8fa962098eeafc4eed84e4ae0450806a43c3 (patch)
treef1f0a1f9cee1fcc9c275a967ae3889c05d19df30 /src/test
parentacff8424e09a3531cae111a93fb0f6fce1d4404e (diff)
check in post-order test cases
Diffstat (limited to 'src/test')
-rw-r--r--src/test/TreeTraversalTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/TreeTraversalTest.java b/src/test/TreeTraversalTest.java
index 336b86c..1fd23ea 100644
--- a/src/test/TreeTraversalTest.java
+++ b/src/test/TreeTraversalTest.java
@@ -23,6 +23,13 @@ class TreeTraversalTest {
assertEquals(1, tt.preOrder().get(2));
assertEquals(3, tt.preOrder().get(3));
assertEquals(5, tt.preOrder().get(4));
+
+ assertEquals(5, tt.postOrder().size());
+ assertEquals(1, tt.postOrder().get(0));
+ assertEquals(3, tt.postOrder().get(1));
+ assertEquals(2, tt.postOrder().get(2));
+ assertEquals(5, tt.postOrder().get(3));
+ assertEquals(4, tt.postOrder().get(4));
}
@Test
@@ -55,6 +62,18 @@ class TreeTraversalTest {
assertEquals(20, tt.preOrder().get(7));
assertEquals(60, tt.preOrder().get(8));
assertEquals(10, tt.preOrder().get(9));
+
+ assertEquals(10, tt.postOrder().size());
+ assertEquals(50, tt.postOrder().get(0));
+ assertEquals(80, tt.postOrder().get(1));
+ assertEquals(90, tt.postOrder().get(2));
+ assertEquals(30, tt.postOrder().get(3));
+ assertEquals(40, tt.postOrder().get(4));
+ assertEquals(70, tt.postOrder().get(5));
+ assertEquals(10, tt.postOrder().get(6));
+ assertEquals(60, tt.postOrder().get(7));
+ assertEquals(20, tt.postOrder().get(8));
+ assertEquals(0, tt.postOrder().get(9));
}
} \ No newline at end of file