+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
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()
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));
+ }
}
}