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 43ed1bc

Browse files
authored
Merge pull request #111 from theIYD/master
Add Test for Binary Tree Preorder Traversal
2 parents 3f9cd73 + a68aac3 commit 43ed1bc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const BinaryTree = require("./index");
2+
3+
describe("Binary Tree Preorder Traversal", () => {
4+
let btree;
5+
let preOrderTraversal;
6+
7+
describe("Creates BTree", () => {
8+
btree = new BinaryTree([1, 2, 3, 4, 5, 6]);
9+
});
10+
11+
describe("BTree Traversals", () => {
12+
it("should compute the Preorder traversal for the above created binary tree", () => {
13+
preOrderTraversal = btree.preOrder();
14+
expect(preOrderTraversal).toEqual([1, 2, 4, 5, 3, 6]);
15+
});
16+
});
17+
});

0 commit comments

Comments
(0)

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