Closed
Description
Don't see a unit test for that. Here is at least a basic test:
#[test]
fn test_merge_sort_stability()
{
// not sure why we can't use just &
pure fn ile(x: &@str, y: &@str) -> bool
{
unchecked // to_lower is not pure...
{
let x = x.to_lower();
let y = y.to_lower();
x <= y
}
}
let names1 = ~[@"joe bob", @"Joe Bob", @"Jack Brown", @"JOE Bob", @"Sally Mae", @"JOE BOB", @"Alex Andy"];
let names2 = ~[@"Alex Andy", @"Jack Brown", @"joe bob", @"Joe Bob", @"JOE Bob", @"JOE BOB", @"Sally Mae"];
let names3 = std::sort::merge_sort(ile, names1);
assert names3 == names2;
}
Metadata
Metadata
Assignees
Labels
No labels