[Mono-devel-list] CompareInfo.Compare test failing on MS.NET

Nick Drochak ndrochak at gol.com
Sun Jan 9 03:46:06 EST 2005


Miguel,

 

Your recent addition to the CompareInfo.Compare() test for the Invariant
culture is failing on MS.NET.  This first test passes, but the second fails:

 

+                 // In Mono we are comparing the ordinal values 

+                 // of the strings, while it seems that the MS

+                 // runtime considers lowercase letters like "a"

+                 // to come before "A".

+                 //

+                 // I have not found any documentation on this

+                 // behavior of the InvariantCulture

+                 //

+                 Assert.IsTrue (c.Compare ("a", "A") < 0);

+                 

+                 Assert.IsTrue
(CultureInfo.InvariantCulture.CompareInfo.Compare ("a", "A",
CompareOptions.Ordinal) < 0);

 

I checked to Unicode standard website to try to understand this and found
this file which I believe shows the ordinal values,
http://www.unicode.org/Public/UNIDATA/UnicodeData.txt

 

Note that capital "A" has value of 0x41 and small "a" has value of 0x61.
This is a difference of decimal 32 and surprisingly small "a" is "larger".
Indeed, trying this little line of code on MS.NET shows a being greater than
A:

 

Console.WriteLine(CultureInfo.InvariantCulture.CompareInfo.Compare ("a",
"A", CompareOptions.Ordinal));

 

You'll get 32. Which is greater than 0.

 

I don't know how to classify this as a "bug" or whatever, but mono's
behavior is clearly different than MS.NET here.

 

Nick D.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050109/f47deeb3/attachment.html 


More information about the Mono-devel-list mailing list