[Mono-bugs] [Bug 41522][Nor] New - Enum.Format Improper Formats

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Thu, 17 Apr 2003 21:00:26 -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 r.h.lee@attbi.com.

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

--- shadow/41522	Thu Apr 17 21:00:26 2003
+++ shadow/41522.tmp.3738	Thu Apr 17 21:00:26 2003
@@ -0,0 +1,67 @@
+Bug#: 41522
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: r.h.lee@attbi.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Enum.Format Improper Formats
+
+Enum.Format returns incorrect results.
+
+
+using System;
+using NUnit.Framework;
+
+
+[TestFixture]
+public class EnumFormatBug {
+
+	enum E {
+		Aa=0,
+		Bb=1,
+		Cc=2,
+		Dd=3,
+	}
+	
+	[Flags]
+	enum E2 {
+		Aa,
+		Bb,
+		Cc,
+		Dd,
+	}
+	
+	public EnumFormatBug () {}
+
+	[Test]
+	public void Show1() {
+		int[] evalues=new int[4] {0,1,2,3};
+		E[] e=new E[4] {E.Aa, E.Bb, E.Cc, E.Dd};
+		
+		for (int i=0; i<4; ++i) {
+			Assertion.AssertEquals("TC-007f",
+				e[i].ToString(),
+				Enum.Format (typeof(E), evalues[i], "f")
+				);
+		}
+	}
+
+	[Test]
+	public void Show2() {
+		int	invalidValue=1000;
+		
+		Assertion.AssertEquals ("TC-007gx",
+				invalidValue,
+				Enum.Format (typeof (E2), invalidValue, "g"));
+	}
+}