Package: libmono-system2.0-cil
Version: 1.9.1+dfsg-2
Severity: normal
Using the ThenBy() method provided by System.Linq to do a stable sort of
an enumerable already ordered with OrderBy() does not give the expected
result, as the primary ordering is ignored.
Here is a testcase:
==
// Test the ThenBy() linq method in mono
// Compile with 'gmcs -r:System.Core MonoThenByTest.cs'
using System;
using System.Linq;
class MonoThenByTest {
public static void Main (string[] args)
{
string[] unsorted = new [] { a1, b1, a2, c2, c1};
// order on the whole string
string[] sorted = unsorted
.OrderBy(s = s)
.ToArray();
// order on the first char and then on the second
// it should give the same result as 'sorted'
string[] test = unsorted
.OrderBy(s = s[0])
.ThenBy(s = s[1])
.ToArray();
// these should be all equal
for(int i=0; isorted.Length; i++) {
if (sorted[i] == test[i])
Console.WriteLine({0} == {1}, sorted[i], test[i]);
else
Console.WriteLine({0} != {1}, sorted[i], test[i]);
}
}
}
==
While the results should be equal, here it gives:
a1 == a1
a2 != b1
b1 != c1
c1 != c2
c2 != a2
Thank you!
--- System information. ---
Architecture: amd64
Kernel: Linux 2.6.25-2-amd64
Debian Release: lenny/sid
500 unstableftp.it.debian.org
500 testing security.debian.org
--- Package information. ---
Depends(Version) | Installed
-+-=
libc6(= 2.7-1) | 2.7-12
OR libc6.1 (= 2.7-1) |
OR libc0.1 (= 2.7-1) |
libcups2 (= 1.3.7) | 1.3.8-1
libmono-corlib2.0-cil (= 1.2.2.1) | 1.9.1+dfsg-2
libmono-security2.0-cil (= 1.9) | 1.9.1+dfsg-2
libmono0 (= 1.2.6) | 1.9.1+dfsg-2
mono-jit (= 1.9.1) | 1.9.1+dfsg-2
mono-jit ( 1.9.2) | 1.9.1+dfsg-2
--
Emanuele Aina
http://initd.org
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]