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

Commit 0d4c1ab

Browse files
Added tests to verify tree was created as expected.
1 parent 6f8b7de commit 0d4c1ab

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎src/_DataStructures_/Trees/BinarySearchTree/bst-deletion.test.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ describe('Binary search tree traversals', () => {
1717
});
1818
});
1919

20+
describe('Check bst was created as expected', () => {
21+
it('Inorder traversal of the created bst should be [ 2, 4, 5, 6, 8, 9, 12 ]', () => {
22+
expect(bst.traverseInorder()).toEqual([2, 4, 5, 6, 8, 9, 12]);
23+
});
24+
25+
it('Preorder traversal of the created bst should be [ 6, 4, 2, 5, 9, 8, 12 ]', () => {
26+
expect(bst.traversePreorder()).toEqual([6, 4, 2, 5, 9, 8, 12]);
27+
});
28+
29+
it('Postorder traversal of the created bst should be [ 2, 5, 4, 8, 12, 9, 6 ]', () => {
30+
expect(bst.traversePostorder()).toEqual([2, 5, 4, 8, 12, 9, 6]);
31+
});
32+
});
33+
2034
describe('BST node deletions', () => {
2135
it('should check height of bst to be 3 prior deletion', () => {
2236
expect(heightOfBST(bst.root)).toEqual(3);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /