[Mono-bugs] [Bug 61947][Cos] New - minor difference between .net and mono BinarySearch implementation

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 26 Jul 2004 09:05:05 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by monobugs@radeldudel.de.

http://bugzilla.ximian.com/show_bug.cgi?id=61947

--- shadow/61947	2004-07-26 09:05:05.000000000 -0400
+++ shadow/61947.tmp.805	2004-07-26 09:05:05.000000000 -0400
@@ -0,0 +1,61 @@
+Bug#: 61947
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: Server 2003
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Cosmetic
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: monobugs@radeldudel.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: minor difference between .net and mono BinarySearch implementation
+
+Description of Problem:
+Mono uses parameters in BinarySearch in different order from .NET.
+Since the order of these parameters is not specified in the documentation 
+this is actually not an error, but to provide maximum compatability 
+to .NET it might be a good idea to swap the parameters so .NET and MONO 
+have the same behaviour.
+
+
+NUnit test case to reproduce the problem:
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace SamsTests
+{
+ [TestFixture]
+ public class BinarySearchComparerTest
+ {
+
+  private class BinSearchComparer:IComparer
+  {
+   public int Compare( object  x, object  y)
+   {
+    if (x.GetType()==typeof(String))
+     Trace.WriteLine( "you are using MONO");
+    if (y.GetType()==typeof(String))
+     Trace.WriteLine( "you are using .NET");
+    return 0;
+   }
+  }
+
+  [Test] public void Testit()
+  {
+   ArrayList l= new ArrayList();
+   l.Add( 10.0m);
+   l.BinarySearch( "t", new BinSearchComparer());
+  }
+ }
+}
+
+How often does this happen? 
+Everytime