[Mono-list] Remaining bugs in System.Convert

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

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

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

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
	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.


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>

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);
			Console.WriteLine ("float: " + f);
			Console.WriteLine ("double: " + d);
		} catch (Exception e) {
			Console.WriteLine (e.GetType ());