[Mono-list] Remaining bugs in System.Convert

Duncan Mak duncan@ximian.com
09 Jun 2002 03:54:21 -0400


--=-5pQtvW/eBLtck6CFYiz+
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hey hey hey!

I ran ConvertTest again tonight and we're getting 4 failures:

	1) TestToInt64(MonoTests.System.ConvertTest) "#L25
	expected:<System.OverflowException> but
	was:<NUnit.Framework.AssertionFailedError>"

This is bug 25692. I don't know how to fix it.

	2) TestToDouble(MonoTests.System.ConvertTest) "Unexpected 	exception at
iTest = 10: e = NUnit.Framework.AssertionFailedError
	#I10 expected:<1234.23449707031> but
	was:<1234>NUnit.Framework.AssertionFailedErrorin <0x00041>
	NUnit.Framework.Assertion:Fail (string)

This one is real funky. I got a test program attached. The output on
Linux is this:

	<duncan@diphthong: ~/ > mono double.exe
	float: 1234.23449707031
	double: 1234
	RESULT: 0

On Windows:

	<Duncan Mak@FRICATIVE: ~/ > ./double.exe 
	float: 1234.234
	double: 1234.23449707031

I think we should file a bug on this, but I dunno where.

	3) TestToDateTime(MonoTests.System.ConvertTest)

This is some System.Globalization, CultureInfo, DateTimeStyles related
bug. Punting it for now.

	4) TestChangeType(MonoTests.System.ConvertTest) "Unexpected 	exception
at iTest = 15: e = System.IndexOutOfRangeException
	Array index is out of range
	System.IndexOutOfRangeException in <0x00029> 	System.Convert:ChangeType
	(object,System.TypeCode,System.IFormatProvider)
	in <0x009f6> MonoTests.System.ConvertTest:TestChangeType ()

It's late, and I'm tired. But I have no fucking clue why we're getting
an IndexOutOfRangeException at all.

Sigh.

I fixed the bug at iTest = 13, MS allows ChangeType (null, null). I
played around a bit and found out they're throwing Exceptions they said
they won't throw (ie. NullReferenceException).

-- 
Duncan Mak <duncan@ximian.com>

--=-5pQtvW/eBLtck6CFYiz+
Content-Disposition: attachment; filename=double.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=double.cs; charset=ISO-8859-1

using System;
class T {
	static void Main() {               =20
		float f =3D 1234.2345f;

		try {=20
			double d =3D Convert.ToDouble (f);
		=09
			Console.WriteLine ("float: " + f);
			Console.WriteLine ("double: " + d);
		} catch (Exception e) {
			Console.WriteLine (e.GetType ());
		}
	}
}

--=-5pQtvW/eBLtck6CFYiz+--