dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/tests/runtime/System TestString.cs,1.


From: Jonathan Springer <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/tests/runtime/System TestString.cs,1.4,1.5
Date: Wed, 27 Nov 2002 09:37:29 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System
In directory subversions:/tmp/cvs-serv18774/tests/runtime/System

Modified Files:
        TestString.cs 
Log Message:

New number formatting code.


Index: TestString.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/TestString.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** TestString.cs       20 Nov 2002 02:14:16 -0000      1.4
--- TestString.cs       27 Nov 2002 14:37:27 -0000      1.5
***************
*** 263,267 ****
        /*TODO*/
                AssertEquals ("String.Format(\"\",0)", "", String.Format ("", 
0));
!               
                AssertEquals ("String.Format(\"{0}\",\"FooBar\")", 
                                "FooBar", String.Format ("{0}","FooBar"));
--- 263,267 ----
        /*TODO*/
                AssertEquals ("String.Format(\"\",0)", "", String.Format ("", 
0));
! 
                AssertEquals ("String.Format(\"{0}\",\"FooBar\")", 
                                "FooBar", String.Format ("{0}","FooBar"));
***************
*** 326,334 ****
                        "<12   >",String.Format ("<{0,-5}>", 12));
  
!               AssertEquals ("String.Format(\"The {0} of 
{1}\",\"Church\",\"Emacs\")",
                        "The Church of Emacs",
                        String.Format ("The {0} of {1}", "Church", "Emacs"));
                
!               AssertEquals("String.Format(\"G{0} N{1} 
U{2}\",\"nu's\",\"ot\",\"nix\")",
                        "Gnu's Not Unix", 
                        String.Format ("G{0} N{1} U{2}", "nu's", "ot", "nix"));
--- 326,335 ----
                        "<12   >",String.Format ("<{0,-5}>", 12));
  
!               AssertEquals ("String.Format(\"The {1} of 
{1}\",\"Church\",\"Emacs\")",
                        "The Church of Emacs",
                        String.Format ("The {0} of {1}", "Church", "Emacs"));
                
!               AssertEquals(
!                       "String.Format(\"G{0} N{1} 
U{2}\",\"nu's\",\"ot\",\"nix\")",
                        "Gnu's Not Unix", 
                        String.Format ("G{0} N{1} U{2}", "nu's", "ot", "nix"));
***************
*** 337,341 ****
                        "cafebabe", String.Format ("{0:x8}", 0xcafebabe));
  
!               AssertEquals ("String.Format (\"{0:x8}\", 
0xcafebabe),\"cafebabe\")",
                        "CAFEBABE", String.Format ("{0:X8}", 0xcafebabe));
  
--- 338,342 ----
                        "cafebabe", String.Format ("{0:x8}", 0xcafebabe));
  
!               AssertEquals ("String.Format (\"{0:X8}\", 
0xcafebabe),\"CAFEBABE\")",
                        "CAFEBABE", String.Format ("{0:X8}", 0xcafebabe));
  
***************
*** 348,351 ****
--- 349,388 ----
                AssertEquals ("String.Format (\"if({0}==0){{ .... }}\",\"i\")",
                        "if(i==0){ .... }", String.Format ("if({0}==0){{ .... 
}}", "i"));
+ 
+               /*  Some tests inspired by the mailing list  */
+               AssertEquals ("String.Format (\"0x{0:X2}\", (byte)255)",
+                               "0xFF", String.Format("0x{0:X2}", (byte)255));
+ 
+               AssertEquals ("String.Format (\"0x{0:X2}\", (byte)14)",
+                               "0x0E", String.Format("0x{0:X2}", (byte)14));
+ 
+               AssertEquals ("String.Format (\"{0:D2}\", 9)",
+                               "09", String.Format("{0:D2}", 9));
+ 
+               AssertEquals ("String.Format (\"{0:F2}\", 1234567.89)",
+                               "1234567.89", String.Format("{0:F2}", 
1234567.89));
+ 
+               AssertEquals ("String.Format (\"{0:C2}\", 1234567)",
+                               "\u00a4"+"1,234,567.00", 
String.Format("{0:C2}", 1234567));
+ 
+               AssertEquals ("String.Format (\"{0:E}\", 1234568)",
+                               "1.234568E+006", String.Format("{0:E}", 
1234568));
+ 
+               AssertEquals ("String.Format (\"{0:e}\", 0.325)",
+                               "3.25e-001", String.Format("{0:e}", 0.325));
+ 
+               /*  Custom Format tests... */
+               AssertEquals ("String.Format(\"{0:#,###,##0.00}\", 1234567.81)",
+                               "1,234,567.81", 
String.Format("{0:#,###,##0.00}", 1234567.81));
+ 
+               AssertEquals ("String.Format(\"{0:#,##0,}M\", 1234000)",
+                               "1,234M", String.Format("{0:#,###,}M", 
1234000));
+ 
+               AssertEquals("String.Format(\"{0:####.##}\", 0)",
+                               ".", String.Format("{0:####.##}", 0));
+ 
+               AssertEquals("String.Format(\"{0:###0.0#}\", 0)",
+                               "0.0", String.Format("{0:###0.0#}", 0));
+ 
        }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]