mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-28 16:35:57 +00:00
Add a test for sort_by_key
This commit is contained in:
parent
b8452cc326
commit
9fbee359d7
@ -425,6 +425,11 @@ fn test_sort() {
|
||||
v.sort_by(|a, b| b.cmp(a));
|
||||
assert!(v.windows(2).all(|w| w[0] >= w[1]));
|
||||
|
||||
// Sort in lexicographic order.
|
||||
let mut v = orig.clone();
|
||||
v.sort_by_key(|x| x.to_string());
|
||||
assert!(v.windows(2).all(|w| w[0].to_string() <= w[1].to_string()));
|
||||
|
||||
// Sort with many pre-sorted runs.
|
||||
let mut v = orig.clone();
|
||||
v.sort();
|
||||
|
Loading…
Reference in New Issue
Block a user