Skip to content

Commit

Permalink
more test
Browse files Browse the repository at this point in the history
  • Loading branch information
email2liyang committed Jan 8, 2019
1 parent 7d8e5c7 commit 5585fef
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,21 @@ class BinarySearchTreeTest extends FlatSpec with Matchers {
val tree = new BinarySearchTree(None)
val nums = Array(33, 17, 50, 13, 18, 34, 58, 16, 25, 51, 66, 19, 27, 55)
nums.foreach(tree.insert)
tree.hight() should equal(5)
tree.height() should equal(5)
}

it should "calc hight of a tree -2" in {
val tree = new BinarySearchTree(None)
val nums = Array(33, 17, 50, 13, 18, 34, 88).sorted
nums.foreach(tree.insert)
tree.hight() should equal(7)
tree.height() should equal(7)
}

it should "calc hight of a tree -3" in {
val tree = new BinarySearchTree(None)
val nums = Array(33).sorted
nums.foreach(tree.insert)
tree.height() should equal(1)
}

}

0 comments on commit 5585fef

Please sign in to comment.