fix silly bugs in binary_search_util test
This commit is contained in:
parent
5d44bebb32
commit
fb2c997d4e
1 changed files with 3 additions and 2 deletions
|
@ -4,7 +4,8 @@ type Element = (usize, &'static str);
|
|||
|
||||
fn test_map() -> Vec<Element> {
|
||||
let mut data = vec![(3, "three-a"), (0, "zero"), (3, "three-b"), (22, "twenty-two")];
|
||||
data.sort_by_key(get_key)
|
||||
data.sort_by_key(get_key);
|
||||
data
|
||||
}
|
||||
|
||||
fn get_key(data: &Element) -> usize {
|
||||
|
@ -12,7 +13,7 @@ fn get_key(data: &Element) -> usize {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn binary_search_slice() {
|
||||
fn binary_search_slice_test() {
|
||||
let map = test_map();
|
||||
assert_eq!(binary_search_slice(&map, get_key, &0), &[(0, "zero")]);
|
||||
assert_eq!(binary_search_slice(&map, get_key, &1), &[]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue