Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions M2/Macaulay2/d/actors3.d
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ subsort(l:int,r:int):Expr := (
sortlist.j = tmp;
i = i+1;
j = j-1));
if l+1 < j then subsort(l+1,j);
if j+1 < r then subsort(j+1,r);
if l+1 < j then when subsort(l+1,j) is e:Error do return Expr(e) else nothing;
if j+1 < r then when subsort(j+1,r) is e:Error do return Expr(e) else nothing;
for k from l+1 to j do sortlist.(k-1) = sortlist.k;
sortlist.j = pivot;
nullE);
Expand Down
7 changes: 7 additions & 0 deletions M2/Macaulay2/tests/normal/sort.m2
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ assert( L === sort(L, identity) )
L = {0,0,0,1,2,3}
assert( L === sort(L, identity) )

-- 49 and 50 are adjacent, so they are always compared, whatever the pivots
T = new Type of List
T ? T := (a, b) -> if set {a#0, b#0} === set {49, 50} then error "incomparable" else a#0 ? b#0
L = apply(100, i -> new T from {i})
assert try (sort L; false) else true
assert try (rsort L; false) else true

end
-- Local Variables:
-- compile-command: "make -C $M2BUILDDIR/Macaulay2/packages/Macaulay2Doc/test sort.out"
Expand Down
Loading