mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-20 23:16:56 +02:00
Improve tests for BinaryTree exercise (#2696)
Current tests still pass if `len` is implemented to calculate the height of the tree (i.e. max(left.len(), right.len()) + 1 for each node). It seems this is quite a common misunderstanding when doing this course. With the new assert height implementation will fail, which hints towards implementing `len` as a total number of nodes.
This commit is contained in:
parent
53f7660e9b
commit
eca2a10316
@ -112,6 +112,8 @@ mod tests {
|
||||
assert_eq!(tree.len(), 2);
|
||||
tree.insert(2); // not a unique item
|
||||
assert_eq!(tree.len(), 2);
|
||||
tree.insert(3);
|
||||
assert_eq!(tree.len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user