Closed
Description
std::sort::quick_sort sorts [2, 1, 3] as [1, 3, 2], for both the vec and ivec versions.
fn test_qsort() {
auto names = ~[mutable 2, 1, 3];
auto expected = ~[1, 2, 3];
fn lteq(&int a, &int b) -> bool { int::le(a, b) }
iqsort(lteq, names);
auto pairs = ivec::zip(expected, ivec::from_mut(names));
for (tup(int, int) p in pairs) {
log_err #fmt("%d %d", p._0, p._1);
assert p._0 == p._1;
}
}
Metadata
Metadata
Assignees
Labels
No labels