You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-30 12:29:40 +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:
@ -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]
|
||||
|
Reference in New Issue
Block a user