Skip to content

Commit 67963d7

Browse files
committed
test: improve the test coverage
1 parent 026dbc8 commit 67963d7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/data_structures/binary_search_tree.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,13 @@ mod test {
250250
);
251251
assert!(!tree.search(&"only a sith deals in absolutes"));
252252
assert!(!tree.search(&"you underestimate my power"));
253+
assert!(!tree.search(&"apple pie"));
254+
255+
let empty_tree = BinarySearchTree::<i32>::new();
256+
assert!(!empty_tree.search(&12));
257+
assert!(!empty_tree.search(&-5));
258+
assert!(!empty_tree.search(&0));
259+
assert!(!empty_tree.search(&5));
253260
}
254261

255262
#[test]
@@ -316,6 +323,10 @@ mod test {
316323
"your move"
317324
);
318325
assert!(tree.ceil(&"your new empire").is_none());
326+
327+
let empty_tree = BinarySearchTree::<i32>::new();
328+
assert!(empty_tree.floor(&12).is_none());
329+
assert!(empty_tree.ceil(&12).is_none());
319330
}
320331

321332
#[test]

0 commit comments

Comments
 (0)