2004-06-16 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Wed, 16 Jun 2004 15:11:50 +0000 (15:11 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Wed, 16 Jun 2004 15:11:50 +0000 (15:11 -0000)
* DoubleFormatterTest.cs: Added new cases from bug reports 60110
(roundtrip format) and 60111 (non-banker rounding).

svn path=/trunk/mcs/; revision=29690

mcs/class/corlib/Test/System/ChangeLog
mcs/class/corlib/Test/System/DoubleFormatterTest.cs

index bd1bb7e5072c3f75f1cfd86c7e852bec114b177e..a4ee8705294395206c5db4a90f183bc17e64f3de 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-16  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * DoubleFormatterTest.cs: Added new cases from bug reports 60110 
+       (roundtrip format) and 60111 (non-banker rounding).
+
 2004-06-15  Sebastien Pouliot  <sebastien@ximian.com>
 
        * ConvertTest.cs: Changed compare between Decimals (from a string 
index 3620dfdc4ed3ca3254ac7afec84124f6f5253f39..719c4273c494ad380f99d25cd434320ce4e474b1 100644 (file)
@@ -13,14 +13,8 @@ using System.Globalization;
 namespace MonoTests.System {
        
        [TestFixture]
-       public class DoubleFormatterTest 
+       public class DoubleFormatterTest : Assertion
        {
-               [SetUp]
-               public void GetReady()  {}
-               
-               [TearDown]
-               public void Clean() {}
-               
                [Test]
                [ExpectedException(typeof(FormatException))]
                public void TestToDecimal()
@@ -910,6 +904,22 @@ namespace MonoTests.System {
                        nfi.NumberDecimalDigits = 5;
                        FormatStringTest ("#1", nfi, 70.50, "N", "70.50000");
                }
+
+               // "G" format doesn't use the banker rounding (like Math.Round)
+               // see bug #60111 for more details
+               [Test]
+               public void NonStandardRounding () 
+               {
+                       // banker's rounding would results in 2.71828182845904
+                       AssertEquals ("G-E", "2.71828182845905", Math.E.ToString (CultureInfo.InvariantCulture));
+               }
+
+               // see bug #60110 for more details
+               [Test]
+               public void Roundtrip () 
+               {
+                       AssertEquals ("R-E", "2.7182818284590451", Math.E.ToString ("R", CultureInfo.InvariantCulture));
+               }
        }
 }