From 75bba8a7f1e66ee5b1c445e4d67b5ef81caa0d8b Mon Sep 17 00:00:00 2001 From: kumpera Date: Sat, 6 Mar 2010 20:45:54 +0000 Subject: [PATCH] 2010-03-06 Rodrigo Kumpera * BigIntegerTest.cs: Tests for remaining ToString overloads git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@153207 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- .../Test/System.Numerics/BigIntegerTest.cs | 29 ++++++++++++++++++++++ .../System.Numerics/Test/System.Numerics/ChangeLog | 5 ++++ 2 files changed, 34 insertions(+) diff --git a/class/System.Numerics/Test/System.Numerics/BigIntegerTest.cs b/class/System.Numerics/Test/System.Numerics/BigIntegerTest.cs index e70800d01d..a2984cec90 100644 --- a/class/System.Numerics/Test/System.Numerics/BigIntegerTest.cs +++ b/class/System.Numerics/Test/System.Numerics/BigIntegerTest.cs @@ -8,6 +8,7 @@ using System; using System.Numerics; +using System.Globalization; using NUnit.Framework; @@ -624,6 +625,34 @@ namespace MonoTests.System.Numerics } [Test] + public void TestToStringFmtProvider () + { + NumberFormatInfo info = new NumberFormatInfo (); + info.NegativeSign = ">"; + info.PositiveSign = "%"; + + Assert.AreEqual ("10", new BigInteger (10).ToString (info), "#1"); + Assert.AreEqual (">10", new BigInteger (-10).ToString (info), "#2"); + Assert.AreEqual ("0A", new BigInteger (10).ToString ("X", info), "#3"); + Assert.AreEqual ("F6", new BigInteger (-10).ToString ("X", info), "#4"); + Assert.AreEqual ("10", new BigInteger (10).ToString ("G", info), "#5"); + Assert.AreEqual (">10", new BigInteger (-10).ToString ("G", info), "#6"); + Assert.AreEqual ("10", new BigInteger (10).ToString ("D", info), "#7"); + Assert.AreEqual (">10", new BigInteger (-10).ToString ("D", info), "#8"); + Assert.AreEqual ("10", new BigInteger (10).ToString ("R", info), "#9"); + Assert.AreEqual (">10", new BigInteger (-10).ToString ("R", info), "#10"); + + info = new NumberFormatInfo (); + info.NegativeSign = "#$%"; + Assert.AreEqual ("#$%10", new BigInteger (-10).ToString (info), "#2"); + Assert.AreEqual ("#$%10", new BigInteger (-10).ToString (null, info), "#2"); + + info = new NumberFormatInfo (); + Assert.AreEqual ("-10", new BigInteger (-10).ToString (info), "#2"); + + } + + [Test] public void TestToIntOperator () { try { diff --git a/class/System.Numerics/Test/System.Numerics/ChangeLog b/class/System.Numerics/Test/System.Numerics/ChangeLog index a88b52c718..e07c14ee99 100644 --- a/class/System.Numerics/Test/System.Numerics/ChangeLog +++ b/class/System.Numerics/Test/System.Numerics/ChangeLog @@ -1,5 +1,10 @@ 2010-03-06 Rodrigo Kumpera + * BigIntegerTest.cs: Tests for remaining ToString + overloads. + +2010-03-06 Rodrigo Kumpera + * BigIntegerTest.cs: Tests for ToString and ToString(string). -- 2.11.4.GIT