fmt fix...
This commit is contained in:
@@ -91,17 +91,28 @@ fn test_score_tracks_basic() {
|
|||||||
// Matched tracks should score higher than unmatched ones
|
// Matched tracks should score higher than unmatched ones
|
||||||
let mut matched: Vec<f64> = scored
|
let mut matched: Vec<f64> = scored
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|t| t.title.as_deref().is_some_and(|n| n.starts_with("Song 1") || n.starts_with("Song 2") || n.starts_with("Song 3")))
|
.filter(|t| {
|
||||||
|
t.title.as_deref().is_some_and(|n| {
|
||||||
|
n.starts_with("Song 1") || n.starts_with("Song 2") || n.starts_with("Song 3")
|
||||||
|
})
|
||||||
|
})
|
||||||
.map(|t| t.score)
|
.map(|t| t.score)
|
||||||
.collect();
|
.collect();
|
||||||
let mut unmatched: Vec<f64> = scored
|
let mut unmatched: Vec<f64> = scored
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|t| t.title.as_deref().is_some_and(|n| n.starts_with("Song 4") || n.starts_with("Song 5")))
|
.filter(|t| {
|
||||||
|
t.title
|
||||||
|
.as_deref()
|
||||||
|
.is_some_and(|n| n.starts_with("Song 4") || n.starts_with("Song 5"))
|
||||||
|
})
|
||||||
.map(|t| t.score)
|
.map(|t| t.score)
|
||||||
.collect();
|
.collect();
|
||||||
matched.sort_by(|a, b| b.partial_cmp(a).unwrap());
|
matched.sort_by(|a, b| b.partial_cmp(a).unwrap());
|
||||||
unmatched.sort_by(|a, b| b.partial_cmp(a).unwrap());
|
unmatched.sort_by(|a, b| b.partial_cmp(a).unwrap());
|
||||||
assert!(matched[0] > unmatched[0], "matched tracks should score higher than unmatched");
|
assert!(
|
||||||
|
matched[0] > unmatched[0],
|
||||||
|
"matched tracks should score higher than unmatched"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user