Created
December 4, 2012 23:46
-
-
Save jordanlewis/4210365 to your computer and use it in GitHub Desktop.
PFDS Exercise 2.5 tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BinaryTreeTest extends Spec with ShouldMatchers with Checkers { | |
describe("A complete tree") { | |
it("should have 2^n - 1 nodes") { | |
check(forAll(choose(0, 25)){n: Int => | |
BinaryTree.complete(0, n).size == scala.math.pow(2, n) - 1 }) | |
} | |
} | |
describe("A balanced tree") { | |
it("should have n nodes") { | |
check(forAll(choose(0, 100)){n: Int => | |
BinaryTree.balanced(0, n).size == n}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment