* FileSystemInfoTest.cs: Restore original CurrentCulture on teardown.
Removed stray tabs. Code formatting.
* FileTest.cs: Restore original CurrentCulture on teardown. Removed
stray tabs. Changes spaces to tabs.
* ThreadTest.cs: Added tests for bug #81930.
* CultureInfoTest.cs: Added exception tests when invoking NumberFormat
or DateTimeFormat on a neutral culture. Added tests for bug #81930.
No longer derive from deprecated Assertion class. Added tests for
GetCultureInfo (2.0).
* ArrayTest.cs: Added test for bug #81941.
* ByteTest.cs: Restore original CurrentCulture in teardown.
* DecimalFormatterTest.cs: Restore original CurrentCulture in teardown.
Code formatting.
* DecimalTest.cs: Code formatting.
* DoubleFormatterTest.cs: Test relies on specific culture, so set it
up here. This worked before since the CurrentCulture was set in another
TestFixture, and the original one was not restored.
* FloatingPointFormatterTest.cs: Same.
* NumberFormatterTest.cs: Same. Removed stray tabs and fixes code
formatting.
* SingleFormatterTest.cs: Restore original culture on teardown. Code
formatting.
* SingleTest.cs: Same.
* StringComparerTest.cs: Restore original culture on teardown.
svn path=/trunk/mcs/; revision=80626
+2007-06-24 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * CultureInfo.cs: Added new private ctors that takes value for
+ read-only bit as argument. In ContructInvariant, clone invariant
+ NumberFormatInfo and DateTimeFormatInfo when we're not creating a
+ read-only CultureInfo, since they also should not be read-only.
+ Changes are required to allow a writable invariant CultureInfo to be
+ constructed. In GetCultures, use clone of InvariantCulture since it
+ must be not be read-only. In GetCultureInfo, always construct
+ read-only CultureInfo's. Fixes part of bug #81930.
+
2007-06-01 Atsushi Enomoto <atsushi@ximian.com>
* Calendar.cs DateTimeFormatInfo.cs : 2.0 API fixes.
static CultureInfo ()
{
- invariant_culture_info = new CultureInfo (InvariantCultureId, false);
- invariant_culture_info.m_isReadOnly = true;
+ invariant_culture_info = new CultureInfo (InvariantCultureId, false, true);
}
public static CultureInfo CreateSpecificCulture (string name)
CultureInfo [] infos = internal_get_cultures (neutral, specific, installed);
// The runtime returns a NULL in the first position of the array when
- // 'neutral' is true. We fill it in with the InvariantCulture.
- if (neutral && infos.Length > 0 && infos [0] == null)
- infos [0] = InvariantCulture;
+ // 'neutral' is true. We fill it in with a clone of InvariantCulture
+ // since it must not be read-only
+ if (neutral && infos.Length > 0 && infos [0] == null) {
+ infos [0] = (CultureInfo) InvariantCulture.Clone ();
+#if ONLY_1_1
+ infos [0].m_useUserOverride = true;
+#endif
+ }
return infos;
}
public virtual bool IsNeutralCulture {
get {
if (!constructed) Construct ();
- if (cultureID == 0x7f)
+ if (cultureID == InvariantCultureId)
return false;
return ((cultureID & 0xff00) == 0 || specific_lcid == 0);
return true;
}
- static CultureInfo [] GetCultures (bool neutral, bool specific, bool installed)
- {
- CultureInfo [] cis = internal_get_cultures (neutral, specific, installed);
-
- // The runtime returns a NULL in the first position of the array when
- // 'neutral' is true. We fill it in with the InvariantCulture.
- if (neutral && cis.Length > 0 && cis [0] == null)
- cis [0] = InvariantCulture;
-
- return cis;
- }
-
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern bool construct_internal_locale_from_lcid (int lcid);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static bool internal_is_lcid_neutral (int lcid, out bool is_neutral);
- private unsafe void ConstructInvariant (bool use_user_override)
+ private unsafe void ConstructInvariant (bool read_only)
{
- m_isReadOnly=false;
cultureID = InvariantCultureId;
- this.m_useUserOverride=use_user_override;
/* NumberFormatInfo defaults to the invariant data */
numInfo=NumberFormatInfo.InvariantInfo;
-
/* DateTimeFormatInfo defaults to the invariant data */
dateTimeInfo=DateTimeFormatInfo.InvariantInfo;
+ if (!read_only) {
+ numInfo = (NumberFormatInfo) numInfo.Clone ();
+ dateTimeInfo = (DateTimeFormatInfo) dateTimeInfo.Clone ();
+ }
+
textInfo=new TextInfo (this, cultureID, this.textinfo_data);
m_name=String.Empty;
icu_name="en_US_POSIX";
win3lang="IVL";
}
-
- public CultureInfo (int culture, bool use_user_override)
+
+ public CultureInfo (int culture) : this (culture, true) {}
+
+ public CultureInfo (int culture, bool use_user_override) :
+ this (culture, use_user_override, false) {}
+
+ private CultureInfo (int culture, bool use_user_override, bool read_only)
{
if (culture < 0)
- throw new ArgumentOutOfRangeException ("Positive number required.",
- "culture");
+ throw new ArgumentOutOfRangeException ("culture", "Positive "
+ + "number required.");
constructed = true;
-
- if(culture==0x007f) {
+ m_isReadOnly = read_only;
+ m_useUserOverride = use_user_override;
+
+ if (culture == InvariantCultureId) {
/* Short circuit the invariant culture */
- ConstructInvariant (use_user_override);
+ ConstructInvariant (read_only);
return;
}
"supported culture.", culture), "culture");
}
- public CultureInfo (int culture) : this (culture, false) {}
-
- public CultureInfo (string name, bool use_user_override)
+ public CultureInfo (string name) : this (name, true) {}
+
+ public CultureInfo (string name, bool use_user_override) :
+ this (name, use_user_override, false) {}
+
+ private CultureInfo (string name, bool use_user_override, bool read_only)
{
if (name == null)
- throw new ArgumentNullException ();
+ throw new ArgumentNullException ("name");
constructed = true;
-
- if(name.Length==0) {
+ m_isReadOnly = read_only;
+ m_useUserOverride = use_user_override;
+
+ if (name.Length == 0) {
/* Short circuit the invariant culture */
- ConstructInvariant (use_user_override);
+ ConstructInvariant (read_only);
return;
}
" is not supported.", "name");
}
- public CultureInfo (string name) : this (name, true) {}
-
// This is used when creating by specific name and creating by
// current locale so we can initialize the object without
// doing any member initialization
if (c != null)
return (CultureInfo) c;
}
- c = new CultureInfo (culture);
- c.m_isReadOnly = true;
-
+ c = new CultureInfo (culture, false, true);
insert_into_shared_tables (c);
return c;
}
if (c != null)
return (CultureInfo) c;
}
- c = new CultureInfo (name);
- c.m_isReadOnly = true;
+ c = new CultureInfo (name, false, true);
insert_into_shared_tables (c);
-
return c;
}
}
+2007-06-24 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * CultureInfoTest.cs: Added exception tests when invoking NumberFormat
+ or DateTimeFormat on a neutral culture. Added tests for bug #81930.
+ No longer derive from deprecated Assertion class. Added tests for
+ GetCultureInfo (2.0).
+
2007-06-01 Atsushi Enomoto <atsushi@ximian.com>
* CalendarTest.cs : test for bug #81783 and AddYears() for leap year
// (c) 2005 Novell, Inc. (http://www.novell.com)
//
-using NUnit.Framework;
-using System.IO;
using System;
using System.Globalization;
+using System.IO;
using System.Threading;
+using NUnit.Framework;
+
namespace MonoTests.System.Globalization
{
[TestFixture]
- public class CultureInfoTest : Assertion
+ public class CultureInfoTest
{
+ CultureInfo old_culture;
+
+ [SetUp]
+ public void Setup ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ }
+
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ [Test]
+ public void Constructor0 ()
+ {
+ CultureInfo ci = new CultureInfo (2067);
+ Assert.IsFalse (ci.IsReadOnly, "#1");
+ Assert.AreEqual (2067, ci.LCID, "#2");
+ Assert.AreEqual ("nl-BE", ci.Name, "#3");
+ Assert.IsTrue (ci.UseUserOverride, "#4");
+ }
+
+ [Test]
+ public void Constructor0_Identifier_Negative ()
+ {
+ try {
+ new CultureInfo (-1);
+ Assert.Fail ("#1");
+ } catch (ArgumentOutOfRangeException ex) {
+ Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("culture", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ public void Constructor1 ()
+ {
+ CultureInfo ci = new CultureInfo ("nl-BE");
+ Assert.IsFalse (ci.IsReadOnly, "#1");
+ Assert.AreEqual (2067, ci.LCID, "#2");
+ Assert.AreEqual ("nl-BE", ci.Name, "#3");
+ Assert.IsTrue (ci.UseUserOverride, "#4");
+ }
+
+ [Test]
+ public void Constructor1_Name_Null ()
+ {
+ try {
+ new CultureInfo ((string) null);
+ Assert.Fail ("#1");
+ } catch (ArgumentNullException ex) {
+ Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("name", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ public void Constructor2 ()
+ {
+ CultureInfo ci = new CultureInfo (2067, false);
+ Assert.IsFalse (ci.IsReadOnly, "#A1");
+ Assert.AreEqual (2067, ci.LCID, "#A2");
+ Assert.AreEqual ("nl-BE", ci.Name, "#A3");
+ Assert.IsFalse (ci.UseUserOverride, "#A4");
+
+ ci = new CultureInfo (2067, true);
+ Assert.IsFalse (ci.IsReadOnly, "#B1");
+ Assert.AreEqual (2067, ci.LCID, "#B2");
+ Assert.AreEqual ("nl-BE", ci.Name, "#B3");
+ Assert.IsTrue (ci.UseUserOverride, "#B4");
+ }
+
[Test]
- public void GetAllCulturesInvariant () // bug #72081
+ public void Constructor2_Identifier_Negative ()
+ {
+ try {
+ new CultureInfo (-1, false);
+ Assert.Fail ("#1");
+ } catch (ArgumentOutOfRangeException ex) {
+ Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("culture", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ public void Constructor3 ()
+ {
+ CultureInfo ci = new CultureInfo ("nl-BE", false);
+ Assert.IsFalse (ci.IsReadOnly, "#A1");
+ Assert.AreEqual (2067, ci.LCID, "#A2");
+ Assert.AreEqual ("nl-BE", ci.Name, "#A3");
+ Assert.IsFalse (ci.UseUserOverride, "#A4");
+
+ ci = new CultureInfo ("nl-BE", true);
+ Assert.IsFalse (ci.IsReadOnly, "#B1");
+ Assert.AreEqual (2067, ci.LCID, "#B2");
+ Assert.AreEqual ("nl-BE", ci.Name, "#B3");
+ Assert.IsTrue (ci.UseUserOverride, "#B4");
+ }
+
+ [Test]
+ public void Constructor3_Name_Null ()
+ {
+ try {
+ new CultureInfo ((string) null, false);
+ Assert.Fail ("#1");
+ } catch (ArgumentNullException ex) {
+ Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("name", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ public void DateTimeFormat_Neutral_Culture ()
+ {
+ CultureInfo ci = new CultureInfo ("nl");
+ try {
+ DateTimeFormatInfo dfi = ci.DateTimeFormat;
+ Assert.Fail ("#1:" + (dfi != null));
+ } catch (NotSupportedException ex) {
+ Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ }
+ }
+
+ [Test] // bug #72081
+ public void GetAllCulturesInvariant ()
{
CultureInfo invariant = CultureInfo.InvariantCulture;
CultureInfo [] infos = CultureInfo.GetCultures (CultureTypes.AllCultures);
return;
}
- Assert ("InvariantCulture not found in the array from GetCultures()", false);
+ Assert.Fail ("InvariantCulture not found in the array from GetCultures()");
}
[Test]
{
foreach (CultureInfo ci in CultureInfo.GetCultures (
CultureTypes.AllCultures))
- AssertNotNull (String.Format ("{0} {1}",
- ci.LCID, ci.Name), ci.OptionalCalendars);
+ Assert.IsNotNull (ci.OptionalCalendars, String.Format ("{0} {1}",
+ ci.LCID, ci.Name));
}
- [Test]
- public void CloneNeutral () // bug #77347
+ [Test] // bug #77347
+ public void CloneNeutral ()
{
CultureInfo culture = new CultureInfo ("en");
CultureInfo cultureClone = culture.Clone () as CultureInfo;
- Assert (culture.Equals (cultureClone));
+ Assert.IsTrue (culture.Equals (cultureClone));
+ }
+
+ [Test] // bug #81930
+ public void IsReadOnly ()
+ {
+ CultureInfo ci;
+
+ ci = new CultureInfo ("en-US");
+ Assert.IsFalse (ci.IsReadOnly, "#A1");
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#A2");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#A3");
+ ci.NumberFormat.NumberGroupSeparator = ",";
+ ci.NumberFormat = new NumberFormatInfo ();
+ ci.DateTimeFormat.DateSeparator = "/";
+ ci.DateTimeFormat = new DateTimeFormatInfo ();
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#A4");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#A5");
+
+ ci = new CultureInfo (CultureInfo.InvariantCulture.LCID);
+ Assert.IsFalse (ci.IsReadOnly, "#B1");
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#B2");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#B3");
+ ci.NumberFormat.NumberGroupSeparator = ",";
+ ci.NumberFormat = new NumberFormatInfo ();
+ ci.DateTimeFormat.DateSeparator = "/";
+ ci.DateTimeFormat = new DateTimeFormatInfo ();
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#B4");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#B5");
+
+ ci = CultureInfo.CurrentCulture;
+ Assert.IsTrue (ci.IsReadOnly, "#C1:" + ci.DisplayName);
+ Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#C2");
+ Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#C3");
+ try {
+ ci.NumberFormat.NumberGroupSeparator = ",";
+ Assert.Fail ("#C4");
+ } catch (InvalidOperationException ex) {
+ Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C5");
+ Assert.IsNull (ex.InnerException, "#C6");
+ Assert.IsNotNull (ex.Message, "#C7");
+ }
+
+ ci = CultureInfo.CurrentUICulture;
+ Assert.IsTrue (ci.IsReadOnly, "#D1");
+ Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#D2");
+ Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#D3");
+ try {
+ ci.NumberFormat.NumberGroupSeparator = ",";
+ Assert.Fail ("#D4");
+ } catch (InvalidOperationException ex) {
+ Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D5");
+ Assert.IsNull (ex.InnerException, "#D6");
+ Assert.IsNotNull (ex.Message, "#D7");
+ }
+
+ ci = CultureInfo.InvariantCulture;
+ Assert.IsTrue (ci.IsReadOnly, "#F1");
+ Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#F2");
+ Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#F3");
+ try {
+ ci.NumberFormat.NumberGroupSeparator = ",";
+ Assert.Fail ("#F4");
+ } catch (InvalidOperationException ex) {
+ Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F5");
+ Assert.IsNull (ex.InnerException, "#F6");
+ Assert.IsNotNull (ex.Message, "#F7");
+ }
+
+ ci = new CultureInfo (string.Empty);
+ Assert.IsFalse (ci.IsReadOnly, "#G1");
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#G2");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#G3");
+ ci.NumberFormat.NumberGroupSeparator = ",";
+ ci.NumberFormat = new NumberFormatInfo ();
+ ci.DateTimeFormat.DateSeparator = "/";
+ ci.DateTimeFormat = new DateTimeFormatInfo ();
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#G4");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#G5");
+ }
+
+ [Test]
+ public void IsReadOnly_GetCultures ()
+ {
+ foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
+ string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
+ Assert.IsFalse (ci.IsReadOnly, "#1:" + cultureMsg);
+ if (ci.IsNeutralCulture)
+ continue;
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#2:" + cultureMsg);
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#3:" + cultureMsg);
+ }
}
[Test]
- public void Norwegian () // bug #69652
+ [Category ("NotWorking")]
+ public void IsReadOnly_InstalledUICulture ()
+ {
+ CultureInfo ci = CultureInfo.InstalledUICulture;
+ Assert.IsTrue (ci.IsReadOnly, "#1");
+ Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#2");
+ Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#3");
+ try {
+ ci.NumberFormat.NumberGroupSeparator = ",";
+ Assert.Fail ("#4");
+ } catch (InvalidOperationException ex) {
+ Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#5");
+ Assert.IsNull (ex.InnerException, "#6");
+ Assert.IsNotNull (ex.Message, "#7");
+ }
+ }
+
+ [Test] // bug #69652
+ public void Norwegian ()
{
new CultureInfo ("no");
new CultureInfo ("nb-NO");
new CultureInfo ("nn-NO");
}
+
+ [Test]
+ public void NumberFormat_Neutral_Culture ()
+ {
+ CultureInfo ci = new CultureInfo ("nl");
+ try {
+ NumberFormatInfo nfi = ci.NumberFormat;
+ Assert.Fail ("#1:" + (nfi != null));
+ } catch (NotSupportedException ex) {
+ Assert.AreEqual (typeof (NotSupportedException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ }
+ }
+
+#if NET_2_0
+ [Test]
+ [Category ("NotDotNet")] // On MS, the NumberFormatInfo of the CultureInfo matching the current locale is not read-only
+ public void GetCultureInfo_Identifier ()
+ {
+ foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
+ string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
+ CultureInfo culture = CultureInfo.GetCultureInfo (ci.LCID);
+ Assert.IsTrue (culture.IsReadOnly, "#1:" + cultureMsg);
+ if (culture.IsNeutralCulture)
+ continue;
+ Assert.IsTrue (culture.NumberFormat.IsReadOnly, "#2:" + cultureMsg);
+ Assert.IsTrue (culture.DateTimeFormat.IsReadOnly, "#3:" + cultureMsg);
+ }
+ }
+
+ [Test]
+ public void GetCultureInfo_Identifier_Negative ()
+ {
+ try {
+ CultureInfo.GetCultureInfo (-1);
+ Assert.Fail ("#1");
+ } catch (ArgumentOutOfRangeException ex) {
+ Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("culture", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ public void GetCultureInfo_Identifier_NotSupported ()
+ {
+ try {
+ CultureInfo.GetCultureInfo (666);
+ Assert.Fail ("#1");
+ } catch (ArgumentException ex) {
+ Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("culture", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ [Category ("NotDotNet")] // On MS, the NumberFormatInfo of the CultureInfo matching the current locale is not read-only
+ public void GetCultureInfo_Name ()
+ {
+ foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
+ string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
+ CultureInfo culture = CultureInfo.GetCultureInfo (ci.Name);
+ Assert.IsTrue (culture.IsReadOnly, "#1:" + cultureMsg);
+ if (culture.IsNeutralCulture)
+ continue;
+ Assert.IsTrue (culture.NumberFormat.IsReadOnly, "#2:" + cultureMsg);
+ Assert.IsTrue (culture.DateTimeFormat.IsReadOnly, "#3:" + cultureMsg);
+ }
+ }
+
+ [Test]
+ public void GetCultureInfo_Name_NotSupported ()
+ {
+ try {
+ CultureInfo.GetCultureInfo ("666");
+ Assert.Fail ("#1");
+ } catch (ArgumentException ex) {
+ Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("name", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ public void GetCultureInfo_Name_Null ()
+ {
+ try {
+ CultureInfo.GetCultureInfo ((string) null);
+ Assert.Fail ("#1");
+ } catch (ArgumentNullException ex) {
+ Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("name", ex.ParamName, "#6");
+ }
+ }
+#endif
+
+ [Test]
+ public void UseUserOverride_CurrentCulture ()
+ {
+ CultureInfo ci = CultureInfo.CurrentCulture;
+ Assert.IsTrue (ci.UseUserOverride, "#1");
+
+ ci = (CultureInfo) ci.Clone ();
+ Assert.IsTrue (ci.UseUserOverride, "#2");
+ }
+
+ [Test]
+ public void UseUserOverride_CurrentUICulture ()
+ {
+ CultureInfo ci = CultureInfo.CurrentCulture;
+ Assert.IsTrue (ci.UseUserOverride, "#1");
+
+ ci = (CultureInfo) ci.Clone ();
+ Assert.IsTrue (ci.UseUserOverride, "#2");
+ }
+
+#if NET_2_0
+ [Test]
+ public void UseUserOverride_GetCultureInfo ()
+ {
+ CultureInfo culture;
+
+ foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
+ string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
+ culture = CultureInfo.GetCultureInfo (ci.Name);
+ Assert.IsFalse (culture.UseUserOverride, "#1: " + cultureMsg);
+ culture = CultureInfo.GetCultureInfo (ci.LCID);
+ Assert.IsFalse (culture.UseUserOverride, "#2: " + cultureMsg);
+ }
+ }
+#endif
+
+ [Test]
+ public void UseUserOverride_GetCultures ()
+ {
+ foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) {
+ string cultureMsg = String.Format ("{0} {1}", ci.LCID, ci.Name);
+#if NET_2_0
+ if (ci.LCID == CultureInfo.InvariantCulture.LCID)
+ Assert.IsFalse (ci.UseUserOverride, cultureMsg);
+ else
+ Assert.IsTrue (ci.UseUserOverride, cultureMsg);
+#else
+ Assert.IsTrue (ci.UseUserOverride, cultureMsg);
+#endif
+ }
+ }
+
+ [Test]
+ public void UseUserOverride_InvariantCulture ()
+ {
+ CultureInfo ci = CultureInfo.InvariantCulture;
+ Assert.IsFalse (ci.UseUserOverride, "#21");
+
+ ci = (CultureInfo) ci.Clone ();
+ Assert.IsFalse (ci.UseUserOverride, "#2");
+ }
}
}
-
+2007-06-24 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * DirectoryTest.cs: Restore original CurrentCulture on teardown.
+ * FileSystemInfoTest.cs: Restore original CurrentCulture on teardown.
+ Removed stray tabs. Code formatting.
+ * FileTest.cs: Restore original CurrentCulture on teardown. Removed
+ stray tabs. Changes spaces to tabs.
+
2007-06-22 Gert Driesen <drieseng@users.sourceforge.net>
* FileStreamTest.cs: Added test for bug #79250.
[TestFixture]\r
public class DirectoryTest\r
{\r
+ CultureInfo old_culture;\r
string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");\r
static readonly char DSC = Path.DirectorySeparatorChar;\r
\r
{\r
if (!Directory.Exists (TempFolder))\r
Directory.CreateDirectory (TempFolder);\r
-\r
- Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");\r
+ old_culture = Thread.CurrentThread.CurrentCulture;\r
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);\r
}\r
\r
[TearDown]\r
public void TearDown () {\r
if (Directory.Exists (TempFolder))\r
Directory.Delete (TempFolder, true);\r
+ Thread.CurrentThread.CurrentCulture = old_culture;\r
}\r
\r
[Test]\r
// (C) 2003 Ville Palo
//
-using NUnit.Framework;
using System;
-using System.IO;
using System.Globalization;
+using System.IO;
using System.Threading;
+using NUnit.Framework;
namespace MonoTests.System.IO
{
[TestFixture]
- public class FileSystemInfoTest : Assertion
+ public class FileSystemInfoTest : Assertion
{
+ CultureInfo old_culture;
string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
static readonly char DSC = Path.DirectorySeparatorChar;
[SetUp]
- protected void SetUp()
+ protected void SetUp()
{
if (Directory.Exists (TempFolder))
Directory.Delete (TempFolder, true);
Directory.CreateDirectory (TempFolder);
- Thread.CurrentThread.CurrentCulture = new CultureInfo ("EN-us");
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
}
[TearDown]
- protected void TearDown() {
+ protected void TearDown()
+ {
if (Directory.Exists (TempFolder))
Directory.Delete (TempFolder, true);
+ Thread.CurrentThread.CurrentCulture = old_culture;
}
bool Windows
string path = TempFolder + DSC + "FSIT.CreationTime.Test";
DeleteFile (path);
if (Unix) { // Unix doesn't support CreationTimes
- return;
+ return;
}
try {
File.Create (path).Close ();
FileSystemInfo info = new FileInfo (path);
info.CreationTime = new DateTime (1999, 12, 31, 11, 59, 59);
- DateTime time = info.CreationTime;
+ DateTime time = info.CreationTime;
AssertEquals ("test#01", 1999, time.Year);
AssertEquals ("test#02", 12, time.Month);
AssertEquals ("test#03", 31, time.Day);
AssertEquals ("test#05", 59, time.Minute);
AssertEquals ("test#06", 59, time.Second);
- time = TimeZone.CurrentTimeZone.ToLocalTime (info.CreationTimeUtc);
+ time = TimeZone.CurrentTimeZone.ToLocalTime (info.CreationTimeUtc);
AssertEquals ("test#07", 1999, time.Year);
AssertEquals ("test#08", 12, time.Month);
AssertEquals ("test#09", 31, time.Day);
info.CreationTimeUtc = new DateTime (1999, 12, 31, 11, 59, 59);
- time = TimeZone.CurrentTimeZone.ToUniversalTime (info.CreationTime);
+ time = TimeZone.CurrentTimeZone.ToUniversalTime (info.CreationTime);
AssertEquals ("test#13", 1999, time.Year);
AssertEquals ("test#14", 12, time.Month);
AssertEquals ("test#15", 31, time.Day);
AssertEquals ("test#17", 59, time.Minute);
AssertEquals ("test#18", 59, time.Second);
- time = info.CreationTimeUtc;
+ time = info.CreationTimeUtc;
AssertEquals ("test#19", 1999, time.Year);
AssertEquals ("test#20", 12, time.Month);
AssertEquals ("test#21", 31, time.Day);
string path = TempFolder + DSC + "FSIT.CreationTimeDirectory.Test";
DeleteDir (path);
if (Unix) { // Unix doesn't support CreationTimes
- return;
+ return;
}
- try {
+ try {
FileSystemInfo info = Directory.CreateDirectory (path);
info.CreationTime = new DateTime (1999, 12, 31, 11, 59, 59);
- DateTime time = info.CreationTime;
+ DateTime time = info.CreationTime;
AssertEquals ("test#01", 1999, time.Year);
AssertEquals ("test#02", 12, time.Month);
AssertEquals ("test#03", 31, time.Day);
- time = TimeZone.CurrentTimeZone.ToLocalTime (info.CreationTimeUtc);
+ time = TimeZone.CurrentTimeZone.ToLocalTime (info.CreationTimeUtc);
AssertEquals ("test#07", 1999, time.Year);
AssertEquals ("test#08", 12, time.Month);
AssertEquals ("test#09", 31, time.Day);
info.CreationTimeUtc = new DateTime (1999, 12, 31, 11, 59, 59);
- time = TimeZone.CurrentTimeZone.ToUniversalTime (info.CreationTime);
+ time = TimeZone.CurrentTimeZone.ToUniversalTime (info.CreationTime);
AssertEquals ("test#13", 1999, time.Year);
AssertEquals ("test#14", 12, time.Month);
AssertEquals ("test#15", 31, time.Day);
- time = TimeZone.CurrentTimeZone.ToLocalTime (info.CreationTimeUtc);
+ time = TimeZone.CurrentTimeZone.ToLocalTime (info.CreationTimeUtc);
AssertEquals ("test#19", 1999, time.Year);
AssertEquals ("test#20", 12, time.Month);
AssertEquals ("test#21", 31, time.Day);
AssertEquals ("test#13", 2000, time.Year);
AssertEquals ("test#14", 1, time.Month);
AssertEquals ("test#15", 1, time.Day);
- AssertEquals ("test#16", 1, time.Hour);
+ AssertEquals ("test#16", 1, time.Hour);
} finally {
DeleteFile (path);
[TestFixture]
public class FileTest : Assertion
{
+ CultureInfo old_culture;
static string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
[SetUp]
if (Directory.Exists (TempFolder))
Directory.Delete (TempFolder, true);
Directory.CreateDirectory (TempFolder);
-
- Thread.CurrentThread.CurrentCulture = new CultureInfo ("EN-us");
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
}
[TearDown]
{
if (Directory.Exists (TempFolder))
Directory.Delete (TempFolder, true);
+ Thread.CurrentThread.CurrentCulture = old_culture;
}
[Test]
Assert ("empty filename should not exist", !File.Exists (""));
i++;
Assert ("whitespace filename should not exist", !File.Exists (" \t\t \t \n\t\n \n"));
- i++;
+ i++;
DeleteFile (path);
s = File.Create (path);
s.Close ();
[Test]
[ExpectedException(typeof (ArgumentNullException))]
public void CtorArgumentNullException1 ()
- {
+ {
FileStream stream = File.Create (null);
}
[Test]
[ExpectedException(typeof (ArgumentException))]
public void CtorArgumentException1 ()
- {
+ {
FileStream stream = File.Create ("");
}
[Test]
[ExpectedException(typeof (ArgumentException))]
public void CtorArgumentException2 ()
- {
+ {
FileStream stream = File.Create (" ");
}
[Test]
[ExpectedException(typeof (DirectoryNotFoundException))]
public void CtorDirectoryNotFoundException ()
- {
+ {
FileStream stream = null;
string path = TempFolder + Path.DirectorySeparatorChar + "directory_does_not_exist" + Path.DirectorySeparatorChar + "foo";
File.Copy (TempFolder + Path.DirectorySeparatorChar + "AFile.txt", TempFolder + Path.DirectorySeparatorChar + "bar");
} finally {
DeleteFile (TempFolder + Path.DirectorySeparatorChar + "bar");
- DeleteFile (TempFolder + Path.DirectorySeparatorChar + "AFile.txt");
+ DeleteFile (TempFolder + Path.DirectorySeparatorChar + "AFile.txt");
}
}
}finally {
DeleteFile (path1);
DeleteFile (path2);
- }
+ }
}
[Test]
string path = TempFolder + Path.DirectorySeparatorChar + "directory_does_not_exist" + Path.DirectorySeparatorChar + "foo";
if (Directory.Exists (path))
Directory.Delete (path, true);
- File.Delete (path);
+ File.Delete (path);
}
try {
File.Create (foopath).Close ();
- try {
- File.Delete (foopath);
- } catch (Exception e) {
- Fail ("Unable to delete " + foopath + " e=" + e.ToString());
- }
+ try {
+ File.Delete (foopath);
+ } catch (Exception e) {
+ Fail ("Unable to delete " + foopath + " e=" + e.ToString());
+ }
Assert ("File " + foopath + " should not exist after File.Delete", !File.Exists (foopath));
} finally {
- DeleteFile (foopath);
+ DeleteFile (foopath);
}
}
public void DeleteOpenStreamException ()
{
string path = TempFolder + Path.DirectorySeparatorChar + "DeleteOpenStreamException";
- DeleteFile (path);
+ DeleteFile (path);
FileStream stream = null;
try {
stream = new FileStream (path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
[ExpectedException(typeof (ArgumentNullException))]
public void MoveException1 ()
{
- File.Move (null, "b");
+ File.Move (null, "b");
}
[Test]
[ExpectedException(typeof (ArgumentException))]
public void MoveException3 ()
{
- File.Move ("", "b");
+ File.Move ("", "b");
}
[Test]
[ExpectedException(typeof (ArgumentException))]
public void MoveException4 ()
{
- File.Move ("a", "");
+ File.Move ("a", "");
}
[Test]
[ExpectedException(typeof (ArgumentException))]
public void MoveException5 ()
{
- File.Move (" ", "b");
+ File.Move (" ", "b");
}
[Test]
[ExpectedException(typeof (ArgumentException))]
public void MoveException6 ()
{
- File.Move ("a", " ");
+ File.Move ("a", " ");
}
[Test]
[ExpectedException(typeof (FileNotFoundException))]
public void MoveException7 ()
{
- DeleteFile (TempFolder + Path.DirectorySeparatorChar + "doesnotexist");
- File.Move (TempFolder + Path.DirectorySeparatorChar + "doesnotexist", "b");
+ DeleteFile (TempFolder + Path.DirectorySeparatorChar + "doesnotexist");
+ File.Move (TempFolder + Path.DirectorySeparatorChar + "doesnotexist", "b");
}
[Test]
public void MoveException8 ()
{
string path = TempFolder + Path.DirectorySeparatorChar + "foo";
- DeleteFile (path);
+ DeleteFile (path);
try {
File.Create (TempFolder + Path.DirectorySeparatorChar + "AFile.txt").Close ();
- File.Copy(TempFolder + Path.DirectorySeparatorChar + "AFile.txt", path, true);
- DeleteFile (TempFolder + Path.DirectorySeparatorChar + "doesnotexist" + Path.DirectorySeparatorChar + "b");
- File.Move (TempFolder + Path.DirectorySeparatorChar + "foo", TempFolder + Path.DirectorySeparatorChar + "doesnotexist" + Path.DirectorySeparatorChar + "b");
+ File.Copy(TempFolder + Path.DirectorySeparatorChar + "AFile.txt", path, true);
+ DeleteFile (TempFolder + Path.DirectorySeparatorChar + "doesnotexist" + Path.DirectorySeparatorChar + "b");
+ File.Move (TempFolder + Path.DirectorySeparatorChar + "foo", TempFolder + Path.DirectorySeparatorChar + "doesnotexist" + Path.DirectorySeparatorChar + "b");
} finally {
DeleteFile (TempFolder + Path.DirectorySeparatorChar + "AFile.txt");
DeleteFile (path);
{
File.Create (TempFolder + Path.DirectorySeparatorChar + "foo").Close ();
try {
- File.Move (TempFolder + Path.DirectorySeparatorChar + "foo", TempFolder);
+ File.Move (TempFolder + Path.DirectorySeparatorChar + "foo", TempFolder);
} finally {
DeleteFile (TempFolder + Path.DirectorySeparatorChar + "foo");
}
{
string path = "";
FileStream stream = null;
- try {
- path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+ try {
+ path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
if (!File.Exists (path))
stream = File.Create (path);
- stream.Close ();
- stream = File.Open (path, FileMode.Open);
stream.Close ();
- } catch (Exception e) {
- Fail ("Unable to open " + TempFolder + Path.DirectorySeparatorChar + "AFile.txt: e=" + e.ToString());
- } finally {
- if (stream != null)
- stream.Close ();
- DeleteFile (path);
- }
+ stream = File.Open (path, FileMode.Open);
+ stream.Close ();
+ } catch (Exception e) {
+ Fail ("Unable to open " + TempFolder + Path.DirectorySeparatorChar + "AFile.txt: e=" + e.ToString());
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ DeleteFile (path);
+ }
path = "";
stream = null;
- /* Exception tests */
+ /* Exception tests */
try {
path = TempFolder + Path.DirectorySeparatorChar + "filedoesnotexist";
stream = File.Open (path, FileMode.Open);
}
}
- [Test]
- public void Open ()
- {
- string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+ [Test]
+ public void Open ()
+ {
+ string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
if (!File.Exists (path))
File.Create (path).Close ();
FileStream stream = null;
- try {
-
+ try {
stream = File.Open (path, FileMode.Open);
-
- Assertion.AssertEquals ("test#01", true, stream.CanRead);
- Assertion.AssertEquals ("test#02", true, stream.CanSeek);
- Assertion.AssertEquals ("test#03", true, stream.CanWrite);
- stream.Close ();
-
- stream = File.Open (path, FileMode.Open, FileAccess.Write);
- Assertion.AssertEquals ("test#04", false, stream.CanRead);
- Assertion.AssertEquals ("test#05", true, stream.CanSeek);
- Assertion.AssertEquals ("test#06", true, stream.CanWrite);
- stream.Close ();
-
- stream = File.Open (path, FileMode.Open, FileAccess.Read);
- Assertion.AssertEquals ("test#04", true, stream.CanRead);
- Assertion.AssertEquals ("test#05", true, stream.CanSeek);
- Assertion.AssertEquals ("test#06", false, stream.CanWrite);
- stream.Close ();
-
- } finally {
- if (stream != null)
- stream.Close ();
- DeleteFile (path);
- }
- }
-
- [Test]
- [ExpectedException(typeof(ArgumentException))]
- public void OpenException1 ()
- {
- string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
- FileStream stream = null;
- // CreateNew + Read throws an exceptoin
- try {
- stream = File.Open (TempFolder + Path.DirectorySeparatorChar + "AFile.txt", FileMode.CreateNew, FileAccess.Read);
- } finally {
- if (stream != null)
- stream.Close ();
- DeleteFile (path);
- }
- }
-
- [Test]
- [ExpectedException(typeof(ArgumentException))]
- public void OpenException2 ()
- {
- string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
- FileStream s = null;
- // Append + Read throws an exceptoin
+ Assertion.AssertEquals ("test#01", true, stream.CanRead);
+ Assertion.AssertEquals ("test#02", true, stream.CanSeek);
+ Assertion.AssertEquals ("test#03", true, stream.CanWrite);
+ stream.Close ();
+
+ stream = File.Open (path, FileMode.Open, FileAccess.Write);
+ Assertion.AssertEquals ("test#04", false, stream.CanRead);
+ Assertion.AssertEquals ("test#05", true, stream.CanSeek);
+ Assertion.AssertEquals ("test#06", true, stream.CanWrite);
+ stream.Close ();
+
+ stream = File.Open (path, FileMode.Open, FileAccess.Read);
+ Assertion.AssertEquals ("test#04", true, stream.CanRead);
+ Assertion.AssertEquals ("test#05", true, stream.CanSeek);
+ Assertion.AssertEquals ("test#06", false, stream.CanWrite);
+ stream.Close ();
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ DeleteFile (path);
+ }
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void OpenException1 ()
+ {
+ string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+ FileStream stream = null;
+ // CreateNew + Read throws an exceptoin
+ try {
+ stream = File.Open (TempFolder + Path.DirectorySeparatorChar + "AFile.txt", FileMode.CreateNew, FileAccess.Read);
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ DeleteFile (path);
+ }
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void OpenException2 ()
+ {
+ string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+ FileStream s = null;
+ // Append + Read throws an exceptoin
if (!File.Exists (path))
File.Create (path).Close ();
- try {
- s = File.Open (path, FileMode.Append, FileAccess.Read);
- } finally {
- if (s != null)
- s.Close ();
- DeleteFile (path);
- }
- }
-
- [Test]
- public void OpenRead ()
- {
- string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+ try {
+ s = File.Open (path, FileMode.Append, FileAccess.Read);
+ } finally {
+ if (s != null)
+ s.Close ();
+ DeleteFile (path);
+ }
+ }
+
+ [Test]
+ public void OpenRead ()
+ {
+ string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
if (!File.Exists (path))
File.Create (path).Close ();
- FileStream stream = null;
-
- try {
+ FileStream stream = null;
+
+ try {
stream = File.OpenRead (path);
-
- Assertion.AssertEquals ("test#01", true, stream.CanRead);
- Assertion.AssertEquals ("test#02", true, stream.CanSeek);
- Assertion.AssertEquals ("test#03", false, stream.CanWrite);
-
- } finally {
- if (stream != null)
- stream.Close ();
- DeleteFile (path);
- }
- }
-
- [Test]
- public void OpenWrite ()
- {
- string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
+ Assertion.AssertEquals ("test#01", true, stream.CanRead);
+ Assertion.AssertEquals ("test#02", true, stream.CanSeek);
+ Assertion.AssertEquals ("test#03", false, stream.CanWrite);
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ DeleteFile (path);
+ }
+ }
+
+ [Test]
+ public void OpenWrite ()
+ {
+ string path = TempFolder + Path.DirectorySeparatorChar + "AFile.txt";
if (!File.Exists (path))
File.Create (path).Close ();
- FileStream stream = null;
-
- try {
+ FileStream stream = null;
+
+ try {
stream = File.OpenWrite (path);
- Assertion.AssertEquals ("test#01", false, stream.CanRead);
- Assertion.AssertEquals ("test#02", true, stream.CanSeek);
- Assertion.AssertEquals ("test#03", true, stream.CanWrite);
- stream.Close ();
- } finally {
- if (stream != null)
- stream.Close ();
- DeleteFile (path);
- }
- }
+ Assertion.AssertEquals ("test#01", false, stream.CanRead);
+ Assertion.AssertEquals ("test#02", true, stream.CanSeek);
+ Assertion.AssertEquals ("test#03", true, stream.CanWrite);
+ stream.Close ();
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ DeleteFile (path);
+ }
+ }
[Test]
[Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
public void TestGetCreationTime ()
{
- string path = TempFolder + Path.DirectorySeparatorChar + "baz";
- DeleteFile (path);
-
- try {
+ string path = TempFolder + Path.DirectorySeparatorChar + "baz";
+ DeleteFile (path);
+
+ try {
File.Create (path).Close();
- DateTime time = File.GetCreationTime (path);
- Assert ("GetCreationTime incorrect", (DateTime.Now - time).TotalSeconds < 10);
- } finally {
- DeleteFile (path);
- }
+ DateTime time = File.GetCreationTime (path);
+ Assert ("GetCreationTime incorrect", (DateTime.Now - time).TotalSeconds < 10);
+ } finally {
+ DeleteFile (path);
+ }
}
// Setting the creation time on Unix is not possible
- [Test]
+ [Test]
[Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
- public void CreationTime ()
- {
+ public void CreationTime ()
+ {
int platform = (int) Environment.OSVersion.Platform;
if ((platform == 4) || (platform == 128))
return;
- string path = Path.GetTempFileName ();
-
- try {
- File.SetCreationTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
- DateTime time = File.GetCreationTime (path);
- Assertion.AssertEquals ("test#01", 2002, time.Year);
- Assertion.AssertEquals ("test#02", 4, time.Month);
- Assertion.AssertEquals ("test#03", 6, time.Day);
- Assertion.AssertEquals ("test#04", 4, time.Hour);
- Assertion.AssertEquals ("test#05", 4, time.Second);
-
- time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetCreationTimeUtc (path));
- Assertion.AssertEquals ("test#06", 2002, time.Year);
- Assertion.AssertEquals ("test#07", 4, time.Month);
- Assertion.AssertEquals ("test#08", 6, time.Day);
- Assertion.AssertEquals ("test#09", 4, time.Hour);
- Assertion.AssertEquals ("test#10", 4, time.Second);
-
- File.SetCreationTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
- time = File.GetCreationTimeUtc (path);
- Assertion.AssertEquals ("test#11", 2002, time.Year);
- Assertion.AssertEquals ("test#12", 4, time.Month);
- Assertion.AssertEquals ("test#13", 6, time.Day);
- Assertion.AssertEquals ("test#14", 4, time.Hour);
- Assertion.AssertEquals ("test#15", 4, time.Second);
-
- time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetCreationTime (path));
- Assertion.AssertEquals ("test#16", 2002, time.Year);
- Assertion.AssertEquals ("test#17", 4, time.Month);
- Assertion.AssertEquals ("test#18", 6, time.Day);
- Assertion.AssertEquals ("test#19", 4, time.Hour);
- Assertion.AssertEquals ("test#20", 4, time.Second);
- } finally {
- DeleteFile (path);
- }
- }
-
- [Test]
+ string path = Path.GetTempFileName ();
+ try {
+ File.SetCreationTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
+ DateTime time = File.GetCreationTime (path);
+ Assertion.AssertEquals ("test#01", 2002, time.Year);
+ Assertion.AssertEquals ("test#02", 4, time.Month);
+ Assertion.AssertEquals ("test#03", 6, time.Day);
+ Assertion.AssertEquals ("test#04", 4, time.Hour);
+ Assertion.AssertEquals ("test#05", 4, time.Second);
+
+ time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetCreationTimeUtc (path));
+ Assertion.AssertEquals ("test#06", 2002, time.Year);
+ Assertion.AssertEquals ("test#07", 4, time.Month);
+ Assertion.AssertEquals ("test#08", 6, time.Day);
+ Assertion.AssertEquals ("test#09", 4, time.Hour);
+ Assertion.AssertEquals ("test#10", 4, time.Second);
+
+ File.SetCreationTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
+ time = File.GetCreationTimeUtc (path);
+ Assertion.AssertEquals ("test#11", 2002, time.Year);
+ Assertion.AssertEquals ("test#12", 4, time.Month);
+ Assertion.AssertEquals ("test#13", 6, time.Day);
+ Assertion.AssertEquals ("test#14", 4, time.Hour);
+ Assertion.AssertEquals ("test#15", 4, time.Second);
+
+ time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetCreationTime (path));
+ Assertion.AssertEquals ("test#16", 2002, time.Year);
+ Assertion.AssertEquals ("test#17", 4, time.Month);
+ Assertion.AssertEquals ("test#18", 6, time.Day);
+ Assertion.AssertEquals ("test#19", 4, time.Hour);
+ Assertion.AssertEquals ("test#20", 4, time.Second);
+ } finally {
+ DeleteFile (path);
+ }
+ }
+
+ [Test]
[Category("TargetJvmNotSupported")] // GetLastAccessTime not supported for TARGET_JVM
- public void LastAccessTime ()
- {
- string path = TempFolder + Path.DirectorySeparatorChar + "lastAccessTime";
- if (File.Exists (path))
- File.Delete (path);
+ public void LastAccessTime ()
+ {
+ string path = TempFolder + Path.DirectorySeparatorChar + "lastAccessTime";
+ if (File.Exists (path))
+ File.Delete (path);
FileStream stream = null;
- try {
- stream = File.Create (path);
- stream.Close ();
-
- File.SetLastAccessTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
- DateTime time = File.GetLastAccessTime (path);
- Assertion.AssertEquals ("test#01", 2002, time.Year);
- Assertion.AssertEquals ("test#02", 4, time.Month);
- Assertion.AssertEquals ("test#03", 6, time.Day);
- Assertion.AssertEquals ("test#04", 4, time.Hour);
- Assertion.AssertEquals ("test#05", 4, time.Second);
-
- time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastAccessTimeUtc (path));
- Assertion.AssertEquals ("test#06", 2002, time.Year);
- Assertion.AssertEquals ("test#07", 4, time.Month);
- Assertion.AssertEquals ("test#08", 6, time.Day);
- Assertion.AssertEquals ("test#09", 4, time.Hour);
- Assertion.AssertEquals ("test#10", 4, time.Second);
-
- File.SetLastAccessTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
- time = File.GetLastAccessTimeUtc (path);
- Assertion.AssertEquals ("test#11", 2002, time.Year);
- Assertion.AssertEquals ("test#12", 4, time.Month);
- Assertion.AssertEquals ("test#13", 6, time.Day);
- Assertion.AssertEquals ("test#14", 4, time.Hour);
- Assertion.AssertEquals ("test#15", 4, time.Second);
-
- time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastAccessTime (path));
- Assertion.AssertEquals ("test#16", 2002, time.Year);
- Assertion.AssertEquals ("test#17", 4, time.Month);
- Assertion.AssertEquals ("test#18", 6, time.Day);
- Assertion.AssertEquals ("test#19", 4, time.Hour);
- Assertion.AssertEquals ("test#20", 4, time.Second);
- } finally {
- if (stream != null)
- stream.Close ();
- DeleteFile (path);
- }
- }
-
- [Test]
- public void LastWriteTime ()
- {
- string path = TempFolder + Path.DirectorySeparatorChar + "lastWriteTime";
- if (File.Exists (path))
- File.Delete (path);
- FileStream stream = null;
- try {
- stream = File.Create (path);
- stream.Close ();
-
- File.SetLastWriteTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
- DateTime time = File.GetLastWriteTime (path);
- Assertion.AssertEquals ("test#01", 2002, time.Year);
- Assertion.AssertEquals ("test#02", 4, time.Month);
- Assertion.AssertEquals ("test#03", 6, time.Day);
- Assertion.AssertEquals ("test#04", 4, time.Hour);
- Assertion.AssertEquals ("test#05", 4, time.Second);
-
- time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastWriteTimeUtc (path));
- Assertion.AssertEquals ("test#06", 2002, time.Year);
- Assertion.AssertEquals ("test#07", 4, time.Month);
- Assertion.AssertEquals ("test#08", 6, time.Day);
- Assertion.AssertEquals ("test#09", 4, time.Hour);
- Assertion.AssertEquals ("test#10", 4, time.Second);
-
- File.SetLastWriteTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
- time = File.GetLastWriteTimeUtc (path);
- Assertion.AssertEquals ("test#11", 2002, time.Year);
- Assertion.AssertEquals ("test#12", 4, time.Month);
- Assertion.AssertEquals ("test#13", 6, time.Day);
- Assertion.AssertEquals ("test#14", 4, time.Hour);
- Assertion.AssertEquals ("test#15", 4, time.Second);
-
- time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastWriteTime (path));
- Assertion.AssertEquals ("test#16", 2002, time.Year);
- Assertion.AssertEquals ("test#17", 4, time.Month);
- Assertion.AssertEquals ("test#18", 6, time.Day);
- Assertion.AssertEquals ("test#19", 4, time.Hour);
- Assertion.AssertEquals ("test#20", 4, time.Second);
- } finally {
- if (stream != null)
- stream.Close ();
- DeleteFile (path);
- }
- }
-
- [Test]
- [ExpectedException(typeof(ArgumentNullException))]
+ try {
+ stream = File.Create (path);
+ stream.Close ();
+
+ File.SetLastAccessTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
+ DateTime time = File.GetLastAccessTime (path);
+ Assertion.AssertEquals ("test#01", 2002, time.Year);
+ Assertion.AssertEquals ("test#02", 4, time.Month);
+ Assertion.AssertEquals ("test#03", 6, time.Day);
+ Assertion.AssertEquals ("test#04", 4, time.Hour);
+ Assertion.AssertEquals ("test#05", 4, time.Second);
+
+ time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastAccessTimeUtc (path));
+ Assertion.AssertEquals ("test#06", 2002, time.Year);
+ Assertion.AssertEquals ("test#07", 4, time.Month);
+ Assertion.AssertEquals ("test#08", 6, time.Day);
+ Assertion.AssertEquals ("test#09", 4, time.Hour);
+ Assertion.AssertEquals ("test#10", 4, time.Second);
+
+ File.SetLastAccessTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
+ time = File.GetLastAccessTimeUtc (path);
+ Assertion.AssertEquals ("test#11", 2002, time.Year);
+ Assertion.AssertEquals ("test#12", 4, time.Month);
+ Assertion.AssertEquals ("test#13", 6, time.Day);
+ Assertion.AssertEquals ("test#14", 4, time.Hour);
+ Assertion.AssertEquals ("test#15", 4, time.Second);
+
+ time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastAccessTime (path));
+ Assertion.AssertEquals ("test#16", 2002, time.Year);
+ Assertion.AssertEquals ("test#17", 4, time.Month);
+ Assertion.AssertEquals ("test#18", 6, time.Day);
+ Assertion.AssertEquals ("test#19", 4, time.Hour);
+ Assertion.AssertEquals ("test#20", 4, time.Second);
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ DeleteFile (path);
+ }
+ }
+
+ [Test]
+ public void LastWriteTime ()
+ {
+ string path = TempFolder + Path.DirectorySeparatorChar + "lastWriteTime";
+ if (File.Exists (path))
+ File.Delete (path);
+ FileStream stream = null;
+ try {
+ stream = File.Create (path);
+ stream.Close ();
+
+ File.SetLastWriteTime (path, new DateTime (2002, 4, 6, 4, 6, 4));
+ DateTime time = File.GetLastWriteTime (path);
+ Assertion.AssertEquals ("test#01", 2002, time.Year);
+ Assertion.AssertEquals ("test#02", 4, time.Month);
+ Assertion.AssertEquals ("test#03", 6, time.Day);
+ Assertion.AssertEquals ("test#04", 4, time.Hour);
+ Assertion.AssertEquals ("test#05", 4, time.Second);
+
+ time = TimeZone.CurrentTimeZone.ToLocalTime (File.GetLastWriteTimeUtc (path));
+ Assertion.AssertEquals ("test#06", 2002, time.Year);
+ Assertion.AssertEquals ("test#07", 4, time.Month);
+ Assertion.AssertEquals ("test#08", 6, time.Day);
+ Assertion.AssertEquals ("test#09", 4, time.Hour);
+ Assertion.AssertEquals ("test#10", 4, time.Second);
+
+ File.SetLastWriteTimeUtc (path, new DateTime (2002, 4, 6, 4, 6, 4));
+ time = File.GetLastWriteTimeUtc (path);
+ Assertion.AssertEquals ("test#11", 2002, time.Year);
+ Assertion.AssertEquals ("test#12", 4, time.Month);
+ Assertion.AssertEquals ("test#13", 6, time.Day);
+ Assertion.AssertEquals ("test#14", 4, time.Hour);
+ Assertion.AssertEquals ("test#15", 4, time.Second);
+
+ time = TimeZone.CurrentTimeZone.ToUniversalTime (File.GetLastWriteTime (path));
+ Assertion.AssertEquals ("test#16", 2002, time.Year);
+ Assertion.AssertEquals ("test#17", 4, time.Month);
+ Assertion.AssertEquals ("test#18", 6, time.Day);
+ Assertion.AssertEquals ("test#19", 4, time.Hour);
+ Assertion.AssertEquals ("test#20", 4, time.Second);
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ DeleteFile (path);
+ }
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentNullException))]
[Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
public void GetCreationTimeException1 ()
{
}
[Test]
- [ExpectedException(typeof(ArgumentException))]
+ [ExpectedException(typeof(ArgumentException))]
[Category("TargetJvmNotSupported")] // GetCreationTime not supported for TARGET_JVM
public void GetCreationTimeException2 ()
{
// string path = TempFolder + Path.DirectorySeparatorChar + "SetCreationTimeUtcArgumentOutOfRangeException1";
// DeleteFile (path);
// FileStream stream = null;
-// try {
+// try {
// stream = File.Create (path);
// stream.Close ();
// File.SetCreationTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
public void OpenAppend ()
{
string fn = Path.GetTempFileName ();
- using (FileStream s = File.Open (fn, FileMode.Append))
- ;
-
+ using (FileStream s = File.Open (fn, FileMode.Append)) {
+ }
DeleteFile (fn);
}
TestRWAT ("\r\n");
TestRWAT ("a\r");
TestRWAT ("a\n");
- TestRWAT ("a\r\n");
+ TestRWAT ("a\r\n");
TestRWAT ("a\ra");
TestRWAT ("a\na");
TestRWAT ("a\r\na");
+2007-06-24 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * ThreadTest.cs: Added tests for bug #81930.
+
2007-06-08 Gert Driesen <drieseng@users.sourceforge.net>
* ThreadTest.cs: Enabled test for bug #81720.
//
using System;
+using System.Globalization;
using System.Security.Principal;
using System.Threading;
Assert.IsTrue (n < 200, "Timeout while waiting for abort");
CheckIsNotRunning ("t6", t);
- }
+ }
void CheckIsRunning (string s, Thread t)
{
Assert.IsTrue (exception_occured, "Thread1 Started Invalid Exception Occured");
}
}
-
+
+ [TestFixture]
+ public class ThreadCultureTest
+ {
+ CultureInfo old_culture;
+ CultureInfo old_ui_culture;
+
+ [SetUp]
+ public void Setup ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ old_ui_culture = Thread.CurrentThread.CurrentUICulture;
+ }
+
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ Thread.CurrentThread.CurrentUICulture = old_ui_culture;
+ }
+
+ [Test] // bug #81930
+ public void CurrentCulture_IsReadOnly ()
+ {
+ CultureInfo ci;
+
+ ci = Thread.CurrentThread.CurrentCulture;
+ Assert.IsTrue (ci.IsReadOnly, "#A1");
+ Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#A2");
+ Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#A3");
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("nl-BE");
+
+ ci = Thread.CurrentThread.CurrentCulture;
+ Assert.IsFalse (ci.IsReadOnly, "#B1");
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#B2");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#B3");
+ }
+
+ [Test] // bug #81930
+ public void CurrentUICulture_IsReadOnly ()
+ {
+ CultureInfo ci;
+
+ ci = Thread.CurrentThread.CurrentUICulture;
+ Assert.IsTrue (ci.IsReadOnly, "#A1");
+ Assert.IsTrue (ci.NumberFormat.IsReadOnly, "#A2");
+ Assert.IsTrue (ci.DateTimeFormat.IsReadOnly, "#A3");
+
+ Thread.CurrentThread.CurrentUICulture = new CultureInfo ("nl-BE");
+
+ ci = Thread.CurrentThread.CurrentUICulture;
+ Assert.IsFalse (ci.IsReadOnly, "#B1");
+ Assert.IsFalse (ci.NumberFormat.IsReadOnly, "#B2");
+ Assert.IsFalse (ci.DateTimeFormat.IsReadOnly, "#B3");
+ }
+ }
+
public class TestUtil
{
public static void WaitForNotAlive (Thread t, string s)
Array.Sort (array, (IComparer) null);
}
+ [Test] // bug #81941
+ public void Sort ()
+ {
+ double [] a = new double [2] { 0.9, 0.3 };
+ uint [] b = new uint [2] { 4, 7 };
+ Array.Sort (a, b);
+ AssertEquals ("#1", 0.3, a [0]);
+ AssertEquals ("#2", 0.9, a [1]);
+ AssertEquals ("#3", 7, b [0]);
+ AssertEquals ("#4", 4, b [1]);
+ }
+
[Test]
public void ClearJaggedArray ()
{
"00255", "2.55000e+002", "255.00000",
"255", "255.00000", "25,500.00000 %", "000ff"};
+ private CultureInfo old_culture;
private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
-
- public ByteTest() {}
[SetUp]
- public void SetUp()
+ public void SetUp ()
{
- CultureInfo EnUs = new CultureInfo ("en-us", false);
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ CultureInfo EnUs = new CultureInfo ("en-us", false);
EnUs.NumberFormat.NumberDecimalDigits = 2;
- Thread.CurrentThread.CurrentCulture = EnUs;
+ Thread.CurrentThread.CurrentCulture = EnUs;
int cdd = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits;
string sep = NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator;
Results2[6] = perPattern.Replace ("n","25" + gsep + "500" + sep + "00000");
}
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
public void TestMinMax()
{
AssertEquals(Byte.MinValue, MyByte2);
+2007-06-24 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * ArrayTest.cs: Added test for bug #81941.
+ * ByteTest.cs: Restore original CurrentCulture in teardown.
+ * DecimalFormatterTest.cs: Restore original CurrentCulture in teardown.
+ Code formatting.
+ * DecimalTest.cs: Code formatting.
+ * DoubleFormatterTest.cs: Test relies on specific culture, so set it
+ up here. This worked before since the CurrentCulture was set in another
+ TestFixture, and the original one was not restored.
+ * FloatingPointFormatterTest.cs: Same.
+ * NumberFormatterTest.cs: Same. Removed stray tabs and fixes code
+ formatting.
+ * SingleFormatterTest.cs: Restore original culture on teardown. Code
+ formatting.
+ * SingleTest.cs: Same.
+ * StringComparerTest.cs: Restore original culture on teardown.
+
2007-06-06 Atsushi Enomoto <atsushi@ximian.com>
* ConvertTest.cs : another bogus DateTime test.
namespace MonoTests.System
{
- public class FormatString
- {
- private int testnumber;
- private decimal number;
- private string format;
- private string expectedresult;
+ public class FormatString
+ {
+ private int testnumber;
+ private decimal number;
+ private string format;
+ private string expectedresult;
- public FormatString(int TestNumber, decimal Number, string Format, string ExpectedResult)
- {
- testnumber = TestNumber;
- number = Number;
- format = Format;
- expectedresult = ExpectedResult;
- }
-
- public int TestNumber
- {
- get { return testnumber; }
- set { testnumber = value; }
- }
+ public FormatString (int TestNumber, decimal Number, string Format, string ExpectedResult)
+ {
+ testnumber = TestNumber;
+ number = Number;
+ format = Format;
+ expectedresult = ExpectedResult;
+ }
- public decimal Number
- {
- get { return number; }
- set { number = value; }
- }
-
- public string Format
- {
- get { return format; }
- set { format = value; }
- }
-
- public string ExpectedResult
- {
- get { return expectedresult; }
- set { expectedresult = value; }
- }
- }
+ public int TestNumber
+ {
+ get { return testnumber; }
+ set { testnumber = value; }
+ }
- [TestFixture]
- public class DecimalFormatterTest
- {
- [SetUp]
- public void GetReady()
- {
- CultureInfo EnUs = new CultureInfo ("en-us");
- EnUs.NumberFormat.CurrencyNegativePattern = 0; // -1 = (1)
- EnUs.NumberFormat.CurrencyDecimalSeparator = ".";
- EnUs.NumberFormat.NumberGroupSeparator = ",";
- EnUs.NumberFormat.NumberNegativePattern = 1; // -1 = -1
-
- //Set this culture for the current thread.
- Thread.CurrentThread.CurrentCulture = EnUs;
- }
-
- [TearDown]
- public void Clean() {}
-
- [Test]
- public void TestFormatStrings()
- {
- // Test all the formatstrings in the FormatTest array.
- // If a test fails the "DecF #" equals the index of the array.
- foreach (FormatString fTest in FormatTest) {
- Assertion.AssertEquals ("DecF #" + fTest.TestNumber, fTest.ExpectedResult, fTest.Number.ToString(fTest.Format));
- }
- }
+ public decimal Number
+ {
+ get { return number; }
+ set { number = value; }
+ }
-
- [Test]
- [ExpectedException(typeof(FormatException))]
- public void TestToDecimal()
- {
- decimal x = 1.0000001m;
- string Result = x.ToString ("D2"); //To Decimal is for integral types only.
- }
-
- [Test]
- [ExpectedException(typeof(FormatException))]
- public void TestToHex()
- {
- decimal x = 1.0000001m;
- string Result = x.ToString ("X2"); //To Hex is for integral types only.
- }
+ public string Format
+ {
+ get { return format; }
+ set { format = value; }
+ }
- // Computer generated format array.
- FormatString[] FormatTest = new FormatString[] {
- new FormatString(0, 1.0034m, "C", "$1.00"),
- new FormatString(1, 1.0034m, "C0", "$1"),
- new FormatString(2, 1.0034m, "C1", "$1.0"),
- new FormatString(3, 1.0034m, "C2", "$1.00"),
- new FormatString(4, 1.0034m, "C3", "$1.003"),
- new FormatString(5, 1.0034m, "C4", "$1.0034"),
- new FormatString(6, 1.0034m, "C5", "$1.00340"),
- new FormatString(7, 1.0034m, "C6", "$1.003400"),
- new FormatString(8, 1.0034m, "C7", "$1.0034000"),
- new FormatString(9, 1.0034m, "C8", "$1.00340000"),
- new FormatString(10, 1.0034m, "C9", "$1.003400000"),
- new FormatString(11, 1.0034m, "E", "1.003400E+000"),
- new FormatString(12, 1.0034m, "E0", "1E+000"),
- new FormatString(13, 1.0034m, "E1", "1.0E+000"),
- new FormatString(14, 1.0034m, "E2", "1.00E+000"),
- new FormatString(15, 1.0034m, "E3", "1.003E+000"),
- new FormatString(16, 1.0034m, "E4", "1.0034E+000"),
- new FormatString(17, 1.0034m, "E5", "1.00340E+000"),
- new FormatString(18, 1.0034m, "E6", "1.003400E+000"),
- new FormatString(19, 1.0034m, "E7", "1.0034000E+000"),
- new FormatString(20, 1.0034m, "E8", "1.00340000E+000"),
- new FormatString(21, 1.0034m, "E9", "1.003400000E+000"),
- new FormatString(22, 1.0034m, "F", "1.00"),
- new FormatString(23, 1.0034m, "F0", "1"),
- new FormatString(24, 1.0034m, "F1", "1.0"),
- new FormatString(25, 1.0034m, "F2", "1.00"),
- new FormatString(26, 1.0034m, "F3", "1.003"),
- new FormatString(27, 1.0034m, "F4", "1.0034"),
- new FormatString(28, 1.0034m, "F5", "1.00340"),
- new FormatString(29, 1.0034m, "F6", "1.003400"),
- new FormatString(30, 1.0034m, "F7", "1.0034000"),
- new FormatString(31, 1.0034m, "F8", "1.00340000"),
- new FormatString(32, 1.0034m, "F9", "1.003400000"),
- new FormatString(33, 1.0034m, "G", "1.0034"),
- new FormatString(34, 1.0034m, "G0", "1.0034"),
- new FormatString(35, 1.0034m, "G1", "1"),
- new FormatString(36, 1.0034m, "G2", "1"),
- new FormatString(37, 1.0034m, "G3", "1"),
- new FormatString(38, 1.0034m, "G4", "1.003"),
- new FormatString(39, 1.0034m, "G5", "1.0034"),
- new FormatString(40, 1.0034m, "G6", "1.0034"),
- new FormatString(41, 1.0034m, "G7", "1.0034"),
- new FormatString(42, 1.0034m, "G8", "1.0034"),
- new FormatString(43, 1.0034m, "G9", "1.0034"),
- new FormatString(44, 1.0034m, "N", "1.00"),
- new FormatString(45, 1.0034m, "N0", "1"),
- new FormatString(46, 1.0034m, "N1", "1.0"),
- new FormatString(47, 1.0034m, "N2", "1.00"),
- new FormatString(48, 1.0034m, "N3", "1.003"),
- new FormatString(49, 1.0034m, "N4", "1.0034"),
- new FormatString(50, 1.0034m, "N5", "1.00340"),
- new FormatString(51, 1.0034m, "N6", "1.003400"),
- new FormatString(52, 1.0034m, "N7", "1.0034000"),
- new FormatString(53, 1.0034m, "N8", "1.00340000"),
- new FormatString(54, 1.0034m, "N9", "1.003400000"),
- new FormatString(55, 1.0034m, "P", "100.34 %"),
- new FormatString(56, 1.0034m, "P0", "100 %"),
- new FormatString(57, 1.0034m, "P1", "100.3 %"),
- new FormatString(58, 1.0034m, "P2", "100.34 %"),
- new FormatString(59, 1.0034m, "P3", "100.340 %"),
- new FormatString(60, 1.0034m, "P4", "100.3400 %"),
- new FormatString(61, 1.0034m, "P5", "100.34000 %"),
- new FormatString(62, 1.0034m, "P6", "100.340000 %"),
- new FormatString(63, 1.0034m, "P7", "100.3400000 %"),
- new FormatString(64, 1.0034m, "P8", "100.34000000 %"),
- new FormatString(65, 1.0034m, "P9", "100.340000000 %"),
- new FormatString(66, 343433.223m, "C", "$343,433.22"),
- new FormatString(67, 343433.223m, "C0", "$343,433"),
- new FormatString(68, 343433.223m, "C1", "$343,433.2"),
- new FormatString(69, 343433.223m, "C2", "$343,433.22"),
- new FormatString(70, 343433.223m, "C3", "$343,433.223"),
- new FormatString(71, 343433.223m, "C4", "$343,433.2230"),
- new FormatString(72, 343433.223m, "C5", "$343,433.22300"),
- new FormatString(73, 343433.223m, "C6", "$343,433.223000"),
- new FormatString(74, 343433.223m, "C7", "$343,433.2230000"),
- new FormatString(75, 343433.223m, "C8", "$343,433.22300000"),
- new FormatString(76, 343433.223m, "C9", "$343,433.223000000"),
- new FormatString(77, 343433.223m, "E", "3.434332E+005"),
- new FormatString(78, 343433.223m, "E0", "3E+005"),
- new FormatString(79, 343433.223m, "E1", "3.4E+005"),
- new FormatString(80, 343433.223m, "E2", "3.43E+005"),
- new FormatString(81, 343433.223m, "E3", "3.434E+005"),
- new FormatString(82, 343433.223m, "E4", "3.4343E+005"),
- new FormatString(83, 343433.223m, "E5", "3.43433E+005"),
- new FormatString(84, 343433.223m, "E6", "3.434332E+005"),
- new FormatString(85, 343433.223m, "E7", "3.4343322E+005"),
- new FormatString(86, 343433.223m, "E8", "3.43433223E+005"),
- new FormatString(87, 343433.223m, "E9", "3.434332230E+005"),
- new FormatString(88, 343433.223m, "F", "343433.22"),
- new FormatString(89, 343433.223m, "F0", "343433"),
- new FormatString(90, 343433.223m, "F1", "343433.2"),
- new FormatString(91, 343433.223m, "F2", "343433.22"),
- new FormatString(92, 343433.223m, "F3", "343433.223"),
- new FormatString(93, 343433.223m, "F4", "343433.2230"),
- new FormatString(94, 343433.223m, "F5", "343433.22300"),
- new FormatString(95, 343433.223m, "F6", "343433.223000"),
- new FormatString(96, 343433.223m, "F7", "343433.2230000"),
- new FormatString(97, 343433.223m, "F8", "343433.22300000"),
- new FormatString(98, 343433.223m, "F9", "343433.223000000"),
- new FormatString(99, 343433.223m, "G", "343433.223"),
- new FormatString(100, 343433.223m, "G0", "343433.223"),
- new FormatString(101, 343433.223m, "G1", "3E+05"),
- new FormatString(102, 343433.223m, "G2", "3.4E+05"),
- new FormatString(103, 343433.223m, "G3", "3.43E+05"),
- new FormatString(104, 343433.223m, "G4", "3.434E+05"),
- new FormatString(105, 343433.223m, "G5", "3.4343E+05"),
- new FormatString(106, 343433.223m, "G6", "343433"),
- new FormatString(107, 343433.223m, "G7", "343433.2"),
- new FormatString(108, 343433.223m, "G8", "343433.22"),
- new FormatString(109, 343433.223m, "G9", "343433.223"),
- new FormatString(110, 343433.223m, "N", "343,433.22"),
- new FormatString(111, 343433.223m, "N0", "343,433"),
- new FormatString(112, 343433.223m, "N1", "343,433.2"),
- new FormatString(113, 343433.223m, "N2", "343,433.22"),
- new FormatString(114, 343433.223m, "N3", "343,433.223"),
- new FormatString(115, 343433.223m, "N4", "343,433.2230"),
- new FormatString(116, 343433.223m, "N5", "343,433.22300"),
- new FormatString(117, 343433.223m, "N6", "343,433.223000"),
- new FormatString(118, 343433.223m, "N7", "343,433.2230000"),
- new FormatString(119, 343433.223m, "N8", "343,433.22300000"),
- new FormatString(120, 343433.223m, "N9", "343,433.223000000"),
- new FormatString(121, 343433.223m, "P", "34,343,322.30 %"),
- new FormatString(122, 343433.223m, "P0", "34,343,322 %"),
- new FormatString(123, 343433.223m, "P1", "34,343,322.3 %"),
- new FormatString(124, 343433.223m, "P2", "34,343,322.30 %"),
- new FormatString(125, 343433.223m, "P3", "34,343,322.300 %"),
- new FormatString(126, 343433.223m, "P4", "34,343,322.3000 %"),
- new FormatString(127, 343433.223m, "P5", "34,343,322.30000 %"),
- new FormatString(128, 343433.223m, "P6", "34,343,322.300000 %"),
- new FormatString(129, 343433.223m, "P7", "34,343,322.3000000 %"),
- new FormatString(130, 343433.223m, "P8", "34,343,322.30000000 %"),
- new FormatString(131, 343433.223m, "P9", "34,343,322.300000000 %"),
- new FormatString(132, -1.9292929332m, "C", "($1.93)"),
- new FormatString(133, -1.9292929332m, "C0", "($2)"),
- new FormatString(134, -1.9292929332m, "C1", "($1.9)"),
- new FormatString(135, -1.9292929332m, "C2", "($1.93)"),
- new FormatString(136, -1.9292929332m, "C3", "($1.929)"),
- new FormatString(137, -1.9292929332m, "C4", "($1.9293)"),
- new FormatString(138, -1.9292929332m, "C5", "($1.92929)"),
- new FormatString(139, -1.9292929332m, "C6", "($1.929293)"),
- new FormatString(140, -1.9292929332m, "C7", "($1.9292929)"),
- new FormatString(141, -1.9292929332m, "C8", "($1.92929293)"),
- new FormatString(142, -1.9292929332m, "C9", "($1.929292933)"),
- new FormatString(143, -1.9292929332m, "E", "-1.929293E+000"),
- new FormatString(144, -1.9292929332m, "E0", "-2E+000"),
- new FormatString(145, -1.9292929332m, "E1", "-1.9E+000"),
- new FormatString(146, -1.9292929332m, "E2", "-1.93E+000"),
- new FormatString(147, -1.9292929332m, "E3", "-1.929E+000"),
- new FormatString(148, -1.9292929332m, "E4", "-1.9293E+000"),
- new FormatString(149, -1.9292929332m, "E5", "-1.92929E+000"),
- new FormatString(150, -1.9292929332m, "E6", "-1.929293E+000"),
- new FormatString(151, -1.9292929332m, "E7", "-1.9292929E+000"),
- new FormatString(152, -1.9292929332m, "E8", "-1.92929293E+000"),
- new FormatString(153, -1.9292929332m, "E9", "-1.929292933E+000"),
- new FormatString(154, -1.9292929332m, "F", "-1.93"),
- new FormatString(155, -1.9292929332m, "F0", "-2"),
- new FormatString(156, -1.9292929332m, "F1", "-1.9"),
- new FormatString(157, -1.9292929332m, "F2", "-1.93"),
- new FormatString(158, -1.9292929332m, "F3", "-1.929"),
- new FormatString(159, -1.9292929332m, "F4", "-1.9293"),
- new FormatString(160, -1.9292929332m, "F5", "-1.92929"),
- new FormatString(161, -1.9292929332m, "F6", "-1.929293"),
- new FormatString(162, -1.9292929332m, "F7", "-1.9292929"),
- new FormatString(163, -1.9292929332m, "F8", "-1.92929293"),
- new FormatString(164, -1.9292929332m, "F9", "-1.929292933"),
- new FormatString(165, -1.9292929332m, "G", "-1.9292929332"),
- new FormatString(166, -1.9292929332m, "G0", "-1.9292929332"),
- new FormatString(167, -1.9292929332m, "G1", "-2"),
- new FormatString(168, -1.9292929332m, "G2", "-1.9"),
- new FormatString(169, -1.9292929332m, "G3", "-1.93"),
- new FormatString(170, -1.9292929332m, "G4", "-1.929"),
- new FormatString(171, -1.9292929332m, "G5", "-1.9293"),
- new FormatString(172, -1.9292929332m, "G6", "-1.92929"),
- new FormatString(173, -1.9292929332m, "G7", "-1.929293"),
- new FormatString(174, -1.9292929332m, "G8", "-1.9292929"),
- new FormatString(175, -1.9292929332m, "G9", "-1.92929293"),
- new FormatString(176, -1.9292929332m, "N", "-1.93"),
- new FormatString(177, -1.9292929332m, "N0", "-2"),
- new FormatString(178, -1.9292929332m, "N1", "-1.9"),
- new FormatString(179, -1.9292929332m, "N2", "-1.93"),
- new FormatString(180, -1.9292929332m, "N3", "-1.929"),
- new FormatString(181, -1.9292929332m, "N4", "-1.9293"),
- new FormatString(182, -1.9292929332m, "N5", "-1.92929"),
- new FormatString(183, -1.9292929332m, "N6", "-1.929293"),
- new FormatString(184, -1.9292929332m, "N7", "-1.9292929"),
- new FormatString(185, -1.9292929332m, "N8", "-1.92929293"),
- new FormatString(186, -1.9292929332m, "N9", "-1.929292933"),
- new FormatString(187, -1.9292929332m, "P", "-192.93 %"),
- new FormatString(188, -1.9292929332m, "P0", "-193 %"),
- new FormatString(189, -1.9292929332m, "P1", "-192.9 %"),
- new FormatString(190, -1.9292929332m, "P2", "-192.93 %"),
- new FormatString(191, -1.9292929332m, "P3", "-192.929 %"),
- new FormatString(192, -1.9292929332m, "P4", "-192.9293 %"),
- new FormatString(193, -1.9292929332m, "P5", "-192.92929 %"),
- new FormatString(194, -1.9292929332m, "P6", "-192.929293 %"),
- new FormatString(195, -1.9292929332m, "P7", "-192.9292933 %"),
- new FormatString(196, -1.9292929332m, "P8", "-192.92929332 %"),
- new FormatString(197, -1.9292929332m, "P9", "-192.929293320 %"),
- new FormatString(198, 67234234.23434343434341111m, "C", "$67,234,234.23"),
- new FormatString(199, 67234234.23434343434341111m, "C0", "$67,234,234"),
- new FormatString(200, 67234234.23434343434341111m, "C1", "$67,234,234.2"),
- new FormatString(201, 67234234.23434343434341111m, "C2", "$67,234,234.23"),
- new FormatString(202, 67234234.23434343434341111m, "C3", "$67,234,234.234"),
- new FormatString(203, 67234234.23434343434341111m, "C4", "$67,234,234.2343"),
- new FormatString(204, 67234234.23434343434341111m, "C5", "$67,234,234.23434"),
- new FormatString(205, 67234234.23434343434341111m, "C6", "$67,234,234.234343"),
- new FormatString(206, 67234234.23434343434341111m, "C7", "$67,234,234.2343434"),
- new FormatString(207, 67234234.23434343434341111m, "C8", "$67,234,234.23434343"),
- new FormatString(208, 67234234.23434343434341111m, "C9", "$67,234,234.234343434"),
- new FormatString(209, 67234234.23434343434341111m, "E", "6.723423E+007"),
- new FormatString(210, 67234234.23434343434341111m, "E0", "7E+007"),
- new FormatString(211, 67234234.23434343434341111m, "E1", "6.7E+007"),
- new FormatString(212, 67234234.23434343434341111m, "E2", "6.72E+007"),
- new FormatString(213, 67234234.23434343434341111m, "E3", "6.723E+007"),
- new FormatString(214, 67234234.23434343434341111m, "E4", "6.7234E+007"),
- new FormatString(215, 67234234.23434343434341111m, "E5", "6.72342E+007"),
- new FormatString(216, 67234234.23434343434341111m, "E6", "6.723423E+007"),
- new FormatString(217, 67234234.23434343434341111m, "E7", "6.7234234E+007"),
- new FormatString(218, 67234234.23434343434341111m, "E8", "6.72342342E+007"),
- new FormatString(219, 67234234.23434343434341111m, "E9", "6.723423423E+007"),
- new FormatString(220, 67234234.23434343434341111m, "F", "67234234.23"),
- new FormatString(221, 67234234.23434343434341111m, "F0", "67234234"),
- new FormatString(222, 67234234.23434343434341111m, "F1", "67234234.2"),
- new FormatString(223, 67234234.23434343434341111m, "F2", "67234234.23"),
- new FormatString(224, 67234234.23434343434341111m, "F3", "67234234.234"),
- new FormatString(225, 67234234.23434343434341111m, "F4", "67234234.2343"),
- new FormatString(226, 67234234.23434343434341111m, "F5", "67234234.23434"),
- new FormatString(227, 67234234.23434343434341111m, "F6", "67234234.234343"),
- new FormatString(228, 67234234.23434343434341111m, "F7", "67234234.2343434"),
- new FormatString(229, 67234234.23434343434341111m, "F8", "67234234.23434343"),
- new FormatString(230, 67234234.23434343434341111m, "F9", "67234234.234343434"),
- new FormatString(231, 67234234.23434343434341111m, "G", "67234234.23434343434341111"),
- new FormatString(232, 67234234.23434343434341111m, "G0", "67234234.23434343434341111"),
- new FormatString(233, 67234234.23434343434341111m, "G1", "7E+07"),
- new FormatString(234, 67234234.23434343434341111m, "G2", "6.7E+07"),
- new FormatString(235, 67234234.23434343434341111m, "G3", "6.72E+07"),
- new FormatString(236, 67234234.23434343434341111m, "G4", "6.723E+07"),
- new FormatString(237, 67234234.23434343434341111m, "G5", "6.7234E+07"),
- new FormatString(238, 67234234.23434343434341111m, "G6", "6.72342E+07"),
- new FormatString(239, 67234234.23434343434341111m, "G7", "6.723423E+07"),
- new FormatString(240, 67234234.23434343434341111m, "G8", "67234234"),
- new FormatString(241, 67234234.23434343434341111m, "G9", "67234234.2"),
- new FormatString(242, 67234234.23434343434341111m, "N", "67,234,234.23"),
- new FormatString(243, 67234234.23434343434341111m, "N0", "67,234,234"),
- new FormatString(244, 67234234.23434343434341111m, "N1", "67,234,234.2"),
- new FormatString(245, 67234234.23434343434341111m, "N2", "67,234,234.23"),
- new FormatString(246, 67234234.23434343434341111m, "N3", "67,234,234.234"),
- new FormatString(247, 67234234.23434343434341111m, "N4", "67,234,234.2343"),
- new FormatString(248, 67234234.23434343434341111m, "N5", "67,234,234.23434"),
- new FormatString(249, 67234234.23434343434341111m, "N6", "67,234,234.234343"),
- new FormatString(250, 67234234.23434343434341111m, "N7", "67,234,234.2343434"),
- new FormatString(251, 67234234.23434343434341111m, "N8", "67,234,234.23434343"),
- new FormatString(252, 67234234.23434343434341111m, "N9", "67,234,234.234343434"),
- new FormatString(253, 67234234.23434343434341111m, "P", "6,723,423,423.43 %"),
- new FormatString(254, 67234234.23434343434341111m, "P0", "6,723,423,423 %"),
- new FormatString(255, 67234234.23434343434341111m, "P1", "6,723,423,423.4 %"),
- new FormatString(256, 67234234.23434343434341111m, "P2", "6,723,423,423.43 %"),
- new FormatString(257, 67234234.23434343434341111m, "P3", "6,723,423,423.434 %"),
- new FormatString(258, 67234234.23434343434341111m, "P4", "6,723,423,423.4343 %"),
- new FormatString(259, 67234234.23434343434341111m, "P5", "6,723,423,423.43434 %"),
- new FormatString(260, 67234234.23434343434341111m, "P6", "6,723,423,423.434343 %"),
- new FormatString(261, 67234234.23434343434341111m, "P7", "6,723,423,423.4343434 %"),
- new FormatString(262, 67234234.23434343434341111m, "P8", "6,723,423,423.43434343 %"),
- new FormatString(263, 67234234.23434343434341111m, "P9", "6,723,423,423.434343434 %")
- };
- }
-}
-
+ public string ExpectedResult
+ {
+ get { return expectedresult; }
+ set { expectedresult = value; }
+ }
+ }
+
+ [TestFixture]
+ public class DecimalFormatterTest
+ {
+ CultureInfo old_culture;
+
+ [SetUp]
+ public void Setup ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ CultureInfo EnUs = new CultureInfo ("en-US", false);
+ EnUs.NumberFormat.CurrencyNegativePattern = 0; // -1 = (1)
+ EnUs.NumberFormat.CurrencyDecimalSeparator = ".";
+ EnUs.NumberFormat.NumberGroupSeparator = ",";
+ EnUs.NumberFormat.NumberNegativePattern = 1; // -1 = -1
+
+ //Set this culture for the current thread.
+ Thread.CurrentThread.CurrentCulture = EnUs;
+ }
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ [Test]
+ public void TestFormatStrings ()
+ {
+ // Test all the formatstrings in the FormatTest array.
+ // If a test fails the "DecF #" equals the index of the array.
+ foreach (FormatString fTest in FormatTest) {
+ Assertion.AssertEquals ("DecF #" + fTest.TestNumber, fTest.ExpectedResult, fTest.Number.ToString (fTest.Format));
+ }
+ }
+
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void TestToDecimal ()
+ {
+ decimal x = 1.0000001m;
+ string Result = x.ToString ("D2"); //To Decimal is for integral types only.
+ }
+
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void TestToHex ()
+ {
+ decimal x = 1.0000001m;
+ string Result = x.ToString ("X2"); //To Hex is for integral types only.
+ }
+
+ // Computer generated format array.
+ FormatString [] FormatTest = new FormatString [] {
+ new FormatString (0, 1.0034m, "C", "$1.00"),
+ new FormatString (1, 1.0034m, "C0", "$1"),
+ new FormatString (2, 1.0034m, "C1", "$1.0"),
+ new FormatString (3, 1.0034m, "C2", "$1.00"),
+ new FormatString (4, 1.0034m, "C3", "$1.003"),
+ new FormatString (5, 1.0034m, "C4", "$1.0034"),
+ new FormatString (6, 1.0034m, "C5", "$1.00340"),
+ new FormatString (7, 1.0034m, "C6", "$1.003400"),
+ new FormatString (8, 1.0034m, "C7", "$1.0034000"),
+ new FormatString (9, 1.0034m, "C8", "$1.00340000"),
+ new FormatString (10, 1.0034m, "C9", "$1.003400000"),
+ new FormatString (11, 1.0034m, "E", "1.003400E+000"),
+ new FormatString (12, 1.0034m, "E0", "1E+000"),
+ new FormatString (13, 1.0034m, "E1", "1.0E+000"),
+ new FormatString (14, 1.0034m, "E2", "1.00E+000"),
+ new FormatString (15, 1.0034m, "E3", "1.003E+000"),
+ new FormatString (16, 1.0034m, "E4", "1.0034E+000"),
+ new FormatString (17, 1.0034m, "E5", "1.00340E+000"),
+ new FormatString (18, 1.0034m, "E6", "1.003400E+000"),
+ new FormatString (19, 1.0034m, "E7", "1.0034000E+000"),
+ new FormatString (20, 1.0034m, "E8", "1.00340000E+000"),
+ new FormatString (21, 1.0034m, "E9", "1.003400000E+000"),
+ new FormatString (22, 1.0034m, "F", "1.00"),
+ new FormatString (23, 1.0034m, "F0", "1"),
+ new FormatString (24, 1.0034m, "F1", "1.0"),
+ new FormatString (25, 1.0034m, "F2", "1.00"),
+ new FormatString (26, 1.0034m, "F3", "1.003"),
+ new FormatString (27, 1.0034m, "F4", "1.0034"),
+ new FormatString (28, 1.0034m, "F5", "1.00340"),
+ new FormatString (29, 1.0034m, "F6", "1.003400"),
+ new FormatString (30, 1.0034m, "F7", "1.0034000"),
+ new FormatString (31, 1.0034m, "F8", "1.00340000"),
+ new FormatString (32, 1.0034m, "F9", "1.003400000"),
+ new FormatString (33, 1.0034m, "G", "1.0034"),
+ new FormatString (34, 1.0034m, "G0", "1.0034"),
+ new FormatString (35, 1.0034m, "G1", "1"),
+ new FormatString (36, 1.0034m, "G2", "1"),
+ new FormatString (37, 1.0034m, "G3", "1"),
+ new FormatString (38, 1.0034m, "G4", "1.003"),
+ new FormatString (39, 1.0034m, "G5", "1.0034"),
+ new FormatString (40, 1.0034m, "G6", "1.0034"),
+ new FormatString (41, 1.0034m, "G7", "1.0034"),
+ new FormatString (42, 1.0034m, "G8", "1.0034"),
+ new FormatString (43, 1.0034m, "G9", "1.0034"),
+ new FormatString (44, 1.0034m, "N", "1.00"),
+ new FormatString (45, 1.0034m, "N0", "1"),
+ new FormatString (46, 1.0034m, "N1", "1.0"),
+ new FormatString (47, 1.0034m, "N2", "1.00"),
+ new FormatString (48, 1.0034m, "N3", "1.003"),
+ new FormatString (49, 1.0034m, "N4", "1.0034"),
+ new FormatString (50, 1.0034m, "N5", "1.00340"),
+ new FormatString (51, 1.0034m, "N6", "1.003400"),
+ new FormatString (52, 1.0034m, "N7", "1.0034000"),
+ new FormatString (53, 1.0034m, "N8", "1.00340000"),
+ new FormatString (54, 1.0034m, "N9", "1.003400000"),
+ new FormatString (55, 1.0034m, "P", "100.34 %"),
+ new FormatString (56, 1.0034m, "P0", "100 %"),
+ new FormatString (57, 1.0034m, "P1", "100.3 %"),
+ new FormatString (58, 1.0034m, "P2", "100.34 %"),
+ new FormatString (59, 1.0034m, "P3", "100.340 %"),
+ new FormatString (60, 1.0034m, "P4", "100.3400 %"),
+ new FormatString (61, 1.0034m, "P5", "100.34000 %"),
+ new FormatString (62, 1.0034m, "P6", "100.340000 %"),
+ new FormatString (63, 1.0034m, "P7", "100.3400000 %"),
+ new FormatString (64, 1.0034m, "P8", "100.34000000 %"),
+ new FormatString (65, 1.0034m, "P9", "100.340000000 %"),
+ new FormatString (66, 343433.223m, "C", "$343,433.22"),
+ new FormatString (67, 343433.223m, "C0", "$343,433"),
+ new FormatString (68, 343433.223m, "C1", "$343,433.2"),
+ new FormatString (69, 343433.223m, "C2", "$343,433.22"),
+ new FormatString (70, 343433.223m, "C3", "$343,433.223"),
+ new FormatString (71, 343433.223m, "C4", "$343,433.2230"),
+ new FormatString (72, 343433.223m, "C5", "$343,433.22300"),
+ new FormatString (73, 343433.223m, "C6", "$343,433.223000"),
+ new FormatString (74, 343433.223m, "C7", "$343,433.2230000"),
+ new FormatString (75, 343433.223m, "C8", "$343,433.22300000"),
+ new FormatString (76, 343433.223m, "C9", "$343,433.223000000"),
+ new FormatString (77, 343433.223m, "E", "3.434332E+005"),
+ new FormatString (78, 343433.223m, "E0", "3E+005"),
+ new FormatString (79, 343433.223m, "E1", "3.4E+005"),
+ new FormatString (80, 343433.223m, "E2", "3.43E+005"),
+ new FormatString (81, 343433.223m, "E3", "3.434E+005"),
+ new FormatString (82, 343433.223m, "E4", "3.4343E+005"),
+ new FormatString (83, 343433.223m, "E5", "3.43433E+005"),
+ new FormatString (84, 343433.223m, "E6", "3.434332E+005"),
+ new FormatString (85, 343433.223m, "E7", "3.4343322E+005"),
+ new FormatString (86, 343433.223m, "E8", "3.43433223E+005"),
+ new FormatString (87, 343433.223m, "E9", "3.434332230E+005"),
+ new FormatString (88, 343433.223m, "F", "343433.22"),
+ new FormatString (89, 343433.223m, "F0", "343433"),
+ new FormatString (90, 343433.223m, "F1", "343433.2"),
+ new FormatString (91, 343433.223m, "F2", "343433.22"),
+ new FormatString (92, 343433.223m, "F3", "343433.223"),
+ new FormatString (93, 343433.223m, "F4", "343433.2230"),
+ new FormatString (94, 343433.223m, "F5", "343433.22300"),
+ new FormatString (95, 343433.223m, "F6", "343433.223000"),
+ new FormatString (96, 343433.223m, "F7", "343433.2230000"),
+ new FormatString (97, 343433.223m, "F8", "343433.22300000"),
+ new FormatString (98, 343433.223m, "F9", "343433.223000000"),
+ new FormatString (99, 343433.223m, "G", "343433.223"),
+ new FormatString (100, 343433.223m, "G0", "343433.223"),
+ new FormatString (101, 343433.223m, "G1", "3E+05"),
+ new FormatString (102, 343433.223m, "G2", "3.4E+05"),
+ new FormatString (103, 343433.223m, "G3", "3.43E+05"),
+ new FormatString (104, 343433.223m, "G4", "3.434E+05"),
+ new FormatString (105, 343433.223m, "G5", "3.4343E+05"),
+ new FormatString (106, 343433.223m, "G6", "343433"),
+ new FormatString (107, 343433.223m, "G7", "343433.2"),
+ new FormatString (108, 343433.223m, "G8", "343433.22"),
+ new FormatString (109, 343433.223m, "G9", "343433.223"),
+ new FormatString (110, 343433.223m, "N", "343,433.22"),
+ new FormatString (111, 343433.223m, "N0", "343,433"),
+ new FormatString (112, 343433.223m, "N1", "343,433.2"),
+ new FormatString (113, 343433.223m, "N2", "343,433.22"),
+ new FormatString (114, 343433.223m, "N3", "343,433.223"),
+ new FormatString (115, 343433.223m, "N4", "343,433.2230"),
+ new FormatString (116, 343433.223m, "N5", "343,433.22300"),
+ new FormatString (117, 343433.223m, "N6", "343,433.223000"),
+ new FormatString (118, 343433.223m, "N7", "343,433.2230000"),
+ new FormatString (119, 343433.223m, "N8", "343,433.22300000"),
+ new FormatString (120, 343433.223m, "N9", "343,433.223000000"),
+ new FormatString (121, 343433.223m, "P", "34,343,322.30 %"),
+ new FormatString (122, 343433.223m, "P0", "34,343,322 %"),
+ new FormatString (123, 343433.223m, "P1", "34,343,322.3 %"),
+ new FormatString (124, 343433.223m, "P2", "34,343,322.30 %"),
+ new FormatString (125, 343433.223m, "P3", "34,343,322.300 %"),
+ new FormatString (126, 343433.223m, "P4", "34,343,322.3000 %"),
+ new FormatString (127, 343433.223m, "P5", "34,343,322.30000 %"),
+ new FormatString (128, 343433.223m, "P6", "34,343,322.300000 %"),
+ new FormatString (129, 343433.223m, "P7", "34,343,322.3000000 %"),
+ new FormatString (130, 343433.223m, "P8", "34,343,322.30000000 %"),
+ new FormatString (131, 343433.223m, "P9", "34,343,322.300000000 %"),
+ new FormatString (132, -1.9292929332m, "C", "($1.93)"),
+ new FormatString (133, -1.9292929332m, "C0", "($2)"),
+ new FormatString (134, -1.9292929332m, "C1", "($1.9)"),
+ new FormatString (135, -1.9292929332m, "C2", "($1.93)"),
+ new FormatString (136, -1.9292929332m, "C3", "($1.929)"),
+ new FormatString (137, -1.9292929332m, "C4", "($1.9293)"),
+ new FormatString (138, -1.9292929332m, "C5", "($1.92929)"),
+ new FormatString (139, -1.9292929332m, "C6", "($1.929293)"),
+ new FormatString (140, -1.9292929332m, "C7", "($1.9292929)"),
+ new FormatString (141, -1.9292929332m, "C8", "($1.92929293)"),
+ new FormatString (142, -1.9292929332m, "C9", "($1.929292933)"),
+ new FormatString (143, -1.9292929332m, "E", "-1.929293E+000"),
+ new FormatString (144, -1.9292929332m, "E0", "-2E+000"),
+ new FormatString (145, -1.9292929332m, "E1", "-1.9E+000"),
+ new FormatString (146, -1.9292929332m, "E2", "-1.93E+000"),
+ new FormatString (147, -1.9292929332m, "E3", "-1.929E+000"),
+ new FormatString (148, -1.9292929332m, "E4", "-1.9293E+000"),
+ new FormatString (149, -1.9292929332m, "E5", "-1.92929E+000"),
+ new FormatString (150, -1.9292929332m, "E6", "-1.929293E+000"),
+ new FormatString (151, -1.9292929332m, "E7", "-1.9292929E+000"),
+ new FormatString (152, -1.9292929332m, "E8", "-1.92929293E+000"),
+ new FormatString (153, -1.9292929332m, "E9", "-1.929292933E+000"),
+ new FormatString (154, -1.9292929332m, "F", "-1.93"),
+ new FormatString (155, -1.9292929332m, "F0", "-2"),
+ new FormatString (156, -1.9292929332m, "F1", "-1.9"),
+ new FormatString (157, -1.9292929332m, "F2", "-1.93"),
+ new FormatString (158, -1.9292929332m, "F3", "-1.929"),
+ new FormatString (159, -1.9292929332m, "F4", "-1.9293"),
+ new FormatString (160, -1.9292929332m, "F5", "-1.92929"),
+ new FormatString (161, -1.9292929332m, "F6", "-1.929293"),
+ new FormatString (162, -1.9292929332m, "F7", "-1.9292929"),
+ new FormatString (163, -1.9292929332m, "F8", "-1.92929293"),
+ new FormatString (164, -1.9292929332m, "F9", "-1.929292933"),
+ new FormatString (165, -1.9292929332m, "G", "-1.9292929332"),
+ new FormatString (166, -1.9292929332m, "G0", "-1.9292929332"),
+ new FormatString (167, -1.9292929332m, "G1", "-2"),
+ new FormatString (168, -1.9292929332m, "G2", "-1.9"),
+ new FormatString (169, -1.9292929332m, "G3", "-1.93"),
+ new FormatString (170, -1.9292929332m, "G4", "-1.929"),
+ new FormatString (171, -1.9292929332m, "G5", "-1.9293"),
+ new FormatString (172, -1.9292929332m, "G6", "-1.92929"),
+ new FormatString (173, -1.9292929332m, "G7", "-1.929293"),
+ new FormatString (174, -1.9292929332m, "G8", "-1.9292929"),
+ new FormatString (175, -1.9292929332m, "G9", "-1.92929293"),
+ new FormatString (176, -1.9292929332m, "N", "-1.93"),
+ new FormatString (177, -1.9292929332m, "N0", "-2"),
+ new FormatString (178, -1.9292929332m, "N1", "-1.9"),
+ new FormatString (179, -1.9292929332m, "N2", "-1.93"),
+ new FormatString (180, -1.9292929332m, "N3", "-1.929"),
+ new FormatString (181, -1.9292929332m, "N4", "-1.9293"),
+ new FormatString (182, -1.9292929332m, "N5", "-1.92929"),
+ new FormatString (183, -1.9292929332m, "N6", "-1.929293"),
+ new FormatString (184, -1.9292929332m, "N7", "-1.9292929"),
+ new FormatString (185, -1.9292929332m, "N8", "-1.92929293"),
+ new FormatString (186, -1.9292929332m, "N9", "-1.929292933"),
+ new FormatString (187, -1.9292929332m, "P", "-192.93 %"),
+ new FormatString (188, -1.9292929332m, "P0", "-193 %"),
+ new FormatString (189, -1.9292929332m, "P1", "-192.9 %"),
+ new FormatString (190, -1.9292929332m, "P2", "-192.93 %"),
+ new FormatString (191, -1.9292929332m, "P3", "-192.929 %"),
+ new FormatString (192, -1.9292929332m, "P4", "-192.9293 %"),
+ new FormatString (193, -1.9292929332m, "P5", "-192.92929 %"),
+ new FormatString (194, -1.9292929332m, "P6", "-192.929293 %"),
+ new FormatString (195, -1.9292929332m, "P7", "-192.9292933 %"),
+ new FormatString (196, -1.9292929332m, "P8", "-192.92929332 %"),
+ new FormatString (197, -1.9292929332m, "P9", "-192.929293320 %"),
+ new FormatString (198, 67234234.23434343434341111m, "C", "$67,234,234.23"),
+ new FormatString (199, 67234234.23434343434341111m, "C0", "$67,234,234"),
+ new FormatString (200, 67234234.23434343434341111m, "C1", "$67,234,234.2"),
+ new FormatString (201, 67234234.23434343434341111m, "C2", "$67,234,234.23"),
+ new FormatString (202, 67234234.23434343434341111m, "C3", "$67,234,234.234"),
+ new FormatString (203, 67234234.23434343434341111m, "C4", "$67,234,234.2343"),
+ new FormatString (204, 67234234.23434343434341111m, "C5", "$67,234,234.23434"),
+ new FormatString (205, 67234234.23434343434341111m, "C6", "$67,234,234.234343"),
+ new FormatString (206, 67234234.23434343434341111m, "C7", "$67,234,234.2343434"),
+ new FormatString (207, 67234234.23434343434341111m, "C8", "$67,234,234.23434343"),
+ new FormatString (208, 67234234.23434343434341111m, "C9", "$67,234,234.234343434"),
+ new FormatString (209, 67234234.23434343434341111m, "E", "6.723423E+007"),
+ new FormatString (210, 67234234.23434343434341111m, "E0", "7E+007"),
+ new FormatString (211, 67234234.23434343434341111m, "E1", "6.7E+007"),
+ new FormatString (212, 67234234.23434343434341111m, "E2", "6.72E+007"),
+ new FormatString (213, 67234234.23434343434341111m, "E3", "6.723E+007"),
+ new FormatString (214, 67234234.23434343434341111m, "E4", "6.7234E+007"),
+ new FormatString (215, 67234234.23434343434341111m, "E5", "6.72342E+007"),
+ new FormatString (216, 67234234.23434343434341111m, "E6", "6.723423E+007"),
+ new FormatString (217, 67234234.23434343434341111m, "E7", "6.7234234E+007"),
+ new FormatString (218, 67234234.23434343434341111m, "E8", "6.72342342E+007"),
+ new FormatString (219, 67234234.23434343434341111m, "E9", "6.723423423E+007"),
+ new FormatString (220, 67234234.23434343434341111m, "F", "67234234.23"),
+ new FormatString (221, 67234234.23434343434341111m, "F0", "67234234"),
+ new FormatString (222, 67234234.23434343434341111m, "F1", "67234234.2"),
+ new FormatString (223, 67234234.23434343434341111m, "F2", "67234234.23"),
+ new FormatString (224, 67234234.23434343434341111m, "F3", "67234234.234"),
+ new FormatString (225, 67234234.23434343434341111m, "F4", "67234234.2343"),
+ new FormatString (226, 67234234.23434343434341111m, "F5", "67234234.23434"),
+ new FormatString (227, 67234234.23434343434341111m, "F6", "67234234.234343"),
+ new FormatString (228, 67234234.23434343434341111m, "F7", "67234234.2343434"),
+ new FormatString (229, 67234234.23434343434341111m, "F8", "67234234.23434343"),
+ new FormatString (230, 67234234.23434343434341111m, "F9", "67234234.234343434"),
+ new FormatString (231, 67234234.23434343434341111m, "G", "67234234.23434343434341111"),
+ new FormatString (232, 67234234.23434343434341111m, "G0", "67234234.23434343434341111"),
+ new FormatString (233, 67234234.23434343434341111m, "G1", "7E+07"),
+ new FormatString (234, 67234234.23434343434341111m, "G2", "6.7E+07"),
+ new FormatString (235, 67234234.23434343434341111m, "G3", "6.72E+07"),
+ new FormatString (236, 67234234.23434343434341111m, "G4", "6.723E+07"),
+ new FormatString (237, 67234234.23434343434341111m, "G5", "6.7234E+07"),
+ new FormatString (238, 67234234.23434343434341111m, "G6", "6.72342E+07"),
+ new FormatString (239, 67234234.23434343434341111m, "G7", "6.723423E+07"),
+ new FormatString (240, 67234234.23434343434341111m, "G8", "67234234"),
+ new FormatString (241, 67234234.23434343434341111m, "G9", "67234234.2"),
+ new FormatString (242, 67234234.23434343434341111m, "N", "67,234,234.23"),
+ new FormatString (243, 67234234.23434343434341111m, "N0", "67,234,234"),
+ new FormatString (244, 67234234.23434343434341111m, "N1", "67,234,234.2"),
+ new FormatString (245, 67234234.23434343434341111m, "N2", "67,234,234.23"),
+ new FormatString (246, 67234234.23434343434341111m, "N3", "67,234,234.234"),
+ new FormatString (247, 67234234.23434343434341111m, "N4", "67,234,234.2343"),
+ new FormatString (248, 67234234.23434343434341111m, "N5", "67,234,234.23434"),
+ new FormatString (249, 67234234.23434343434341111m, "N6", "67,234,234.234343"),
+ new FormatString (250, 67234234.23434343434341111m, "N7", "67,234,234.2343434"),
+ new FormatString (251, 67234234.23434343434341111m, "N8", "67,234,234.23434343"),
+ new FormatString (252, 67234234.23434343434341111m, "N9", "67,234,234.234343434"),
+ new FormatString (253, 67234234.23434343434341111m, "P", "6,723,423,423.43 %"),
+ new FormatString (254, 67234234.23434343434341111m, "P0", "6,723,423,423 %"),
+ new FormatString (255, 67234234.23434343434341111m, "P1", "6,723,423,423.4 %"),
+ new FormatString (256, 67234234.23434343434341111m, "P2", "6,723,423,423.43 %"),
+ new FormatString (257, 67234234.23434343434341111m, "P3", "6,723,423,423.434 %"),
+ new FormatString (258, 67234234.23434343434341111m, "P4", "6,723,423,423.4343 %"),
+ new FormatString (259, 67234234.23434343434341111m, "P5", "6,723,423,423.43434 %"),
+ new FormatString (260, 67234234.23434343434341111m, "P6", "6,723,423,423.434343 %"),
+ new FormatString (261, 67234234.23434343434341111m, "P7", "6,723,423,423.4343434 %"),
+ new FormatString (262, 67234234.23434343434341111m, "P8", "6,723,423,423.43434343 %"),
+ new FormatString (263, 67234234.23434343434341111m, "P9", "6,723,423,423.434343434 %")
+ };
+ }
+}
using System.Runtime.CompilerServices;
using System.Threading;
-namespace MonoTests.System {
- internal struct ParseTest
- {
- public ParseTest(String str, bool exceptionFlag)
- {
- this.str = str;
- this.exceptionFlag = exceptionFlag;
- this.style = NumberStyles.Number;
- this.d = 0;
- }
-
- public ParseTest(String str, Decimal d)
- {
- this.str = str;
- this.exceptionFlag = false;
- this.style = NumberStyles.Number;
- this.d = d;
- }
-
- public ParseTest(String str, Decimal d, NumberStyles style)
- {
- this.str = str;
- this.exceptionFlag = false;
- this.style = style;
- this.d = d;
- }
-
- public String str;
- public Decimal d;
- public NumberStyles style;
- public bool exceptionFlag;
- }
-
- internal struct ToStringTest
- {
- public ToStringTest(String format, Decimal d, String str)
- {
- this.format = format;
- this.d = d;
- this.str = str;
- }
-
- public String format;
- public Decimal d;
- public String str;
- }
-
- [TestFixture]
- public class DecimalTest : Assertion
- {
- private const int negativeBitValue = unchecked ((int)0x80000000);
- private const int negativeScale4Value = unchecked ((int)0x80040000);
- private int [] parts0 = {0,0,0,0}; //Positive Zero.
- private int [] parts1 = {1,0,0,0};
- private int [] parts2 = {0,1,0,0};
- private int [] parts3 = {0,0,1,0};
- private int [] parts4 = {0,0,0,negativeBitValue}; // Negative zero.
- private int [] parts5 = {1,1,1,0};
- private int [] partsMaxValue = {-1,-1,-1,0};
- private int [] partsMinValue = {-1,-1,-1,negativeBitValue};
- private int [] parts6 = {1234, 5678, 8888, negativeScale4Value};
- private NumberFormatInfo NfiUser;
-
- private CultureInfo old_culture;
-
- [TestFixtureSetUp]
- public void FixtureSetUp ()
+namespace MonoTests.System
+{
+ internal struct ParseTest
{
- old_culture = Thread.CurrentThread.CurrentCulture;
-
- // Set culture to en-US and don't let the user override.
- Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
-
- NfiUser = new NumberFormatInfo();
- NfiUser.CurrencyDecimalDigits = 3;
- NfiUser.CurrencyDecimalSeparator = ",";
- NfiUser.CurrencyGroupSeparator = "_";
- NfiUser.CurrencyGroupSizes = new int[] { 2,1,0 };
- NfiUser.CurrencyNegativePattern = 10;
- NfiUser.CurrencyPositivePattern = 3;
- NfiUser.CurrencySymbol = "XYZ";
- NfiUser.NumberDecimalSeparator = "##";
- NfiUser.NumberDecimalDigits = 4;
- NfiUser.NumberGroupSeparator = "__";
- NfiUser.NumberGroupSizes = new int[] { 2,1 };
- NfiUser.PercentDecimalDigits = 1;
- NfiUser.PercentDecimalSeparator = ";";
- NfiUser.PercentGroupSeparator = "~";
- NfiUser.PercentGroupSizes = new int[] {1};
- NfiUser.PercentNegativePattern = 2;
- NfiUser.PercentPositivePattern = 2;
- NfiUser.PercentSymbol = "%%%";
- }
-
- [TestFixtureTearDown]
- public void FixtureTearDown ()
+ public ParseTest (String str, bool exceptionFlag)
+ {
+ this.str = str;
+ this.exceptionFlag = exceptionFlag;
+ this.style = NumberStyles.Number;
+ this.d = 0;
+ }
+
+ public ParseTest (String str, Decimal d)
+ {
+ this.str = str;
+ this.exceptionFlag = false;
+ this.style = NumberStyles.Number;
+ this.d = d;
+ }
+
+ public ParseTest (String str, Decimal d, NumberStyles style)
+ {
+ this.str = str;
+ this.exceptionFlag = false;
+ this.style = style;
+ this.d = d;
+ }
+
+ public String str;
+ public Decimal d;
+ public NumberStyles style;
+ public bool exceptionFlag;
+ }
+
+ internal struct ToStringTest
{
- Thread.CurrentThread.CurrentCulture = old_culture;
+ public ToStringTest (String format, Decimal d, String str)
+ {
+ this.format = format;
+ this.d = d;
+ this.str = str;
+ }
+
+ public String format;
+ public Decimal d;
+ public String str;
}
- public void TestToString()
- {
- ToStringTest[] tab = {
- new ToStringTest("F", 12.345678m, "12.35"),
- new ToStringTest("F3", 12.345678m, "12.346"),
- new ToStringTest("F0", 12.345678m, "12"),
- new ToStringTest("F7", 12.345678m, "12.3456780"),
- new ToStringTest("g", 12.345678m, "12.345678"),
- new ToStringTest("E", 12.345678m, "1.234568E+001"),
- new ToStringTest("E3", 12.345678m, "1.235E+001"),
- new ToStringTest("E0", 12.345678m, "1E+001"),
- new ToStringTest("e8", 12.345678m, "1.23456780e+001"),
- new ToStringTest("F", 0.0012m, "0.00"),
- new ToStringTest("F3", 0.0012m, "0.001"),
- new ToStringTest("F0", 0.0012m, "0"),
- new ToStringTest("F6", 0.0012m, "0.001200"),
- new ToStringTest("e", 0.0012m, "1.200000e-003"),
- new ToStringTest("E3", 0.0012m, "1.200E-003"),
- new ToStringTest("E0", 0.0012m, "1E-003"),
- new ToStringTest("E6", 0.0012m, "1.200000E-003"),
- new ToStringTest("F4", -0.001234m, "-0.0012"),
- new ToStringTest("E3", -0.001234m, "-1.234E-003"),
+ [TestFixture]
+ public class DecimalTest : Assertion
+ {
+ private const int negativeBitValue = unchecked ((int) 0x80000000);
+ private const int negativeScale4Value = unchecked ((int) 0x80040000);
+ private int [] parts0 = { 0, 0, 0, 0 }; //Positive Zero.
+ private int [] parts1 = { 1, 0, 0, 0 };
+ private int [] parts2 = { 0, 1, 0, 0 };
+ private int [] parts3 = { 0, 0, 1, 0 };
+ private int [] parts4 = { 0, 0, 0, negativeBitValue }; // Negative zero.
+ private int [] parts5 = { 1, 1, 1, 0 };
+ private int [] partsMaxValue = { -1, -1, -1, 0 };
+ private int [] partsMinValue = { -1, -1, -1, negativeBitValue };
+ private int [] parts6 = { 1234, 5678, 8888, negativeScale4Value };
+ private NumberFormatInfo NfiUser;
+
+ private CultureInfo old_culture;
+
+ [TestFixtureSetUp]
+ public void FixtureSetUp ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ NfiUser = new NumberFormatInfo ();
+ NfiUser.CurrencyDecimalDigits = 3;
+ NfiUser.CurrencyDecimalSeparator = ",";
+ NfiUser.CurrencyGroupSeparator = "_";
+ NfiUser.CurrencyGroupSizes = new int [] { 2, 1, 0 };
+ NfiUser.CurrencyNegativePattern = 10;
+ NfiUser.CurrencyPositivePattern = 3;
+ NfiUser.CurrencySymbol = "XYZ";
+ NfiUser.NumberDecimalSeparator = "##";
+ NfiUser.NumberDecimalDigits = 4;
+ NfiUser.NumberGroupSeparator = "__";
+ NfiUser.NumberGroupSizes = new int [] { 2, 1 };
+ NfiUser.PercentDecimalDigits = 1;
+ NfiUser.PercentDecimalSeparator = ";";
+ NfiUser.PercentGroupSeparator = "~";
+ NfiUser.PercentGroupSizes = new int [] { 1 };
+ NfiUser.PercentNegativePattern = 2;
+ NfiUser.PercentPositivePattern = 2;
+ NfiUser.PercentSymbol = "%%%";
+ }
+
+ [TestFixtureTearDown]
+ public void FixtureTearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ [Test]
+ public void TestToString ()
+ {
+ ToStringTest [] tab = {
+ new ToStringTest ("F", 12.345678m, "12.35"),
+ new ToStringTest ("F3", 12.345678m, "12.346"),
+ new ToStringTest ("F0", 12.345678m, "12"),
+ new ToStringTest ("F7", 12.345678m, "12.3456780"),
+ new ToStringTest ("g", 12.345678m, "12.345678"),
+ new ToStringTest ("E", 12.345678m, "1.234568E+001"),
+ new ToStringTest ("E3", 12.345678m, "1.235E+001"),
+ new ToStringTest ("E0", 12.345678m, "1E+001"),
+ new ToStringTest ("e8", 12.345678m, "1.23456780e+001"),
+ new ToStringTest ("F", 0.0012m, "0.00"),
+ new ToStringTest ("F3", 0.0012m, "0.001"),
+ new ToStringTest ("F0", 0.0012m, "0"),
+ new ToStringTest ("F6", 0.0012m, "0.001200"),
+ new ToStringTest ("e", 0.0012m, "1.200000e-003"),
+ new ToStringTest ("E3", 0.0012m, "1.200E-003"),
+ new ToStringTest ("E0", 0.0012m, "1E-003"),
+ new ToStringTest ("E6", 0.0012m, "1.200000E-003"),
+ new ToStringTest ("F4", -0.001234m, "-0.0012"),
+ new ToStringTest ("E3", -0.001234m, "-1.234E-003"),
#if NET_1_0
- new ToStringTest("g", -0.000012m, "-1.2e-05"),
+ new ToStringTest ("g", -0.000012m, "-1.2e-05"),
#else
- new ToStringTest("g", -0.000012m, "-0.000012"),
+ new ToStringTest ("g", -0.000012m, "-0.000012"),
#endif
- new ToStringTest("g", -0.00012m, "-0.00012"),
- new ToStringTest("g4", -0.00012m, "-0.00012"),
- new ToStringTest("g7", -0.00012m, "-0.00012"),
- new ToStringTest("g", -0.0001234m, "-0.0001234"),
- new ToStringTest("g", -0.0012m, "-0.0012"),
- new ToStringTest("g", -0.001234m, "-0.001234"),
- new ToStringTest("g", -0.012m, "-0.012"),
- new ToStringTest("g4", -0.012m, "-0.012"),
- new ToStringTest("g", -0.12m, "-0.12"),
- new ToStringTest("g", -1.2m, "-1.2"),
- new ToStringTest("g4", -120m, "-120"),
- new ToStringTest("g", -12m, "-12"),
- new ToStringTest("g", -120m, "-120"),
- new ToStringTest("g", -1200m, "-1200"),
- new ToStringTest("g4", -1200m, "-1200"),
- new ToStringTest("g", -1234m, "-1234"),
- new ToStringTest("g", -12000m, "-12000"),
- new ToStringTest("g4", -12000m, "-1.2e+04"),
- new ToStringTest("g5", -12000m, "-12000"),
- new ToStringTest("g", -12345m, "-12345"),
- new ToStringTest("g", -120000m, "-120000"),
- new ToStringTest("g4", -120000m, "-1.2e+05"),
- new ToStringTest("g5", -120000m, "-1.2e+05"),
- new ToStringTest("g6", -120000m, "-120000"),
- new ToStringTest("g", -123456.1m, "-123456.1"),
- new ToStringTest("g5", -123456.1m, "-1.2346e+05"),
- new ToStringTest("g6", -123456.1m, "-123456"),
- new ToStringTest("g", -1200000m, "-1200000"),
- new ToStringTest("g", -123456.1m, "-123456.1"),
- new ToStringTest("g", -123456.1m, "-123456.1"),
- new ToStringTest("g", -1234567.1m, "-1234567.1"),
- new ToStringTest("g", -12000000m, "-12000000"),
- new ToStringTest("g", -12345678.1m, "-12345678.1"),
- new ToStringTest("g", -12000000000000000000m, "-12000000000000000000"),
- new ToStringTest("F", -123, "-123.00"),
- new ToStringTest("F3", -123, "-123.000"),
- new ToStringTest("F0", -123, "-123"),
- new ToStringTest("E3", -123, "-1.230E+002"),
- new ToStringTest("E0", -123, "-1E+002"),
- new ToStringTest("E", -123, "-1.230000E+002"),
- new ToStringTest("F3", Decimal.MinValue, "-79228162514264337593543950335.000"),
- new ToStringTest("F", Decimal.MinValue, "-79228162514264337593543950335.00"),
- new ToStringTest("F0", Decimal.MinValue, "-79228162514264337593543950335"),
- new ToStringTest("E", Decimal.MinValue, "-7.922816E+028"),
- new ToStringTest("E3", Decimal.MinValue, "-7.923E+028"),
- new ToStringTest("E28", Decimal.MinValue, "-7.9228162514264337593543950335E+028"),
- new ToStringTest("E30", Decimal.MinValue, "-7.922816251426433759354395033500E+028"),
- new ToStringTest("E0", Decimal.MinValue, "-8E+028"),
- new ToStringTest("N3", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.000"),
- new ToStringTest("N0", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335"),
- new ToStringTest("N", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.00"),
- new ToStringTest("n3", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.000"),
- new ToStringTest("n0", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335"),
- new ToStringTest("n", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.00"),
- new ToStringTest("C", 123456.7890m, NumberFormatInfo.InvariantInfo.CurrencySymbol + "123,456.79"),
- new ToStringTest("C", -123456.7890m, "(" + NumberFormatInfo.InvariantInfo.CurrencySymbol + "123,456.79)"),
- new ToStringTest("C3", 1123456.7890m, NumberFormatInfo.InvariantInfo.CurrencySymbol + "1,123,456.789"),
- new ToStringTest("P", 123456.7891m, "12,345,678.91 %"),
- new ToStringTest("P", -123456.7892m, "-12,345,678.92 %"),
- new ToStringTest("P3", 1234.56789m, "123,456.789 %"),
- };
-
- NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
-
- for (int i = 0; i < tab.Length; i++)
- {
- try
- {
- string s = tab[i].d.ToString(tab[i].format, nfi);
- AssertEquals("A01 tab[" + i + "].format = '" + tab[i].format + "')", tab[i].str, s);
- }
- catch (OverflowException)
- {
- Fail(tab[i].d.ToString(tab[i].format, nfi) + " (format = '" + tab[i].format + "'): unexpected exception !");
- }
- catch (NUnit.Framework.AssertionException e) {
- throw e;
+ new ToStringTest ("g", -0.00012m, "-0.00012"),
+ new ToStringTest ("g4", -0.00012m, "-0.00012"),
+ new ToStringTest ("g7", -0.00012m, "-0.00012"),
+ new ToStringTest ("g", -0.0001234m, "-0.0001234"),
+ new ToStringTest ("g", -0.0012m, "-0.0012"),
+ new ToStringTest ("g", -0.001234m, "-0.001234"),
+ new ToStringTest ("g", -0.012m, "-0.012"),
+ new ToStringTest ("g4", -0.012m, "-0.012"),
+ new ToStringTest ("g", -0.12m, "-0.12"),
+ new ToStringTest ("g", -1.2m, "-1.2"),
+ new ToStringTest ("g4", -120m, "-120"),
+ new ToStringTest ("g", -12m, "-12"),
+ new ToStringTest ("g", -120m, "-120"),
+ new ToStringTest ("g", -1200m, "-1200"),
+ new ToStringTest ("g4", -1200m, "-1200"),
+ new ToStringTest ("g", -1234m, "-1234"),
+ new ToStringTest ("g", -12000m, "-12000"),
+ new ToStringTest ("g4", -12000m, "-1.2e+04"),
+ new ToStringTest ("g5", -12000m, "-12000"),
+ new ToStringTest ("g", -12345m, "-12345"),
+ new ToStringTest ("g", -120000m, "-120000"),
+ new ToStringTest ("g4", -120000m, "-1.2e+05"),
+ new ToStringTest ("g5", -120000m, "-1.2e+05"),
+ new ToStringTest ("g6", -120000m, "-120000"),
+ new ToStringTest ("g", -123456.1m, "-123456.1"),
+ new ToStringTest ("g5", -123456.1m, "-1.2346e+05"),
+ new ToStringTest ("g6", -123456.1m, "-123456"),
+ new ToStringTest ("g", -1200000m, "-1200000"),
+ new ToStringTest ("g", -123456.1m, "-123456.1"),
+ new ToStringTest ("g", -123456.1m, "-123456.1"),
+ new ToStringTest ("g", -1234567.1m, "-1234567.1"),
+ new ToStringTest ("g", -12000000m, "-12000000"),
+ new ToStringTest ("g", -12345678.1m, "-12345678.1"),
+ new ToStringTest ("g", -12000000000000000000m, "-12000000000000000000"),
+ new ToStringTest ("F", -123, "-123.00"),
+ new ToStringTest ("F3", -123, "-123.000"),
+ new ToStringTest ("F0", -123, "-123"),
+ new ToStringTest ("E3", -123, "-1.230E+002"),
+ new ToStringTest ("E0", -123, "-1E+002"),
+ new ToStringTest ("E", -123, "-1.230000E+002"),
+ new ToStringTest ("F3", Decimal.MinValue, "-79228162514264337593543950335.000"),
+ new ToStringTest ("F", Decimal.MinValue, "-79228162514264337593543950335.00"),
+ new ToStringTest ("F0", Decimal.MinValue, "-79228162514264337593543950335"),
+ new ToStringTest ("E", Decimal.MinValue, "-7.922816E+028"),
+ new ToStringTest ("E3", Decimal.MinValue, "-7.923E+028"),
+ new ToStringTest ("E28", Decimal.MinValue, "-7.9228162514264337593543950335E+028"),
+ new ToStringTest ("E30", Decimal.MinValue, "-7.922816251426433759354395033500E+028"),
+ new ToStringTest ("E0", Decimal.MinValue, "-8E+028"),
+ new ToStringTest ("N3", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.000"),
+ new ToStringTest ("N0", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335"),
+ new ToStringTest ("N", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.00"),
+ new ToStringTest ("n3", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.000"),
+ new ToStringTest ("n0", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335"),
+ new ToStringTest ("n", Decimal.MinValue, "-79,228,162,514,264,337,593,543,950,335.00"),
+ new ToStringTest ("C", 123456.7890m, NumberFormatInfo.InvariantInfo.CurrencySymbol + "123,456.79"),
+ new ToStringTest ("C", -123456.7890m, "(" + NumberFormatInfo.InvariantInfo.CurrencySymbol + "123,456.79)"),
+ new ToStringTest ("C3", 1123456.7890m, NumberFormatInfo.InvariantInfo.CurrencySymbol + "1,123,456.789"),
+ new ToStringTest ("P", 123456.7891m, "12,345,678.91 %"),
+ new ToStringTest ("P", -123456.7892m, "-12,345,678.92 %"),
+ new ToStringTest ("P3", 1234.56789m, "123,456.789 %"),
+ };
+
+ NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
+
+ for (int i = 0; i < tab.Length; i++) {
+ try {
+ string s = tab [i].d.ToString (tab [i].format, nfi);
+ AssertEquals ("A01 tab[" + i + "].format = '" + tab [i].format + "')", tab [i].str, s);
+ } catch (OverflowException) {
+ Fail (tab [i].d.ToString (tab [i].format, nfi) + " (format = '" + tab [i].format + "'): unexpected exception !");
+ } catch (NUnit.Framework.AssertionException e) {
+ throw e;
+ } catch (Exception e) {
+ Fail ("Unexpected Exception when i = " + i + ". e = " + e);
+ }
+ }
}
- catch (Exception e) {
- Fail ("Unexpected Exception when i = " + i + ". e = " + e);
+
+ [Test]
+ public void TestCurrencyPattern ()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo) NfiUser.Clone ();
+ Decimal d = -1234567.8976m;
+ string [] ergCurrencyNegativePattern = new String [16] {
+ "(XYZ1234_5_67,898)", "-XYZ1234_5_67,898", "XYZ-1234_5_67,898", "XYZ1234_5_67,898-",
+ "(1234_5_67,898XYZ)", "-1234_5_67,898XYZ", "1234_5_67,898-XYZ", "1234_5_67,898XYZ-",
+ "-1234_5_67,898 XYZ", "-XYZ 1234_5_67,898", "1234_5_67,898 XYZ-", "XYZ 1234_5_67,898-",
+ "XYZ -1234_5_67,898", "1234_5_67,898- XYZ", "(XYZ 1234_5_67,898)", "(1234_5_67,898 XYZ)",
+ };
+
+ for (int i = 0; i < ergCurrencyNegativePattern.Length; i++) {
+ nfi2.CurrencyNegativePattern = i;
+ if (d.ToString ("C", nfi2) != ergCurrencyNegativePattern [i]) {
+ Fail ("CurrencyNegativePattern #" + i + " failed: " +
+ d.ToString ("C", nfi2) + " != " + ergCurrencyNegativePattern [i]);
+ }
+ }
+
+ d = 1234567.8976m;
+ string [] ergCurrencyPositivePattern = new String [4] {
+ "XYZ1234_5_67,898", "1234_5_67,898XYZ", "XYZ 1234_5_67,898", "1234_5_67,898 XYZ",
+ };
+
+ for (int i = 0; i < ergCurrencyPositivePattern.Length; i++) {
+ nfi2.CurrencyPositivePattern = i;
+ if (d.ToString ("C", nfi2) != ergCurrencyPositivePattern [i]) {
+ Fail ("CurrencyPositivePattern #" + i + " failed: " +
+ d.ToString ("C", nfi2) + " != " + ergCurrencyPositivePattern [i]);
+ }
+ }
+ }
+
+ [Test]
+ public void TestNumberNegativePattern ()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo) NfiUser.Clone ();
+ Decimal d = -1234.89765m;
+ string [] ergNumberNegativePattern = new String [5] {
+ "(1__2__34##8977)", "-1__2__34##8977", "- 1__2__34##8977", "1__2__34##8977-", "1__2__34##8977 -",
+ };
+
+ for (int i = 0; i < ergNumberNegativePattern.Length; i++) {
+ nfi2.NumberNegativePattern = i;
+ AssertEquals ("NumberNegativePattern #" + i, ergNumberNegativePattern [i], d.ToString ("N", nfi2));
+ }
+ }
+
+ [Test]
+ public void TestPercentPattern ()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo) NfiUser.Clone ();
+ Decimal d = -1234.8976m;
+ string [] ergPercentNegativePattern = new String [3] {
+ "-1~2~3~4~8~9;8 %%%", "-1~2~3~4~8~9;8%%%", "-%%%1~2~3~4~8~9;8"
+ };
+
+ for (int i = 0; i < ergPercentNegativePattern.Length; i++) {
+ nfi2.PercentNegativePattern = i;
+ if (d.ToString ("P", nfi2) != ergPercentNegativePattern [i]) {
+ Fail ("PercentNegativePattern #" + i + " failed: " +
+ d.ToString ("P", nfi2) + " != " + ergPercentNegativePattern [i]);
+ }
+ }
+
+ d = 1234.8976m;
+ string [] ergPercentPositivePattern = new String [3] {
+ "1~2~3~4~8~9;8 %%%", "1~2~3~4~8~9;8%%%", "%%%1~2~3~4~8~9;8"
+ };
+
+ for (int i = 0; i < ergPercentPositivePattern.Length; i++) {
+ nfi2.PercentPositivePattern = i;
+ if (d.ToString ("P", nfi2) != ergPercentPositivePattern [i]) {
+ Fail ("PercentPositivePattern #" + i + " failed: " +
+ d.ToString ("P", nfi2) + " != " + ergPercentPositivePattern [i]);
+ }
+ }
}
- }
- }
-
- public void TestCurrencyPattern()
- {
- NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
- Decimal d = -1234567.8976m;
- string[] ergCurrencyNegativePattern = new String[16] {
- "(XYZ1234_5_67,898)", "-XYZ1234_5_67,898", "XYZ-1234_5_67,898", "XYZ1234_5_67,898-",
- "(1234_5_67,898XYZ)", "-1234_5_67,898XYZ", "1234_5_67,898-XYZ", "1234_5_67,898XYZ-",
- "-1234_5_67,898 XYZ", "-XYZ 1234_5_67,898", "1234_5_67,898 XYZ-", "XYZ 1234_5_67,898-",
- "XYZ -1234_5_67,898", "1234_5_67,898- XYZ", "(XYZ 1234_5_67,898)", "(1234_5_67,898 XYZ)",
- };
-
- for (int i = 0; i < ergCurrencyNegativePattern.Length; i++)
- {
- nfi2.CurrencyNegativePattern = i;
- if (d.ToString("C", nfi2) != ergCurrencyNegativePattern[i])
- {
- Fail("CurrencyNegativePattern #" + i + " failed: " +
- d.ToString("C", nfi2) + " != " + ergCurrencyNegativePattern[i]);
- }
- }
-
- d = 1234567.8976m;
- string[] ergCurrencyPositivePattern = new String[4] {
- "XYZ1234_5_67,898", "1234_5_67,898XYZ", "XYZ 1234_5_67,898", "1234_5_67,898 XYZ",
- };
-
- for (int i = 0; i < ergCurrencyPositivePattern.Length; i++)
- {
- nfi2.CurrencyPositivePattern = i;
- if (d.ToString("C", nfi2) != ergCurrencyPositivePattern[i])
- {
- Fail("CurrencyPositivePattern #" + i + " failed: " +
- d.ToString("C", nfi2) + " != " + ergCurrencyPositivePattern[i]);
- }
- }
- }
-
- public void TestNumberNegativePattern()
- {
- NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
- Decimal d = -1234.89765m;
- string[] ergNumberNegativePattern = new String[5] {
- "(1__2__34##8977)", "-1__2__34##8977", "- 1__2__34##8977", "1__2__34##8977-", "1__2__34##8977 -",
- };
-
- for (int i = 0; i < ergNumberNegativePattern.Length; i++)
- {
- nfi2.NumberNegativePattern = i;
- AssertEquals ("NumberNegativePattern #" + i, ergNumberNegativePattern[i], d.ToString("N", nfi2));
- }
- }
-
- public void TestPercentPattern()
- {
- NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
- Decimal d = -1234.8976m;
- string[] ergPercentNegativePattern = new String[3] {
- "-1~2~3~4~8~9;8 %%%", "-1~2~3~4~8~9;8%%%", "-%%%1~2~3~4~8~9;8"
- };
-
- for (int i = 0; i < ergPercentNegativePattern.Length; i++)
- {
- nfi2.PercentNegativePattern = i;
- if (d.ToString("P", nfi2) != ergPercentNegativePattern[i])
- {
- Fail("PercentNegativePattern #" + i + " failed: " +
- d.ToString("P", nfi2) + " != " + ergPercentNegativePattern[i]);
- }
- }
-
- d = 1234.8976m;
- string[] ergPercentPositivePattern = new String[3] {
- "1~2~3~4~8~9;8 %%%", "1~2~3~4~8~9;8%%%", "%%%1~2~3~4~8~9;8"
- };
-
- for (int i = 0; i < ergPercentPositivePattern.Length; i++)
- {
- nfi2.PercentPositivePattern = i;
- if (d.ToString("P", nfi2) != ergPercentPositivePattern[i])
- {
- Fail("PercentPositivePattern #" + i + " failed: " +
- d.ToString("P", nfi2) + " != " + ergPercentPositivePattern[i]);
- }
- }
- }
-
- ParseTest[] tab = {
- new ParseTest("1.2345", 1.2345m),
- new ParseTest("-9876543210", -9876543210m),
- new ParseTest(NumberFormatInfo.InvariantInfo.CurrencySymbol
- + " ( 79,228,162,514,264,337,593,543,950,335.000 ) ", Decimal.MinValue, NumberStyles.Currency),
- new ParseTest("1.234567890e-10", (Decimal)1.234567890e-10, NumberStyles.Float),
- new ParseTest("1.234567890e-24", 1.2346e-24m, NumberStyles.Float),
- new ParseTest(" 47896396.457983645462346E10 ", 478963964579836454.62346m, NumberStyles.Float),
- new ParseTest("-7922816251426433759354395033.250000000000001", -7922816251426433759354395033.3m),
- new ParseTest("-00000000000000795033.2500000000000000", -795033.25m),
- new ParseTest("-000000000000001922816251426433759354395033.300000000000000", -1922816251426433759354395033.3m),
- new ParseTest("-7922816251426433759354395033.150000000000", -7922816251426433759354395033.2m),
- new ParseTest("-7922816251426433759354395033.2400000000000", -7922816251426433759354395033.2m),
- new ParseTest("-7922816251426433759354395033.2600000000000", -7922816251426433759354395033.3m)
- };
-
- public void TestParse()
- {
-
- Decimal d;
- for (int i = 0; i < tab.Length; i++)
- {
- try
- {
- d = Decimal.Parse(tab[i].str, tab[i].style, NumberFormatInfo.InvariantInfo);
- if (tab[i].exceptionFlag)
- {
- Fail(tab[i].str + ": missing exception !");
- }
- else if (d != tab[i].d)
- {
- Fail(tab[i].str + " != " + d);
- }
- }
- catch (OverflowException)
- {
- if (!tab[i].exceptionFlag)
- {
- Fail(tab[i].str + ": unexpected exception !");
- }
- }
- }
-
- try
- {
- d = Decimal.Parse(null);
- Fail("Expected ArgumentNullException");
- }
- catch (ArgumentNullException)
- {
- //ok
- }
-
- try
- {
- d = Decimal.Parse("123nx");
- Fail("Expected FormatException");
- }
- catch (FormatException)
- {
- //ok
- }
-
- try
- {
- d = Decimal.Parse("79228162514264337593543950336");
- Fail("Expected OverflowException" + d);
- }
- catch (OverflowException)
- {
- //ok
- }
- }
-
- public void TestConstants()
- {
- AssertEquals ("Zero", 0m, Decimal.Zero);
- AssertEquals ("One", 1m, Decimal.One);
- AssertEquals ("MinusOne", -1m, Decimal.MinusOne);
- AssertEquals ("MaxValue", 79228162514264337593543950335m, Decimal.MaxValue);
- AssertEquals ("MinValue", -79228162514264337593543950335m, Decimal.MinValue);
- Assert ("MinusOne 2", -1m == Decimal.MinusOne);
- }
-
- public void TestConstructInt32()
- {
- decimal[] dtab = {0m, 1m, -1m, 123456m, -1234567m};
- int[] itab = {0, 1, -1, 123456, -1234567};
-
- Decimal d;
-
- for (int i = 0; i < dtab.GetLength(0); i++)
- {
- d = new Decimal(itab[i]);
- if ((decimal)d != dtab[i])
- {
- Fail("Int32 -> Decimal: " + itab[i] + " != " + d);
- }
- else
- {
- int n = (int) d;
- if (n != itab[i])
- {
- Fail("Decimal -> Int32: " + d + " != " + itab[i]);
- }
- }
- }
-
- d = new Decimal(Int32.MaxValue);
- Assert((int)d == Int32.MaxValue);
-
- d = new Decimal(Int32.MinValue);
- Assert((int)d == Int32.MinValue);
- }
-
- public void TestConstructUInt32()
- {
- decimal[] dtab = {0m, 1m, 123456m, 123456789m};
- uint[] itab = {0, 1, 123456, 123456789};
-
- Decimal d;
-
- for (int i = 0; i < dtab.GetLength(0); i++)
- {
- d = new Decimal(itab[i]);
- if ((decimal)d != dtab[i])
- {
- Fail("UInt32 -> Decimal: " + itab[i] + " != " + d);
- }
- else
- {
- uint n = (uint) d;
- if (n != itab[i])
- {
- Fail("Decimal -> UInt32: " + d + " != " + itab[i]);
- }
- }
- }
-
- d = new Decimal(UInt32.MaxValue);
- Assert((uint)d == UInt32.MaxValue);
-
- d = new Decimal(UInt32.MinValue);
- Assert((uint)d == UInt32.MinValue);
- }
-
- public void TestConstructInt64()
- {
- decimal[] dtab = {0m, 1m, -1m, 9876543m, -9876543210m, 12345678987654321m};
- long[] itab = {0, 1, -1, 9876543, -9876543210L, 12345678987654321L};
-
- Decimal d;
-
- for (int i = 0; i < dtab.GetLength(0); i++)
- {
- d = new Decimal(itab[i]);
- if ((decimal)d != dtab[i])
- {
- Fail("Int64 -> Decimal: " + itab[i] + " != " + d);
- }
- else
- {
- long n = (long) d;
- if (n != itab[i])
- {
- Fail("Decimal -> Int64: " + d + " != " + itab[i]);
- }
- }
- }
-
- d = new Decimal(Int64.MaxValue);
- Assert((long)d == Int64.MaxValue);
-
- d = new Decimal(Int64.MinValue);
- Assert((long)d == Int64.MinValue);
- }
-
- public void TestConstructUInt64()
- {
- decimal[] dtab = {0m, 1m, 987654321m, 123456789876543210m};
- ulong[] itab = {0, 1, 987654321, 123456789876543210L};
-
- Decimal d;
-
- for (int i = 0; i < dtab.GetLength(0); i++)
- {
- d = new Decimal(itab[i]);
- if ((decimal)d != dtab[i])
- {
- Fail("UInt64 -> Decimal: " + itab[i] + " != " + d);
- }
- else
- {
- ulong n = (ulong) d;
- if (n != itab[i])
- {
- Fail("Decimal -> UInt64: " + d + " != " + itab[i]);
- }
- }
- }
-
- d = new Decimal(UInt64.MaxValue);
- Assert((ulong)d == UInt64.MaxValue);
-
- d = new Decimal(UInt64.MinValue);
- Assert((ulong)d == UInt64.MinValue);
- }
-
- public void TestConstructSingle()
- {
- Decimal d;
-
- d = new Decimal(-1.2345678f);
- AssertEquals("A#01", -1.234568m, (decimal)d);
-
- d=3;
- AssertEquals("A#02", 3.0f, (float)d);
-
- d = new Decimal(0.0f);
- AssertEquals("A#03", 0m, (decimal)d);
- AssertEquals("A#04", 0.0f, (float)d);
-
- d = new Decimal(1.0f);
- AssertEquals("A#05", 1m, (decimal)d);
- AssertEquals("A#06", 1.0f, (float)d);
-
- d = new Decimal(-1.2345678f);
- AssertEquals("A#07", -1.234568m, (decimal)d);
- AssertEquals("A#08", -1.234568f, (float)d);
-
- d = new Decimal(1.2345673f);
- AssertEquals("A#09", 1.234567m, (decimal)d);
-
- d = new Decimal(1.2345673e7f);
- AssertEquals("A#10", 12345670m, (decimal)d);
-
- d = new Decimal(1.2345673e-17f);
- AssertEquals("A#11", 0.00000000000000001234567m, (decimal)d);
- AssertEquals("A#12", 1.234567e-17f, (float)d);
-
- // test exceptions
- try
- {
- d = new Decimal(Single.MaxValue);
- Fail();
- }
- catch (OverflowException)
- {
- }
-
- try
- {
- d = new Decimal(Single.NaN);
- Fail();
- }
- catch (OverflowException)
- {
- }
-
- try
- {
- d = new Decimal(Single.PositiveInfinity);
- Fail();
- }
- catch (OverflowException)
- {
- }
- }
-
- public void TestConstructSingleRounding_NowWorking ()
- {
- decimal d;
- d = new Decimal(1765.23454f);
- AssertEquals ("failed banker's rule rounding test 2", 1765.234m, d);
+ ParseTest [] tab = {
+ new ParseTest("1.2345", 1.2345m),
+ new ParseTest("-9876543210", -9876543210m),
+ new ParseTest(NumberFormatInfo.InvariantInfo.CurrencySymbol
+ + " ( 79,228,162,514,264,337,593,543,950,335.000 ) ",
+ Decimal.MinValue, NumberStyles.Currency),
+ new ParseTest("1.234567890e-10", (Decimal)1.234567890e-10, NumberStyles.Float),
+ new ParseTest("1.234567890e-24", 1.2346e-24m, NumberStyles.Float),
+ new ParseTest(" 47896396.457983645462346E10 ", 478963964579836454.62346m, NumberStyles.Float),
+ new ParseTest("-7922816251426433759354395033.250000000000001", -7922816251426433759354395033.3m),
+ new ParseTest("-00000000000000795033.2500000000000000", -795033.25m),
+ new ParseTest("-000000000000001922816251426433759354395033.300000000000000", -1922816251426433759354395033.3m),
+ new ParseTest("-7922816251426433759354395033.150000000000", -7922816251426433759354395033.2m),
+ new ParseTest("-7922816251426433759354395033.2400000000000", -7922816251426433759354395033.2m),
+ new ParseTest("-7922816251426433759354395033.2600000000000", -7922816251426433759354395033.3m)
+ };
+
+ [Test]
+ public void TestParse ()
+ {
+
+ Decimal d;
+ for (int i = 0; i < tab.Length; i++) {
+ try {
+ d = Decimal.Parse (tab [i].str, tab [i].style, NumberFormatInfo.InvariantInfo);
+ if (tab [i].exceptionFlag) {
+ Fail (tab [i].str + ": missing exception !");
+ } else if (d != tab [i].d) {
+ Fail (tab [i].str + " != " + d);
+ }
+ } catch (OverflowException) {
+ if (!tab [i].exceptionFlag) {
+ Fail (tab [i].str + ": unexpected exception !");
+ }
+ }
+ }
+
+ try {
+ d = Decimal.Parse (null);
+ Fail ("Expected ArgumentNullException");
+ } catch (ArgumentNullException) {
+ //ok
+ }
+
+ try {
+ d = Decimal.Parse ("123nx");
+ Fail ("Expected FormatException");
+ } catch (FormatException) {
+ //ok
+ }
+
+ try {
+ d = Decimal.Parse ("79228162514264337593543950336");
+ Fail ("Expected OverflowException" + d);
+ } catch (OverflowException) {
+ //ok
+ }
+ }
- d = new Decimal(0.00017652356f);
- AssertEquals ("06", 0.0001765236m, d);
+ [Test]
+ public void TestConstants ()
+ {
+ AssertEquals ("Zero", 0m, Decimal.Zero);
+ AssertEquals ("One", 1m, Decimal.One);
+ AssertEquals ("MinusOne", -1m, Decimal.MinusOne);
+ AssertEquals ("MaxValue", 79228162514264337593543950335m, Decimal.MaxValue);
+ AssertEquals ("MinValue", -79228162514264337593543950335m, Decimal.MinValue);
+ Assert ("MinusOne 2", -1m == Decimal.MinusOne);
+ }
- d = new Decimal(0.000176523554f);
- AssertEquals ("failed banker's rule rounding test 3", 0.0001765236m, d);
+ [Test]
+ public void TestConstructInt32 ()
+ {
+ decimal [] dtab = { 0m, 1m, -1m, 123456m, -1234567m };
+ int [] itab = { 0, 1, -1, 123456, -1234567 };
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength (0); i++) {
+ d = new Decimal (itab [i]);
+ if ((decimal) d != dtab [i]) {
+ Fail ("Int32 -> Decimal: " + itab [i] + " != " + d);
+ } else {
+ int n = (int) d;
+ if (n != itab [i]) {
+ Fail ("Decimal -> Int32: " + d + " != " + itab [i]);
+ }
+ }
+ }
+
+ d = new Decimal (Int32.MaxValue);
+ Assert ((int) d == Int32.MaxValue);
+
+ d = new Decimal (Int32.MinValue);
+ Assert ((int) d == Int32.MinValue);
+ }
- d = new Decimal(0.00017652354f);
- AssertEquals ("08", 0.0001765235m, d);
+ [Test]
+ public void TestConstructUInt32 ()
+ {
+ decimal [] dtab = { 0m, 1m, 123456m, 123456789m };
+ uint [] itab = { 0, 1, 123456, 123456789 };
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength (0); i++) {
+ d = new Decimal (itab [i]);
+ if ((decimal) d != dtab [i]) {
+ Fail ("UInt32 -> Decimal: " + itab [i] + " != " + d);
+ } else {
+ uint n = (uint) d;
+ if (n != itab [i]) {
+ Fail ("Decimal -> UInt32: " + d + " != " + itab [i]);
+ }
+ }
+ }
+
+ d = new Decimal (UInt32.MaxValue);
+ Assert ((uint) d == UInt32.MaxValue);
+
+ d = new Decimal (UInt32.MinValue);
+ Assert ((uint) d == UInt32.MinValue);
+ }
- d = new Decimal(0.00017652346f);
- AssertEquals ("09", 0.0001765235m, d);
+ [Test]
+ public void TestConstructInt64 ()
+ {
+ decimal [] dtab = { 0m, 1m, -1m, 9876543m, -9876543210m, 12345678987654321m };
+ long [] itab = { 0, 1, -1, 9876543, -9876543210L, 12345678987654321L };
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength (0); i++) {
+ d = new Decimal (itab [i]);
+ if ((decimal) d != dtab [i]) {
+ Fail ("Int64 -> Decimal: " + itab [i] + " != " + d);
+ } else {
+ long n = (long) d;
+ if (n != itab [i]) {
+ Fail ("Decimal -> Int64: " + d + " != " + itab [i]);
+ }
+ }
+ }
+
+ d = new Decimal (Int64.MaxValue);
+ Assert ((long) d == Int64.MaxValue);
+
+ d = new Decimal (Int64.MinValue);
+ Assert ((long) d == Int64.MinValue);
+ }
- d = new Decimal(0.000176523454f);
- AssertEquals ("failed banker's rule rounding test 4", 0.0001765234m, d);
+ [Test]
+ public void TestConstructUInt64 ()
+ {
+ decimal [] dtab = { 0m, 1m, 987654321m, 123456789876543210m };
+ ulong [] itab = { 0, 1, 987654321, 123456789876543210L };
+
+ Decimal d;
+
+ for (int i = 0; i < dtab.GetLength (0); i++) {
+ d = new Decimal (itab [i]);
+ if ((decimal) d != dtab [i]) {
+ Fail ("UInt64 -> Decimal: " + itab [i] + " != " + d);
+ } else {
+ ulong n = (ulong) d;
+ if (n != itab [i]) {
+ Fail ("Decimal -> UInt64: " + d + " != " + itab [i]);
+ }
+ }
+ }
+
+ d = new Decimal (UInt64.MaxValue);
+ Assert ((ulong) d == UInt64.MaxValue);
+
+ d = new Decimal (UInt64.MinValue);
+ Assert ((ulong) d == UInt64.MinValue);
+ }
- d = new Decimal(0.00017652344f);
- AssertEquals ("11", 0.0001765234m, d);
- }
+ [Test]
+ public void TestConstructSingle ()
+ {
+ Decimal d;
+
+ d = new Decimal (-1.2345678f);
+ AssertEquals ("A#01", -1.234568m, (decimal) d);
+
+ d = 3;
+ AssertEquals ("A#02", 3.0f, (float) d);
+
+ d = new Decimal (0.0f);
+ AssertEquals ("A#03", 0m, (decimal) d);
+ AssertEquals ("A#04", 0.0f, (float) d);
+
+ d = new Decimal (1.0f);
+ AssertEquals ("A#05", 1m, (decimal) d);
+ AssertEquals ("A#06", 1.0f, (float) d);
+
+ d = new Decimal (-1.2345678f);
+ AssertEquals ("A#07", -1.234568m, (decimal) d);
+ AssertEquals ("A#08", -1.234568f, (float) d);
+
+ d = new Decimal (1.2345673f);
+ AssertEquals ("A#09", 1.234567m, (decimal) d);
+
+ d = new Decimal (1.2345673e7f);
+ AssertEquals ("A#10", 12345670m, (decimal) d);
+
+ d = new Decimal (1.2345673e-17f);
+ AssertEquals ("A#11", 0.00000000000000001234567m, (decimal) d);
+ AssertEquals ("A#12", 1.234567e-17f, (float) d);
+
+ // test exceptions
+ try {
+ d = new Decimal (Single.MaxValue);
+ Fail ();
+ } catch (OverflowException) {
+ }
+
+ try {
+ d = new Decimal (Single.NaN);
+ Fail ();
+ } catch (OverflowException) {
+ }
+
+ try {
+ d = new Decimal (Single.PositiveInfinity);
+ Fail ();
+ } catch (OverflowException) {
+ }
+ }
- public void TestConstructSingleRounding()
- {
- decimal d;
+ [Test]
+ public void TestConstructSingleRounding_NowWorking ()
+ {
+ decimal d;
- d = new Decimal(1765.2356f);
- Assert("01", d == 1765.236m);
+ d = new Decimal (1765.23454f);
+ AssertEquals ("failed banker's rule rounding test 2", 1765.234m, d);
- d = new Decimal(1765.23554f);
- Assert("failed banker's rule rounding test 1", d == 1765.236m);
+ d = new Decimal (0.00017652356f);
+ AssertEquals ("06", 0.0001765236m, d);
- d = new Decimal(1765.2354f);
- Assert("03", d == 1765.235m);
+ d = new Decimal (0.000176523554f);
+ AssertEquals ("failed banker's rule rounding test 3", 0.0001765236m, d);
- d = new Decimal(1765.2346f);
- Assert("04", d == 1765.235m);
+ d = new Decimal (0.00017652354f);
+ AssertEquals ("08", 0.0001765235m, d);
- d = new Decimal(1765.2344f);
- Assert("05", d == 1765.234m);
+ d = new Decimal (0.00017652346f);
+ AssertEquals ("09", 0.0001765235m, d);
- d = new Decimal(3.7652356e10f);
- Assert("12", d == 37652360000m);
+ d = new Decimal (0.000176523454f);
+ AssertEquals ("failed banker's rule rounding test 4", 0.0001765234m, d);
- d = new Decimal(3.7652356e20f);
- Assert("13", d == 376523600000000000000m);
-
- d = new Decimal(3.76523554e20f);
- Assert("failed banker's rule rounding test 5", d == 376523600000000000000m);
-
- d = new Decimal(3.7652352e20f);
- Assert("15", d == 376523500000000000000m);
-
- d = new Decimal(3.7652348e20f);
- Assert("16", d == 376523500000000000000m);
-
- d = new Decimal(3.76523454e20f);
- Assert("failed banker's rule rounding test 6", d == 376523400000000000000m);
-
- d = new Decimal(3.7652342e20f);
- Assert("18", d == 376523400000000000000m);
- }
-
- public void TestConstructDouble()
- {
- Decimal d;
-
- d = new Decimal(0.0);
- Assert((decimal)d == 0m);
-
- d = new Decimal(1.0);
- Assert((decimal)d == 1m);
- Assert(1.0 == (double)d);
-
- d = new Decimal(-1.2345678901234);
- Assert((decimal)d == -1.2345678901234m);
- Assert(-1.2345678901234 == (double)d);
-
- d = new Decimal(1.2345678901234);
- Assert((decimal)d == 1.2345678901234m);
-
- d = new Decimal(1.2345678901234e8);
- Assert((decimal)d == 123456789.01234m);
- Assert(1.2345678901234e8 == (double)d);
-
- d = new Decimal(1.2345678901234e16);
- Assert((decimal)d == 12345678901234000m);
- Assert(1.2345678901234e16 == (double)d);
-
- d = new Decimal(1.2345678901234e24);
- Assert((decimal)d == 1234567890123400000000000m);
- Assert(1.2345678901234e24 == (double)d);
-
- d = new Decimal(1.2345678901234e28);
- Assert((decimal)d == 1.2345678901234e28m);
- Assert(1.2345678901234e28 == (double)d);
-
- d = new Decimal(7.2345678901234e28);
- Assert((decimal)d == 7.2345678901234e28m);
- Assert(new Decimal((double)d) == d);
-
- d = new Decimal(1.2345678901234e-8);
- Assert((decimal)d == 1.2345678901234e-8m);
-
- d = new Decimal(1.2345678901234e-14);
- Assert((decimal)d == 1.2345678901234e-14m);
- Assert(1.2345678901234e-14 == (double)d);
-
- d = new Decimal(1.2342278901234e-25);
- AssertEquals("A10", d, 1.234e-25m);
-
- // test exceptions
- try
- {
- d = new Decimal(8e28);
- Fail();
- }
- catch (OverflowException)
- {
- }
-
- try
- {
- d = new Decimal(8e48);
- Fail();
- }
- catch (OverflowException)
- {
- }
-
- try
- {
- d = new Decimal(Double.NaN);
- Fail();
- }
- catch (OverflowException)
- {
- }
-
- try
- {
- d = new Decimal(Double.PositiveInfinity);
- Fail();
- }
- catch (OverflowException)
- {
- }
- }
-
- public void TestConstructDoubleRound()
- {
- decimal d;
- int TestNum = 1;
-
- try {
- d = new Decimal(1765.231234567857);
- AssertEquals("A01", 1765.23123456786m, d);
-
- TestNum++;
- d = new Decimal(1765.2312345678554);
- AssertEquals("A02, failed banker's rule rounding test 1", 1765.23123456786m, d);
- AssertEquals("A03", 1765.23123456786, (double)d);
-
- TestNum++;
- d = new Decimal(1765.231234567853);
- Assert(d == 1765.23123456785m);
-
- TestNum++;
- d = new Decimal(1765.231234567847);
- Assert(d == 1765.23123456785m);
-
- TestNum++;
- d = new Decimal(1765.231234567843);
- Assert(d == 1765.23123456784m);
-
- TestNum++;
- d = new Decimal(1.765231234567857e-9);
- Assert(d == 1.76523123456786e-9m);
-
- TestNum++;
- d = new Decimal(1.7652312345678554e-9);
- Assert("failed banker's rule rounding test 3", d == 1.76523123456786e-9m);
-
- TestNum++;
- d = new Decimal(1.765231234567853e-9);
- Assert(d == 1.76523123456785e-9m);
-
- TestNum++;
- d = new Decimal(1.765231234567857e+24);
- Assert(d == 1.76523123456786e+24m);
-
- TestNum++;
- d = new Decimal(1.7652312345678554e+24);
- Assert("failed banker's rule rounding test 4", d == 1.76523123456786e+24m);
-
- TestNum++;
- d = new Decimal(1.765231234567853e+24);
- Assert(d == 1.76523123456785e+24m);
-
- TestNum++;
- d = new Decimal(1765.2312345678454);
- Assert(d == 1765.23123456785m);
+ d = new Decimal (0.00017652344f);
+ AssertEquals ("11", 0.0001765234m, d);
}
- catch (Exception e) {
- Fail("At TestNum = " + TestNum + " unexpected exception. e = " + e);
+
+ public void TestConstructSingleRounding ()
+ {
+ decimal d;
+
+ d = new Decimal (1765.2356f);
+ Assert ("01", d == 1765.236m);
+
+ d = new Decimal (1765.23554f);
+ Assert ("failed banker's rule rounding test 1", d == 1765.236m);
+
+ d = new Decimal (1765.2354f);
+ Assert ("03", d == 1765.235m);
+
+ d = new Decimal (1765.2346f);
+ Assert ("04", d == 1765.235m);
+
+ d = new Decimal (1765.2344f);
+ Assert ("05", d == 1765.234m);
+
+ d = new Decimal (3.7652356e10f);
+ Assert ("12", d == 37652360000m);
+
+ d = new Decimal (3.7652356e20f);
+ Assert ("13", d == 376523600000000000000m);
+
+ d = new Decimal (3.76523554e20f);
+ Assert ("failed banker's rule rounding test 5", d == 376523600000000000000m);
+
+ d = new Decimal (3.7652352e20f);
+ Assert ("15", d == 376523500000000000000m);
+
+ d = new Decimal (3.7652348e20f);
+ Assert ("16", d == 376523500000000000000m);
+
+ d = new Decimal (3.76523454e20f);
+ Assert ("failed banker's rule rounding test 6", d == 376523400000000000000m);
+
+ d = new Decimal (3.7652342e20f);
+ Assert ("18", d == 376523400000000000000m);
}
- }
-
- public void TestNegate()
- {
- decimal d;
-
- d = new Decimal(12345678);
- Assert((decimal)Decimal.Negate(d) == -12345678m);
- }
-
- public void TestPartConstruct()
- {
- decimal d;
-
- d = new Decimal(parts0);
- Assert(d == 0);
-
- d = new Decimal(parts1);
- Assert(d == 1);
-
- d = new Decimal(parts2);
- Assert(d == 4294967296m);
-
- d = new Decimal(parts3);
- Assert(d == 18446744073709551616m);
-
- d = new Decimal(parts4);
- Assert(d == 0m);
-
- d = new Decimal(parts5);
- Assert(d == 18446744078004518913m);
-
- d = new Decimal(partsMaxValue);
- Assert(d == Decimal.MaxValue);
-
- d = new Decimal(partsMinValue);
- Assert(d == Decimal.MinValue);
-
- d = new Decimal(parts6);
- int[] erg = Decimal.GetBits(d);
- for (int i = 0; i < 4; i++)
- {
- Assert(erg[i] == parts6[i]);
- }
- }
-
- public void TestFloorTruncate()
- {
- decimal[,] dtab = {
- {0m, 0m, 0m}, {1m, 1m, 1m}, {-1m, -1m, -1m}, {1.1m, 1m, 1m},
- {-1.000000000001m, -2m, -1m}, {12345.67890m,12345m,12345m},
- {-123456789012345.67890m, -123456789012346m, -123456789012345m},
- {Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue},
- {Decimal.MinValue, Decimal.MinValue, Decimal.MinValue},
- {6.999999999m, 6m, 6m}, {-6.999999999m, -7m, -6m},
- {0.00001m, 0m, 0m}, {-0.00001m, -1m, 0m}
- };
-
- decimal d;
-
- for (int i = 0; i < dtab.GetLength(0); i++)
- {
- d = Decimal.Floor(dtab[i,0]);
- if (d != dtab[i,1])
- {
- Fail("Floor: Floor(" + dtab[i,0] + ") != " + d);
- }
- d = Decimal.Truncate(dtab[i,0]);
- if (d != dtab[i,2])
- {
- Fail("Truncate: Truncate(" + dtab[i,0] + ") != " + d);
- }
- }
- }
-
- [Test]
- public void Truncate ()
- {
- decimal dd = 249.9m;
- decimal dt = Decimal.Truncate (dd);
- AssertEquals ("Original", 249.9m, dd);
- AssertEquals ("Truncate", 249m, dt);
- AssertEquals ("Cast-Byte", 249, (byte)dd);
- AssertEquals ("Cast-Char", 249, (char)dd);
- AssertEquals ("Cast-Int16", 249, (short)dd);
- AssertEquals ("Cast-UInt16", 249, (ushort)dd);
- AssertEquals ("Cast-Int32", 249, (int)dd);
- AssertEquals ("Cast-UInt32", 249, (uint)dd);
- AssertEquals ("Cast-Int64", 249, (long)dd);
- AssertEquals ("Cast-UInt64", 249, (ulong)dd);
- }
- public void TestRound()
- {
- decimal[,] dtab = {
- {1m, 0, 1m}, {1.234567890m, 1, 1.2m},
- {1.234567890m, 2, 1.23m}, {1.23450000001m, 3, 1.235m},
- {1.2355m, 3, 1.236m},
- {1.234567890m, 4, 1.2346m}, {1.23567890m, 2, 1.24m},
- {47893764694.4578563236436621m, 7, 47893764694.4578563m},
- {-47893764694.4578563236436621m, 9, -47893764694.457856324m},
- {-47893764694.4578m, 5, -47893764694.4578m}
- };
-
- decimal d;
-
- for (int i = 0; i < dtab.GetLength(0); i++)
- {
- d = Decimal.Round(dtab[i,0], (int)dtab[i,1]);
- if (d != dtab[i,2])
- {
- Fail("Round: Round(" + dtab[i,0] + "," + (int)dtab[i,1] + ") != " + d);
- }
- }
- }
-
- public void TestRoundFailures ()
- {
- decimal[,] dtab = {
- {1.2345m, 3, 1.234m}
- };
-
- decimal d;
-
- for (int i = 0; i < dtab.GetLength(0); i++)
- {
- d = Decimal.Round(dtab[i,0], (int)dtab[i,1]);
- if (d != dtab[i,2])
- {
- Fail("FailRound: Round(" + dtab[i,0] + "," + (int)dtab[i,1] + ") != " + d);
- }
- }
- }
-
- [Test]
- public void ParseInt64 ()
- {
- long max = Int64.MaxValue;
- Decimal dmax = Decimal.Parse (max.ToString ());
- AssertEquals ("Int64.MaxValue", Int64.MaxValue, Decimal.ToInt64 (dmax));
+ [Test]
+ public void TestConstructDouble ()
+ {
+ Decimal d;
+
+ d = new Decimal (0.0);
+ Assert ((decimal) d == 0m);
+
+ d = new Decimal (1.0);
+ Assert ((decimal) d == 1m);
+ Assert (1.0 == (double) d);
+
+ d = new Decimal (-1.2345678901234);
+ Assert ((decimal) d == -1.2345678901234m);
+ Assert (-1.2345678901234 == (double) d);
+
+ d = new Decimal (1.2345678901234);
+ Assert ((decimal) d == 1.2345678901234m);
+
+ d = new Decimal (1.2345678901234e8);
+ Assert ((decimal) d == 123456789.01234m);
+ Assert (1.2345678901234e8 == (double) d);
+
+ d = new Decimal (1.2345678901234e16);
+ Assert ((decimal) d == 12345678901234000m);
+ Assert (1.2345678901234e16 == (double) d);
+
+ d = new Decimal (1.2345678901234e24);
+ Assert ((decimal) d == 1234567890123400000000000m);
+ Assert (1.2345678901234e24 == (double) d);
+
+ d = new Decimal (1.2345678901234e28);
+ Assert ((decimal) d == 1.2345678901234e28m);
+ Assert (1.2345678901234e28 == (double) d);
+
+ d = new Decimal (7.2345678901234e28);
+ Assert ((decimal) d == 7.2345678901234e28m);
+ Assert (new Decimal ((double) d) == d);
+
+ d = new Decimal (1.2345678901234e-8);
+ Assert ((decimal) d == 1.2345678901234e-8m);
+
+ d = new Decimal (1.2345678901234e-14);
+ Assert ((decimal) d == 1.2345678901234e-14m);
+ Assert (1.2345678901234e-14 == (double) d);
+
+ d = new Decimal (1.2342278901234e-25);
+ AssertEquals ("A10", d, 1.234e-25m);
+
+ // test exceptions
+ try {
+ d = new Decimal (8e28);
+ Fail ();
+ } catch (OverflowException) {
+ }
+
+ try {
+ d = new Decimal (8e48);
+ Fail ();
+ } catch (OverflowException) {
+ }
+
+ try {
+ d = new Decimal (Double.NaN);
+ Fail ();
+ } catch (OverflowException) {
+ }
+
+ try {
+ d = new Decimal (Double.PositiveInfinity);
+ Fail ();
+ } catch (OverflowException) {
+ }
+ }
- long min = Int64.MinValue;
- Decimal dmin = Decimal.Parse (min.ToString ());
- AssertEquals ("Int64.MinValue", Int64.MinValue, Decimal.ToInt64 (dmin));
+ [Test]
+ public void TestConstructDoubleRound ()
+ {
+ decimal d;
+ int TestNum = 1;
+
+ try {
+ d = new Decimal (1765.231234567857);
+ AssertEquals ("A01", 1765.23123456786m, d);
+
+ TestNum++;
+ d = new Decimal (1765.2312345678554);
+ AssertEquals ("A02, failed banker's rule rounding test 1", 1765.23123456786m, d);
+ AssertEquals ("A03", 1765.23123456786, (double) d);
+
+ TestNum++;
+ d = new Decimal (1765.231234567853);
+ Assert (d == 1765.23123456785m);
+
+ TestNum++;
+ d = new Decimal (1765.231234567847);
+ Assert (d == 1765.23123456785m);
+
+ TestNum++;
+ d = new Decimal (1765.231234567843);
+ Assert (d == 1765.23123456784m);
+
+ TestNum++;
+ d = new Decimal (1.765231234567857e-9);
+ Assert (d == 1.76523123456786e-9m);
+
+ TestNum++;
+ d = new Decimal (1.7652312345678554e-9);
+ Assert ("failed banker's rule rounding test 3", d == 1.76523123456786e-9m);
+
+ TestNum++;
+ d = new Decimal (1.765231234567853e-9);
+ Assert (d == 1.76523123456785e-9m);
+
+ TestNum++;
+ d = new Decimal (1.765231234567857e+24);
+ Assert (d == 1.76523123456786e+24m);
+
+ TestNum++;
+ d = new Decimal (1.7652312345678554e+24);
+ Assert ("failed banker's rule rounding test 4", d == 1.76523123456786e+24m);
+
+ TestNum++;
+ d = new Decimal (1.765231234567853e+24);
+ Assert (d == 1.76523123456785e+24m);
+
+ TestNum++;
+ d = new Decimal (1765.2312345678454);
+ Assert (d == 1765.23123456785m);
+ } catch (Exception e) {
+ Fail ("At TestNum = " + TestNum + " unexpected exception. e = " + e);
+ }
+ }
- dmax += 1.1m;
- dmax = Decimal.Parse (dmax.ToString ());
- AssertEquals ("Int64.MaxValue+1.1", Int64.MaxValue, Decimal.ToInt64 (dmax - 1.1m));
+ [Test]
+ public void TestNegate ()
+ {
+ decimal d;
- dmin -= 1.1m;
- dmin = Decimal.Parse (dmin.ToString ());
- AssertEquals ("Int64.MinValue-1.1", Int64.MinValue, Decimal.ToInt64 (dmin + 1.1m));
- }
+ d = new Decimal (12345678);
+ Assert ((decimal) Decimal.Negate (d) == -12345678m);
+ }
- [Test]
- public void ToByte ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToByte", 254, Decimal.ToByte (d));
- AssertEquals ("Convert.ToByte", 255, Convert.ToByte (d));
- AssertEquals ("IConvertible.ToByte", 255, (d as IConvertible).ToByte (null));
- }
+ [Test]
+ public void TestPartConstruct ()
+ {
+ decimal d;
- [Test]
- public void ToSByte ()
- {
- Decimal d = 126.9m;
- AssertEquals ("Decimal.ToSByte", 126, Decimal.ToSByte (d));
- AssertEquals ("Convert.ToSByte", 127, Convert.ToSByte (d));
- AssertEquals ("IConvertible.ToSByte", 127, (d as IConvertible).ToSByte (null));
- d = -d;
- AssertEquals ("-Decimal.ToSByte", -126, Decimal.ToSByte (d));
- AssertEquals ("-Convert.ToSByte", -127, Convert.ToSByte (d));
- AssertEquals ("-IConvertible.ToSByte", -127, (d as IConvertible).ToSByte (null));
- }
+ d = new Decimal (parts0);
+ Assert (d == 0);
- [Test]
- public void ToInt16 ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToInt16", 254, Decimal.ToInt16 (d));
- AssertEquals ("Convert.ToInt16", 255, Convert.ToInt16 (d));
- AssertEquals ("IConvertible.ToInt16", 255, (d as IConvertible).ToInt16 (null));
- d = -d;
- AssertEquals ("-Decimal.ToInt16", -254, Decimal.ToInt16 (d));
- AssertEquals ("-Convert.ToInt16", -255, Convert.ToInt16 (d));
- AssertEquals ("-IConvertible.ToInt16", -255, (d as IConvertible).ToInt16 (null));
- }
+ d = new Decimal (parts1);
+ Assert (d == 1);
- [Test]
- public void ToUInt16 ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToUInt16", 254, Decimal.ToUInt16 (d));
- AssertEquals ("Convert.ToUInt16", 255, Convert.ToUInt16 (d));
- AssertEquals ("IConvertible.ToUInt16", 255, (d as IConvertible).ToUInt16 (null));
- }
+ d = new Decimal (parts2);
+ Assert (d == 4294967296m);
- [Test]
- public void ToInt32 ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToInt32", 254, Decimal.ToInt32 (d));
- AssertEquals ("Convert.ToInt32", 255, Convert.ToInt32 (d));
- AssertEquals ("IConvertible.ToInt32", 255, (d as IConvertible).ToInt32 (null));
- d = -d;
- AssertEquals ("-Decimal.ToInt32", -254, Decimal.ToInt32 (d));
- AssertEquals ("-Convert.ToInt32", -255, Convert.ToInt32 (d));
- AssertEquals ("-IConvertible.ToInt32", -255, (d as IConvertible).ToInt32 (null));
- }
+ d = new Decimal (parts3);
+ Assert (d == 18446744073709551616m);
- [Test]
- public void ToUInt32 ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToUInt32", 254, Decimal.ToUInt32 (d));
- AssertEquals ("Convert.ToUInt32", 255, Convert.ToUInt32 (d));
- AssertEquals ("IConvertible.ToUInt32", 255, (d as IConvertible).ToUInt32 (null));
- }
+ d = new Decimal (parts4);
+ Assert (d == 0m);
- [Test]
- public void ToInt64 ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToInt64", 254, Decimal.ToInt64 (d));
- AssertEquals ("Convert.ToInt64", 255, Convert.ToInt64 (d));
- AssertEquals ("IConvertible.ToInt64", 255, (d as IConvertible).ToInt64 (null));
- d = -d;
- AssertEquals ("-Decimal.ToInt64", -254, Decimal.ToInt64 (d));
- AssertEquals ("-Convert.ToInt64", -255, Convert.ToInt64 (d));
- AssertEquals ("-IConvertible.ToInt64", -255, (d as IConvertible).ToInt64 (null));
- }
+ d = new Decimal (parts5);
+ Assert (d == 18446744078004518913m);
- [Test]
- [ExpectedException (typeof(OverflowException))]
- public void ToInt64_TooBig ()
- {
- Decimal d = (Decimal) Int64.MaxValue;
- d += 1.1m;
- long value = Decimal.ToInt64 (d);
- }
+ d = new Decimal (partsMaxValue);
+ Assert (d == Decimal.MaxValue);
- [Test]
- [ExpectedException (typeof(OverflowException))]
- public void ToInt64_TooSmall ()
- {
- Decimal d = (Decimal) Int64.MinValue;
- d -= 1.1m;
- long value = Decimal.ToInt64 (d);
- }
+ d = new Decimal (partsMinValue);
+ Assert (d == Decimal.MinValue);
- [Test]
- public void ToUInt64 ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToUInt64", 254, Decimal.ToUInt64 (d));
- AssertEquals ("Convert.ToUInt64", 255, Convert.ToUInt64 (d));
- AssertEquals ("IConvertible.ToUInt64", 255, (d as IConvertible).ToUInt64 (null));
- }
+ d = new Decimal (parts6);
+ int [] erg = Decimal.GetBits (d);
+ for (int i = 0; i < 4; i++) {
+ Assert (erg [i] == parts6 [i]);
+ }
+ }
- [Test]
- public void ToSingle ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToSingle", 254.9f, Decimal.ToSingle (d));
- AssertEquals ("Convert.ToSingle", 254.9f, Convert.ToSingle (d));
- AssertEquals ("IConvertible.ToSingle", 254.9f, (d as IConvertible).ToSingle (null));
- d = -d;
- AssertEquals ("-Decimal.ToSingle", -254.9f, Decimal.ToSingle (d));
- AssertEquals ("-Convert.ToSingle", -254.9f, Convert.ToSingle (d));
- AssertEquals ("-IConvertible.ToSingle", -254.9f, (d as IConvertible).ToSingle (null));
- }
+ [Test]
+ public void TestFloorTruncate ()
+ {
+ decimal [,] dtab = {
+ {0m, 0m, 0m}, {1m, 1m, 1m}, {-1m, -1m, -1m}, {1.1m, 1m, 1m},
+ {-1.000000000001m, -2m, -1m}, {12345.67890m,12345m,12345m},
+ {-123456789012345.67890m, -123456789012346m, -123456789012345m},
+ {Decimal.MaxValue, Decimal.MaxValue, Decimal.MaxValue},
+ {Decimal.MinValue, Decimal.MinValue, Decimal.MinValue},
+ {6.999999999m, 6m, 6m}, {-6.999999999m, -7m, -6m},
+ {0.00001m, 0m, 0m}, {-0.00001m, -1m, 0m}
+ };
+
+ decimal d;
+
+ for (int i = 0; i < dtab.GetLength (0); i++) {
+ d = Decimal.Floor (dtab [i, 0]);
+ if (d != dtab [i, 1]) {
+ Fail ("Floor: Floor(" + dtab [i, 0] + ") != " + d);
+ }
+ d = Decimal.Truncate (dtab [i, 0]);
+ if (d != dtab [i, 2]) {
+ Fail ("Truncate: Truncate(" + dtab [i, 0] + ") != " + d);
+ }
+ }
+ }
- [Test]
- public void ToDouble ()
- {
- Decimal d = 254.9m;
- AssertEquals ("Decimal.ToDouble", 254.9d, Decimal.ToDouble (d));
- AssertEquals ("Convert.ToDouble", 254.9d, Convert.ToDouble (d));
- AssertEquals ("IConvertible.ToDouble", 254.9d, (d as IConvertible).ToDouble (null));
- d = -d;
- AssertEquals ("-Decimal.ToDouble", -254.9d, Decimal.ToDouble (d));
- AssertEquals ("-Convert.ToDouble", -254.9d, Convert.ToDouble (d));
- AssertEquals ("-IConvertible.ToDouble", -254.9d, (d as IConvertible).ToDouble (null));
- }
+ [Test]
+ public void Truncate ()
+ {
+ decimal dd = 249.9m;
+ decimal dt = Decimal.Truncate (dd);
+ AssertEquals ("Original", 249.9m, dd);
+ AssertEquals ("Truncate", 249m, dt);
+ AssertEquals ("Cast-Byte", 249, (byte) dd);
+ AssertEquals ("Cast-Char", 249, (char) dd);
+ AssertEquals ("Cast-Int16", 249, (short) dd);
+ AssertEquals ("Cast-UInt16", 249, (ushort) dd);
+ AssertEquals ("Cast-Int32", 249, (int) dd);
+ AssertEquals ("Cast-UInt32", 249, (uint) dd);
+ AssertEquals ("Cast-Int64", 249, (long) dd);
+ AssertEquals ("Cast-UInt64", 249, (ulong) dd);
+ }
- [Test]
- public void ToString_Defaults ()
- {
- Decimal d = 254.9m;
- // everything defaults to "G"
- string def = d.ToString ("G");
- AssertEquals ("ToString()", def, d.ToString ());
- AssertEquals ("ToString((IFormatProvider)null)", def, d.ToString ((IFormatProvider)null));
- AssertEquals ("ToString((string)null)", def, d.ToString ((string)null));
- AssertEquals ("ToString(empty)", def, d.ToString (String.Empty));
- AssertEquals ("ToString(null,null)", def, d.ToString (null, null));
- AssertEquals ("ToString(empty,null)", def, d.ToString (String.Empty, null));
-
- AssertEquals ("ToString()", "254.9", def);
- }
+ [Test]
+ public void TestRound ()
+ {
+ decimal [,] dtab = {
+ {1m, 0, 1m}, {1.234567890m, 1, 1.2m},
+ {1.234567890m, 2, 1.23m}, {1.23450000001m, 3, 1.235m},
+ {1.2355m, 3, 1.236m},
+ {1.234567890m, 4, 1.2346m}, {1.23567890m, 2, 1.24m},
+ {47893764694.4578563236436621m, 7, 47893764694.4578563m},
+ {-47893764694.4578563236436621m, 9, -47893764694.457856324m},
+ {-47893764694.4578m, 5, -47893764694.4578m}
+ };
+
+ decimal d;
+
+ for (int i = 0; i < dtab.GetLength (0); i++) {
+ d = Decimal.Round (dtab [i, 0], (int) dtab [i, 1]);
+ if (d != dtab [i, 2]) {
+ Fail ("Round: Round(" + dtab [i, 0] + "," + (int) dtab [i, 1] + ") != " + d);
+ }
+ }
+ }
- [Test]
- public void CastTruncRounding ()
- {
- // casting truncs decimal value (not normal nor banker's rounding)
- AssertEquals ("254.9==254", 254, (long)(254.9m));
- AssertEquals ("-254.9=-254", -254, (long)(-254.9m));
- AssertEquals ("255.9==256", 255, (long)(255.9m));
- AssertEquals ("-255.9=-256", -255, (long)(-255.9m));
- }
+ [Test]
+ public void TestRoundFailures ()
+ {
+ decimal [,] dtab = {
+ {1.2345m, 3, 1.234m}
+ };
+
+ decimal d;
+
+ for (int i = 0; i < dtab.GetLength (0); i++) {
+ d = Decimal.Round (dtab [i, 0], (int) dtab [i, 1]);
+ if (d != dtab [i, 2]) {
+ Fail ("FailRound: Round(" + dtab [i, 0] + "," + (int) dtab [i, 1] + ") != " + d);
+ }
+ }
+ }
- [Test]
- public void ParseFractions ()
- {
- decimal d1 = Decimal.Parse ("0.523456789012345467890123456789", CultureInfo.InvariantCulture);
- AssertEquals ("f1", 0.5234567890123454678901234568m, d1);
- decimal d2 = Decimal.Parse ("0.49214206543486529434634231456", CultureInfo.InvariantCulture);
- AssertEquals ("f2", 0.4921420654348652943463423146m, d2);
- }
+ [Test]
+ public void ParseInt64 ()
+ {
+ long max = Int64.MaxValue;
+ Decimal dmax = Decimal.Parse (max.ToString ());
+ AssertEquals ("Int64.MaxValue", Int64.MaxValue, Decimal.ToInt64 (dmax));
- [Test]
- [ExpectedException (typeof (OverflowException))]
- public void Parse_Int64_Overflow ()
- {
- // Int64.MaxValue + 1 + small fraction to allow 30 digits
- // 123456789012345678901234567890
- decimal d = Decimal.Parse ("9223372036854775808.0000000009", CultureInfo.InvariantCulture);
- long l = (long) d;
- }
+ long min = Int64.MinValue;
+ Decimal dmin = Decimal.Parse (min.ToString ());
+ AssertEquals ("Int64.MinValue", Int64.MinValue, Decimal.ToInt64 (dmin));
+
+ dmax += 1.1m;
+ dmax = Decimal.Parse (dmax.ToString ());
+ AssertEquals ("Int64.MaxValue+1.1", Int64.MaxValue, Decimal.ToInt64 (dmax - 1.1m));
+
+ dmin -= 1.1m;
+ dmin = Decimal.Parse (dmin.ToString ());
+ AssertEquals ("Int64.MinValue-1.1", Int64.MinValue, Decimal.ToInt64 (dmin + 1.1m));
+ }
+
+ [Test]
+ public void ToByte ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToByte", 254, Decimal.ToByte (d));
+ AssertEquals ("Convert.ToByte", 255, Convert.ToByte (d));
+ AssertEquals ("IConvertible.ToByte", 255, (d as IConvertible).ToByte (null));
+ }
+
+ [Test]
+ public void ToSByte ()
+ {
+ Decimal d = 126.9m;
+ AssertEquals ("Decimal.ToSByte", 126, Decimal.ToSByte (d));
+ AssertEquals ("Convert.ToSByte", 127, Convert.ToSByte (d));
+ AssertEquals ("IConvertible.ToSByte", 127, (d as IConvertible).ToSByte (null));
+ d = -d;
+ AssertEquals ("-Decimal.ToSByte", -126, Decimal.ToSByte (d));
+ AssertEquals ("-Convert.ToSByte", -127, Convert.ToSByte (d));
+ AssertEquals ("-IConvertible.ToSByte", -127, (d as IConvertible).ToSByte (null));
+ }
+
+ [Test]
+ public void ToInt16 ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToInt16", 254, Decimal.ToInt16 (d));
+ AssertEquals ("Convert.ToInt16", 255, Convert.ToInt16 (d));
+ AssertEquals ("IConvertible.ToInt16", 255, (d as IConvertible).ToInt16 (null));
+ d = -d;
+ AssertEquals ("-Decimal.ToInt16", -254, Decimal.ToInt16 (d));
+ AssertEquals ("-Convert.ToInt16", -255, Convert.ToInt16 (d));
+ AssertEquals ("-IConvertible.ToInt16", -255, (d as IConvertible).ToInt16 (null));
+ }
+
+ [Test]
+ public void ToUInt16 ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToUInt16", 254, Decimal.ToUInt16 (d));
+ AssertEquals ("Convert.ToUInt16", 255, Convert.ToUInt16 (d));
+ AssertEquals ("IConvertible.ToUInt16", 255, (d as IConvertible).ToUInt16 (null));
+ }
+
+ [Test]
+ public void ToInt32 ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToInt32", 254, Decimal.ToInt32 (d));
+ AssertEquals ("Convert.ToInt32", 255, Convert.ToInt32 (d));
+ AssertEquals ("IConvertible.ToInt32", 255, (d as IConvertible).ToInt32 (null));
+ d = -d;
+ AssertEquals ("-Decimal.ToInt32", -254, Decimal.ToInt32 (d));
+ AssertEquals ("-Convert.ToInt32", -255, Convert.ToInt32 (d));
+ AssertEquals ("-IConvertible.ToInt32", -255, (d as IConvertible).ToInt32 (null));
+ }
+
+ [Test]
+ public void ToUInt32 ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToUInt32", 254, Decimal.ToUInt32 (d));
+ AssertEquals ("Convert.ToUInt32", 255, Convert.ToUInt32 (d));
+ AssertEquals ("IConvertible.ToUInt32", 255, (d as IConvertible).ToUInt32 (null));
+ }
+
+ [Test]
+ public void ToInt64 ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToInt64", 254, Decimal.ToInt64 (d));
+ AssertEquals ("Convert.ToInt64", 255, Convert.ToInt64 (d));
+ AssertEquals ("IConvertible.ToInt64", 255, (d as IConvertible).ToInt64 (null));
+ d = -d;
+ AssertEquals ("-Decimal.ToInt64", -254, Decimal.ToInt64 (d));
+ AssertEquals ("-Convert.ToInt64", -255, Convert.ToInt64 (d));
+ AssertEquals ("-IConvertible.ToInt64", -255, (d as IConvertible).ToInt64 (null));
+ }
+
+ [Test]
+ [ExpectedException (typeof (OverflowException))]
+ public void ToInt64_TooBig ()
+ {
+ Decimal d = (Decimal) Int64.MaxValue;
+ d += 1.1m;
+ long value = Decimal.ToInt64 (d);
+ }
+
+ [Test]
+ [ExpectedException (typeof (OverflowException))]
+ public void ToInt64_TooSmall ()
+ {
+ Decimal d = (Decimal) Int64.MinValue;
+ d -= 1.1m;
+ long value = Decimal.ToInt64 (d);
+ }
+
+ [Test]
+ public void ToUInt64 ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToUInt64", 254, Decimal.ToUInt64 (d));
+ AssertEquals ("Convert.ToUInt64", 255, Convert.ToUInt64 (d));
+ AssertEquals ("IConvertible.ToUInt64", 255, (d as IConvertible).ToUInt64 (null));
+ }
+
+ [Test]
+ public void ToSingle ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToSingle", 254.9f, Decimal.ToSingle (d));
+ AssertEquals ("Convert.ToSingle", 254.9f, Convert.ToSingle (d));
+ AssertEquals ("IConvertible.ToSingle", 254.9f, (d as IConvertible).ToSingle (null));
+ d = -d;
+ AssertEquals ("-Decimal.ToSingle", -254.9f, Decimal.ToSingle (d));
+ AssertEquals ("-Convert.ToSingle", -254.9f, Convert.ToSingle (d));
+ AssertEquals ("-IConvertible.ToSingle", -254.9f, (d as IConvertible).ToSingle (null));
+ }
+
+ [Test]
+ public void ToDouble ()
+ {
+ Decimal d = 254.9m;
+ AssertEquals ("Decimal.ToDouble", 254.9d, Decimal.ToDouble (d));
+ AssertEquals ("Convert.ToDouble", 254.9d, Convert.ToDouble (d));
+ AssertEquals ("IConvertible.ToDouble", 254.9d, (d as IConvertible).ToDouble (null));
+ d = -d;
+ AssertEquals ("-Decimal.ToDouble", -254.9d, Decimal.ToDouble (d));
+ AssertEquals ("-Convert.ToDouble", -254.9d, Convert.ToDouble (d));
+ AssertEquals ("-IConvertible.ToDouble", -254.9d, (d as IConvertible).ToDouble (null));
+ }
+
+ [Test]
+ public void ToString_Defaults ()
+ {
+ Decimal d = 254.9m;
+ // everything defaults to "G"
+ string def = d.ToString ("G");
+ AssertEquals ("ToString()", def, d.ToString ());
+ AssertEquals ("ToString((IFormatProvider)null)", def, d.ToString ((IFormatProvider) null));
+ AssertEquals ("ToString((string)null)", def, d.ToString ((string) null));
+ AssertEquals ("ToString(empty)", def, d.ToString (String.Empty));
+ AssertEquals ("ToString(null,null)", def, d.ToString (null, null));
+ AssertEquals ("ToString(empty,null)", def, d.ToString (String.Empty, null));
+
+ AssertEquals ("ToString()", "254.9", def);
+ }
+
+ [Test]
+ public void CastTruncRounding ()
+ {
+ // casting truncs decimal value (not normal nor banker's rounding)
+ AssertEquals ("254.9==254", 254, (long) (254.9m));
+ AssertEquals ("-254.9=-254", -254, (long) (-254.9m));
+ AssertEquals ("255.9==256", 255, (long) (255.9m));
+ AssertEquals ("-255.9=-256", -255, (long) (-255.9m));
+ }
+
+ [Test]
+ public void ParseFractions ()
+ {
+ decimal d1 = Decimal.Parse ("0.523456789012345467890123456789", CultureInfo.InvariantCulture);
+ AssertEquals ("f1", 0.5234567890123454678901234568m, d1);
+ decimal d2 = Decimal.Parse ("0.49214206543486529434634231456", CultureInfo.InvariantCulture);
+ AssertEquals ("f2", 0.4921420654348652943463423146m, d2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (OverflowException))]
+ public void Parse_Int64_Overflow ()
+ {
+ // Int64.MaxValue + 1 + small fraction to allow 30 digits
+ // 123456789012345678901234567890
+ decimal d = Decimal.Parse ("9223372036854775808.0000000009", CultureInfo.InvariantCulture);
+ long l = (long) d;
+ }
#if NET_2_0
- [Test]
- public void TryParse ()
- {
- Decimal r;
+ [Test]
+ public void TryParse ()
+ {
+ Decimal r;
- // These should return false
- AssertEquals (false, Decimal.TryParse ("79228162514264337593543950336", out r));
- AssertEquals (false, Decimal.TryParse ("123nx", NumberStyles.Number, CultureInfo.InvariantCulture, out r));
- AssertEquals (false, Decimal.TryParse (null, NumberStyles.Number, CultureInfo.InvariantCulture, out r));
-
- // These should pass
- for (int i = 0; i < tab.Length; i++){
- AssertEquals (!tab [i].exceptionFlag,
- Decimal.TryParse (tab [i].str, tab [i].style,
- NumberFormatInfo.InvariantInfo, out r));
+ // These should return false
+ AssertEquals (false, Decimal.TryParse ("79228162514264337593543950336", out r));
+ AssertEquals (false, Decimal.TryParse ("123nx", NumberStyles.Number, CultureInfo.InvariantCulture, out r));
+ AssertEquals (false, Decimal.TryParse (null, NumberStyles.Number, CultureInfo.InvariantCulture, out r));
+
+ // These should pass
+ for (int i = 0; i < tab.Length; i++) {
+ AssertEquals (!tab [i].exceptionFlag,
+ Decimal.TryParse (tab [i].str, tab [i].style,
+ NumberFormatInfo.InvariantInfo, out r));
+ }
}
- }
#endif
- [Test]
- [ExpectedException (typeof (DivideByZeroException))]
- public void Remainder_ByZero ()
- {
- Decimal.Remainder (254.9m, 0m);
- }
+ [Test]
+ [ExpectedException (typeof (DivideByZeroException))]
+ public void Remainder_ByZero ()
+ {
+ Decimal.Remainder (254.9m, 0m);
+ }
- [Test]
- public void Remainder ()
- {
- decimal p1 = 254.9m;
- decimal p2 = 12.1m;
- decimal n1 = -254.9m;
- decimal n2 = -12.1m;
-
- AssertEquals ("254.9 % 12.1", 0.8m, Decimal.Remainder (p1, p2));
- AssertEquals ("-254.9 % 12.1", -0.8m, Decimal.Remainder (n1, p2));
- AssertEquals ("254.9 % -12.1", 0.8m, Decimal.Remainder (p1, n2));
- AssertEquals ("-254.9 % -12.1", -0.8m, Decimal.Remainder (n1, n2));
-
- AssertEquals ("12.1 % 254.9", 12.1m, Decimal.Remainder (p2, p1));
- AssertEquals ("-12.1 % 254.9", -12.1m, Decimal.Remainder (n2, p1));
- AssertEquals ("12.1 % -254.9", 12.1m, Decimal.Remainder (p2, n1));
- AssertEquals ("-12.1 % -254.9", -12.1m, Decimal.Remainder (n2, n1));
+ [Test]
+ public void Remainder ()
+ {
+ decimal p1 = 254.9m;
+ decimal p2 = 12.1m;
+ decimal n1 = -254.9m;
+ decimal n2 = -12.1m;
+
+ AssertEquals ("254.9 % 12.1", 0.8m, Decimal.Remainder (p1, p2));
+ AssertEquals ("-254.9 % 12.1", -0.8m, Decimal.Remainder (n1, p2));
+ AssertEquals ("254.9 % -12.1", 0.8m, Decimal.Remainder (p1, n2));
+ AssertEquals ("-254.9 % -12.1", -0.8m, Decimal.Remainder (n1, n2));
+
+ AssertEquals ("12.1 % 254.9", 12.1m, Decimal.Remainder (p2, p1));
+ AssertEquals ("-12.1 % 254.9", -12.1m, Decimal.Remainder (n2, p1));
+ AssertEquals ("12.1 % -254.9", 12.1m, Decimal.Remainder (p2, n1));
+ AssertEquals ("-12.1 % -254.9", -12.1m, Decimal.Remainder (n2, n1));
#if NET_2_0
- AssertEquals ("12.1 % 12.1", 0.0m, Decimal.Remainder (p1, p1));
- AssertEquals ("-12.1 % 12.1", 0.0m, Decimal.Remainder (n1, p1));
- AssertEquals ("12.1 % -12.1", 0.0m, Decimal.Remainder (p1, n1));
- AssertEquals ("-12.1 % -12.1", 0.0m, Decimal.Remainder (n1, n1));
+ AssertEquals ("12.1 % 12.1", 0.0m, Decimal.Remainder (p1, p1));
+ AssertEquals ("-12.1 % 12.1", 0.0m, Decimal.Remainder (n1, p1));
+ AssertEquals ("12.1 % -12.1", 0.0m, Decimal.Remainder (p1, n1));
+ AssertEquals ("-12.1 % -12.1", 0.0m, Decimal.Remainder (n1, n1));
#else
- AssertEquals ("12.1 % 12.1", 0, Decimal.Remainder (p1, p1));
- AssertEquals ("-12.1 % 12.1", 0, Decimal.Remainder (n1, p1));
- AssertEquals ("12.1 % -12.1", 0, Decimal.Remainder (p1, n1));
- AssertEquals ("-12.1 % -12.1", 0, Decimal.Remainder (n1, n1));
+ AssertEquals ("12.1 % 12.1", 0, Decimal.Remainder (p1, p1));
+ AssertEquals ("-12.1 % 12.1", 0, Decimal.Remainder (n1, p1));
+ AssertEquals ("12.1 % -12.1", 0, Decimal.Remainder (p1, n1));
+ AssertEquals ("-12.1 % -12.1", 0, Decimal.Remainder (n1, n1));
#endif
- }
-
- [Test]
- [ExpectedException (typeof (DivideByZeroException))]
- public void Divide_ByZero ()
- {
- Decimal.Divide (254.9m, 0m);
- }
+ }
- [Test]
- public void Divide ()
- {
- decimal p1 = 254.9m;
- decimal p2 = 12.1m;
- decimal n1 = -254.9m;
- decimal n2 = -12.1m;
-
- decimal c1 = 21.066115702479338842975206612m;
- decimal c2 = 0.0474695959199686151431934092m;
-
- AssertEquals ("254.9 / 12.1", c1, Decimal.Divide (p1, p2));
- AssertEquals ("-254.9 / 12.1", -c1, Decimal.Divide (n1, p2));
- AssertEquals ("254.9 / -12.1", -c1, Decimal.Divide (p1, n2));
- AssertEquals ("-254.9 / -12.1", c1, Decimal.Divide (n1, n2));
-
- AssertEquals ("12.1 / 254.9", c2, Decimal.Divide (p2, p1));
- AssertEquals ("-12.1 / 254.9", -c2, Decimal.Divide (n2, p1));
- AssertEquals ("12.1 / -254.9", -c2, Decimal.Divide (p2, n1));
- AssertEquals ("-12.1 / -254.9", c2, Decimal.Divide (n2, n1));
-
- AssertEquals ("12.1 / 12.1", 1, Decimal.Divide (p1, p1));
- AssertEquals ("-12.1 / 12.1", -1, Decimal.Divide (n1, p1));
- AssertEquals ("12.1 / -12.1", -1, Decimal.Divide (p1, n1));
- AssertEquals ("-12.1 / -12.1", 1, Decimal.Divide (n1, n1));
- }
+ [Test]
+ [ExpectedException (typeof (DivideByZeroException))]
+ public void Divide_ByZero ()
+ {
+ Decimal.Divide (254.9m, 0m);
+ }
- [Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
- public void Round_InvalidDecimals_Negative ()
- {
- Decimal.Round (254.9m, -1);
- }
+ [Test]
+ public void Divide ()
+ {
+ decimal p1 = 254.9m;
+ decimal p2 = 12.1m;
+ decimal n1 = -254.9m;
+ decimal n2 = -12.1m;
+
+ decimal c1 = 21.066115702479338842975206612m;
+ decimal c2 = 0.0474695959199686151431934092m;
+
+ AssertEquals ("254.9 / 12.1", c1, Decimal.Divide (p1, p2));
+ AssertEquals ("-254.9 / 12.1", -c1, Decimal.Divide (n1, p2));
+ AssertEquals ("254.9 / -12.1", -c1, Decimal.Divide (p1, n2));
+ AssertEquals ("-254.9 / -12.1", c1, Decimal.Divide (n1, n2));
+
+ AssertEquals ("12.1 / 254.9", c2, Decimal.Divide (p2, p1));
+ AssertEquals ("-12.1 / 254.9", -c2, Decimal.Divide (n2, p1));
+ AssertEquals ("12.1 / -254.9", -c2, Decimal.Divide (p2, n1));
+ AssertEquals ("-12.1 / -254.9", c2, Decimal.Divide (n2, n1));
+
+ AssertEquals ("12.1 / 12.1", 1, Decimal.Divide (p1, p1));
+ AssertEquals ("-12.1 / 12.1", -1, Decimal.Divide (n1, p1));
+ AssertEquals ("12.1 / -12.1", -1, Decimal.Divide (p1, n1));
+ AssertEquals ("-12.1 / -12.1", 1, Decimal.Divide (n1, n1));
+ }
- [Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
- public void Round_InvalidDecimals_TooHigh ()
- {
- Decimal.Round (254.9m, 29);
- }
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void Round_InvalidDecimals_Negative ()
+ {
+ Decimal.Round (254.9m, -1);
+ }
- [Test]
- public void Round_OddValue ()
- {
- decimal five = 5.5555555555555555555555555555m;
- AssertEquals ("5,5_,00", 6, Decimal.Round (five, 0));
- AssertEquals ("5,5_,01", 5.6m, Decimal.Round (five, 1));
- AssertEquals ("5,5_,02", 5.56m, Decimal.Round (five, 2));
- AssertEquals ("5,5_,03", 5.556m, Decimal.Round (five, 3));
- AssertEquals ("5,5_,04", 5.5556m, Decimal.Round (five, 4));
- AssertEquals ("5,5_,05", 5.55556m, Decimal.Round (five, 5));
- AssertEquals ("5,5_,06", 5.555556m, Decimal.Round (five, 6));
- AssertEquals ("5,5_,07", 5.5555556m, Decimal.Round (five, 7));
- AssertEquals ("5,5_,08", 5.55555556m, Decimal.Round (five, 8));
- AssertEquals ("5,5_,09", 5.555555556m, Decimal.Round (five, 9));
- AssertEquals ("5,5_,10", 5.5555555556m, Decimal.Round (five, 10));
- AssertEquals ("5,5_,11", 5.55555555556m, Decimal.Round (five, 11));
- AssertEquals ("5,5_,12", 5.555555555556m, Decimal.Round (five, 12));
- AssertEquals ("5,5_,13", 5.5555555555556m, Decimal.Round (five, 13));
- AssertEquals ("5,5_,14", 5.55555555555556m, Decimal.Round (five, 14));
- AssertEquals ("5,5_,15", 5.555555555555556m, Decimal.Round (five, 15));
- AssertEquals ("5,5_,16", 5.5555555555555556m, Decimal.Round (five, 16));
- AssertEquals ("5,5_,17", 5.55555555555555556m, Decimal.Round (five, 17));
- AssertEquals ("5,5_,18", 5.555555555555555556m, Decimal.Round (five, 18));
- AssertEquals ("5,5_,19", 5.5555555555555555556m, Decimal.Round (five, 19));
- AssertEquals ("5,5_,20", 5.55555555555555555556m, Decimal.Round (five, 20));
- AssertEquals ("5,5_,21", 5.555555555555555555556m, Decimal.Round (five, 21));
- AssertEquals ("5,5_,22", 5.5555555555555555555556m, Decimal.Round (five, 22));
- AssertEquals ("5,5_,23", 5.55555555555555555555556m, Decimal.Round (five, 23));
- AssertEquals ("5,5_,24", 5.555555555555555555555556m, Decimal.Round (five, 24));
- AssertEquals ("5,5_,25", 5.5555555555555555555555556m, Decimal.Round (five, 25));
- AssertEquals ("5,5_,26", 5.55555555555555555555555556m, Decimal.Round (five, 26));
- AssertEquals ("5,5_,27", 5.555555555555555555555555556m, Decimal.Round (five, 27));
- AssertEquals ("5.5_,28", 5.5555555555555555555555555555m, Decimal.Round (five, 28));
- }
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void Round_InvalidDecimals_TooHigh ()
+ {
+ Decimal.Round (254.9m, 29);
+ }
- [Test]
- public void Round_EvenValue ()
- {
- AssertEquals ("2,2_5,00", 2, Decimal.Round (2.5m, 0));
- AssertEquals ("2,2_5,01", 2.2m, Decimal.Round (2.25m, 1));
- AssertEquals ("2,2_5,02", 2.22m, Decimal.Round (2.225m, 2));
- AssertEquals ("2,2_5,03", 2.222m, Decimal.Round (2.2225m, 3));
- AssertEquals ("2,2_5,04", 2.2222m, Decimal.Round (2.22225m, 4));
- AssertEquals ("2,2_5,05", 2.22222m, Decimal.Round (2.222225m, 5));
- AssertEquals ("2,2_5,06", 2.222222m, Decimal.Round (2.2222225m, 6));
- AssertEquals ("2,2_5,07", 2.2222222m, Decimal.Round (2.22222225m, 7));
- AssertEquals ("2,2_5,08", 2.22222222m, Decimal.Round (2.222222225m, 8));
- AssertEquals ("2,2_5,09", 2.222222222m, Decimal.Round (2.2222222225m, 9));
- AssertEquals ("2,2_5,10", 2.2222222222m, Decimal.Round (2.22222222225m, 10));
- AssertEquals ("2,2_5,11", 2.22222222222m, Decimal.Round (2.222222222225m, 11));
- AssertEquals ("2,2_5,12", 2.222222222222m, Decimal.Round (2.2222222222225m, 12));
- AssertEquals ("2,2_5,13", 2.2222222222222m, Decimal.Round (2.22222222222225m, 13));
- AssertEquals ("2,2_5,14", 2.22222222222222m, Decimal.Round (2.222222222222225m, 14));
- AssertEquals ("2,2_5,15", 2.222222222222222m, Decimal.Round (2.2222222222222225m, 15));
- AssertEquals ("2,2_5,16", 2.2222222222222222m, Decimal.Round (2.22222222222222225m, 16));
- AssertEquals ("2,2_5,17", 2.22222222222222222m, Decimal.Round (2.222222222222222225m, 17));
- AssertEquals ("2,2_5,18", 2.222222222222222222m, Decimal.Round (2.2222222222222222225m, 18));
- AssertEquals ("2,2_5,19", 2.2222222222222222222m, Decimal.Round (2.22222222222222222225m, 19));
- AssertEquals ("2,2_5,20", 2.22222222222222222222m, Decimal.Round (2.222222222222222222225m, 20));
- AssertEquals ("2,2_5,21", 2.222222222222222222222m, Decimal.Round (2.2222222222222222222225m, 21));
- AssertEquals ("2,2_5,22", 2.2222222222222222222222m, Decimal.Round (2.22222222222222222222225m, 22));
- AssertEquals ("2,2_5,23", 2.22222222222222222222222m, Decimal.Round (2.222222222222222222222225m, 23));
- AssertEquals ("2,2_5,24", 2.222222222222222222222222m, Decimal.Round (2.2222222222222222222222225m, 24));
- AssertEquals ("2,2_5,25", 2.2222222222222222222222222m, Decimal.Round (2.22222222222222222222222225m, 25));
- AssertEquals ("2,2_5,26", 2.22222222222222222222222222m, Decimal.Round (2.222222222222222222222222225m, 26));
- AssertEquals ("2,2_5,27", 2.222222222222222222222222222m, Decimal.Round (2.2222222222222222222222222225m, 27));
- AssertEquals ("2,2_5,28", 2.2222222222222222222222222222m, Decimal.Round (2.22222222222222222222222222225m, 28));
- }
+ [Test]
+ public void Round_OddValue ()
+ {
+ decimal five = 5.5555555555555555555555555555m;
+ AssertEquals ("5,5_,00", 6, Decimal.Round (five, 0));
+ AssertEquals ("5,5_,01", 5.6m, Decimal.Round (five, 1));
+ AssertEquals ("5,5_,02", 5.56m, Decimal.Round (five, 2));
+ AssertEquals ("5,5_,03", 5.556m, Decimal.Round (five, 3));
+ AssertEquals ("5,5_,04", 5.5556m, Decimal.Round (five, 4));
+ AssertEquals ("5,5_,05", 5.55556m, Decimal.Round (five, 5));
+ AssertEquals ("5,5_,06", 5.555556m, Decimal.Round (five, 6));
+ AssertEquals ("5,5_,07", 5.5555556m, Decimal.Round (five, 7));
+ AssertEquals ("5,5_,08", 5.55555556m, Decimal.Round (five, 8));
+ AssertEquals ("5,5_,09", 5.555555556m, Decimal.Round (five, 9));
+ AssertEquals ("5,5_,10", 5.5555555556m, Decimal.Round (five, 10));
+ AssertEquals ("5,5_,11", 5.55555555556m, Decimal.Round (five, 11));
+ AssertEquals ("5,5_,12", 5.555555555556m, Decimal.Round (five, 12));
+ AssertEquals ("5,5_,13", 5.5555555555556m, Decimal.Round (five, 13));
+ AssertEquals ("5,5_,14", 5.55555555555556m, Decimal.Round (five, 14));
+ AssertEquals ("5,5_,15", 5.555555555555556m, Decimal.Round (five, 15));
+ AssertEquals ("5,5_,16", 5.5555555555555556m, Decimal.Round (five, 16));
+ AssertEquals ("5,5_,17", 5.55555555555555556m, Decimal.Round (five, 17));
+ AssertEquals ("5,5_,18", 5.555555555555555556m, Decimal.Round (five, 18));
+ AssertEquals ("5,5_,19", 5.5555555555555555556m, Decimal.Round (five, 19));
+ AssertEquals ("5,5_,20", 5.55555555555555555556m, Decimal.Round (five, 20));
+ AssertEquals ("5,5_,21", 5.555555555555555555556m, Decimal.Round (five, 21));
+ AssertEquals ("5,5_,22", 5.5555555555555555555556m, Decimal.Round (five, 22));
+ AssertEquals ("5,5_,23", 5.55555555555555555555556m, Decimal.Round (five, 23));
+ AssertEquals ("5,5_,24", 5.555555555555555555555556m, Decimal.Round (five, 24));
+ AssertEquals ("5,5_,25", 5.5555555555555555555555556m, Decimal.Round (five, 25));
+ AssertEquals ("5,5_,26", 5.55555555555555555555555556m, Decimal.Round (five, 26));
+ AssertEquals ("5,5_,27", 5.555555555555555555555555556m, Decimal.Round (five, 27));
+ AssertEquals ("5.5_,28", 5.5555555555555555555555555555m, Decimal.Round (five, 28));
+ }
- [Test]
- public void Round_OddValue_Negative ()
- {
- decimal five = -5.5555555555555555555555555555m;
- AssertEquals ("-5,5_,00", -6, Decimal.Round (five, 0));
- AssertEquals ("-5,5_,01", -5.6m, Decimal.Round (five, 1));
- AssertEquals ("-5,5_,02", -5.56m, Decimal.Round (five, 2));
- AssertEquals ("-5,5_,03", -5.556m, Decimal.Round (five, 3));
- AssertEquals ("-5,5_,04", -5.5556m, Decimal.Round (five, 4));
- AssertEquals ("-5,5_,05", -5.55556m, Decimal.Round (five, 5));
- AssertEquals ("-5,5_,06", -5.555556m, Decimal.Round (five, 6));
- AssertEquals ("-5,5_,07", -5.5555556m, Decimal.Round (five, 7));
- AssertEquals ("-5,5_,08", -5.55555556m, Decimal.Round (five, 8));
- AssertEquals ("-5,5_,09", -5.555555556m, Decimal.Round (five, 9));
- AssertEquals ("-5,5_,10", -5.5555555556m, Decimal.Round (five, 10));
- AssertEquals ("-5,5_,11", -5.55555555556m, Decimal.Round (five, 11));
- AssertEquals ("-5,5_,12", -5.555555555556m, Decimal.Round (five, 12));
- AssertEquals ("-5,5_,13", -5.5555555555556m, Decimal.Round (five, 13));
- AssertEquals ("-5,5_,14", -5.55555555555556m, Decimal.Round (five, 14));
- AssertEquals ("-5,5_,15", -5.555555555555556m, Decimal.Round (five, 15));
- AssertEquals ("-5,5_,16", -5.5555555555555556m, Decimal.Round (five, 16));
- AssertEquals ("-5,5_,17", -5.55555555555555556m, Decimal.Round (five, 17));
- AssertEquals ("-5,5_,18", -5.555555555555555556m, Decimal.Round (five, 18));
- AssertEquals ("-5,5_,19", -5.5555555555555555556m, Decimal.Round (five, 19));
- AssertEquals ("-5,5_,20", -5.55555555555555555556m, Decimal.Round (five, 20));
- AssertEquals ("-5,5_,21", -5.555555555555555555556m, Decimal.Round (five, 21));
- AssertEquals ("-5,5_,22", -5.5555555555555555555556m, Decimal.Round (five, 22));
- AssertEquals ("-5,5_,23", -5.55555555555555555555556m, Decimal.Round (five, 23));
- AssertEquals ("-5,5_,24", -5.555555555555555555555556m, Decimal.Round (five, 24));
- AssertEquals ("-5,5_,25", -5.5555555555555555555555556m, Decimal.Round (five, 25));
- AssertEquals ("-5,5_,26", -5.55555555555555555555555556m, Decimal.Round (five, 26));
- AssertEquals ("-5,5_,27", -5.555555555555555555555555556m, Decimal.Round (five, 27));
- AssertEquals ("-5.5_,28", -5.5555555555555555555555555555m, Decimal.Round (five, 28));
- }
+ [Test]
+ public void Round_EvenValue ()
+ {
+ AssertEquals ("2,2_5,00", 2, Decimal.Round (2.5m, 0));
+ AssertEquals ("2,2_5,01", 2.2m, Decimal.Round (2.25m, 1));
+ AssertEquals ("2,2_5,02", 2.22m, Decimal.Round (2.225m, 2));
+ AssertEquals ("2,2_5,03", 2.222m, Decimal.Round (2.2225m, 3));
+ AssertEquals ("2,2_5,04", 2.2222m, Decimal.Round (2.22225m, 4));
+ AssertEquals ("2,2_5,05", 2.22222m, Decimal.Round (2.222225m, 5));
+ AssertEquals ("2,2_5,06", 2.222222m, Decimal.Round (2.2222225m, 6));
+ AssertEquals ("2,2_5,07", 2.2222222m, Decimal.Round (2.22222225m, 7));
+ AssertEquals ("2,2_5,08", 2.22222222m, Decimal.Round (2.222222225m, 8));
+ AssertEquals ("2,2_5,09", 2.222222222m, Decimal.Round (2.2222222225m, 9));
+ AssertEquals ("2,2_5,10", 2.2222222222m, Decimal.Round (2.22222222225m, 10));
+ AssertEquals ("2,2_5,11", 2.22222222222m, Decimal.Round (2.222222222225m, 11));
+ AssertEquals ("2,2_5,12", 2.222222222222m, Decimal.Round (2.2222222222225m, 12));
+ AssertEquals ("2,2_5,13", 2.2222222222222m, Decimal.Round (2.22222222222225m, 13));
+ AssertEquals ("2,2_5,14", 2.22222222222222m, Decimal.Round (2.222222222222225m, 14));
+ AssertEquals ("2,2_5,15", 2.222222222222222m, Decimal.Round (2.2222222222222225m, 15));
+ AssertEquals ("2,2_5,16", 2.2222222222222222m, Decimal.Round (2.22222222222222225m, 16));
+ AssertEquals ("2,2_5,17", 2.22222222222222222m, Decimal.Round (2.222222222222222225m, 17));
+ AssertEquals ("2,2_5,18", 2.222222222222222222m, Decimal.Round (2.2222222222222222225m, 18));
+ AssertEquals ("2,2_5,19", 2.2222222222222222222m, Decimal.Round (2.22222222222222222225m, 19));
+ AssertEquals ("2,2_5,20", 2.22222222222222222222m, Decimal.Round (2.222222222222222222225m, 20));
+ AssertEquals ("2,2_5,21", 2.222222222222222222222m, Decimal.Round (2.2222222222222222222225m, 21));
+ AssertEquals ("2,2_5,22", 2.2222222222222222222222m, Decimal.Round (2.22222222222222222222225m, 22));
+ AssertEquals ("2,2_5,23", 2.22222222222222222222222m, Decimal.Round (2.222222222222222222222225m, 23));
+ AssertEquals ("2,2_5,24", 2.222222222222222222222222m, Decimal.Round (2.2222222222222222222222225m, 24));
+ AssertEquals ("2,2_5,25", 2.2222222222222222222222222m, Decimal.Round (2.22222222222222222222222225m, 25));
+ AssertEquals ("2,2_5,26", 2.22222222222222222222222222m, Decimal.Round (2.222222222222222222222222225m, 26));
+ AssertEquals ("2,2_5,27", 2.222222222222222222222222222m, Decimal.Round (2.2222222222222222222222222225m, 27));
+ AssertEquals ("2,2_5,28", 2.2222222222222222222222222222m, Decimal.Round (2.22222222222222222222222222225m, 28));
+ }
- [Test]
- public void Round_EvenValue_Negative ()
- {
- AssertEquals ("-2,2_5,00", -2, Decimal.Round (-2.5m, 0));
- AssertEquals ("-2,2_5,01", -2.2m, Decimal.Round (-2.25m, 1));
- AssertEquals ("-2,2_5,02", -2.22m, Decimal.Round (-2.225m, 2));
- AssertEquals ("-2,2_5,03", -2.222m, Decimal.Round (-2.2225m, 3));
- AssertEquals ("-2,2_5,04", -2.2222m, Decimal.Round (-2.22225m, 4));
- AssertEquals ("-2,2_5,05", -2.22222m, Decimal.Round (-2.222225m, 5));
- AssertEquals ("-2,2_5,06", -2.222222m, Decimal.Round (-2.2222225m, 6));
- AssertEquals ("-2,2_5,07", -2.2222222m, Decimal.Round (-2.22222225m, 7));
- AssertEquals ("-2,2_5,08", -2.22222222m, Decimal.Round (-2.222222225m, 8));
- AssertEquals ("-2,2_5,09", -2.222222222m, Decimal.Round (-2.2222222225m, 9));
- AssertEquals ("-2,2_5,10", -2.2222222222m, Decimal.Round (-2.22222222225m, 10));
- AssertEquals ("-2,2_5,11", -2.22222222222m, Decimal.Round (-2.222222222225m, 11));
- AssertEquals ("-2,2_5,12", -2.222222222222m, Decimal.Round (-2.2222222222225m, 12));
- AssertEquals ("-2,2_5,13", -2.2222222222222m, Decimal.Round (-2.22222222222225m, 13));
- AssertEquals ("-2,2_5,14", -2.22222222222222m, Decimal.Round (-2.222222222222225m, 14));
- AssertEquals ("-2,2_5,15", -2.222222222222222m, Decimal.Round (-2.2222222222222225m, 15));
- AssertEquals ("-2,2_5,16", -2.2222222222222222m, Decimal.Round (-2.22222222222222225m, 16));
- AssertEquals ("-2,2_5,17", -2.22222222222222222m, Decimal.Round (-2.222222222222222225m, 17));
- AssertEquals ("-2,2_5,18", -2.222222222222222222m, Decimal.Round (-2.2222222222222222225m, 18));
- AssertEquals ("-2,2_5,19", -2.2222222222222222222m, Decimal.Round (-2.22222222222222222225m, 19));
- AssertEquals ("-2,2_5,20", -2.22222222222222222222m, Decimal.Round (-2.222222222222222222225m, 20));
- AssertEquals ("-2,2_5,21", -2.222222222222222222222m, Decimal.Round (-2.2222222222222222222225m, 21));
- AssertEquals ("-2,2_5,22", -2.2222222222222222222222m, Decimal.Round (-2.22222222222222222222225m, 22));
- AssertEquals ("-2,2_5,23", -2.22222222222222222222222m, Decimal.Round (-2.222222222222222222222225m, 23));
- AssertEquals ("-2,2_5,24", -2.222222222222222222222222m, Decimal.Round (-2.2222222222222222222222225m, 24));
- AssertEquals ("-2,2_5,25", -2.2222222222222222222222222m, Decimal.Round (-2.22222222222222222222222225m, 25));
- AssertEquals ("-2,2_5,26", -2.22222222222222222222222222m, Decimal.Round (-2.222222222222222222222222225m, 26));
- AssertEquals ("-2,2_5,27", -2.222222222222222222222222222m, Decimal.Round (-2.2222222222222222222222222225m, 27));
- AssertEquals ("-2,2_5,28", -2.2222222222222222222222222222m, Decimal.Round (-2.22222222222222222222222222225m, 28));
- }
+ [Test]
+ public void Round_OddValue_Negative ()
+ {
+ decimal five = -5.5555555555555555555555555555m;
+ AssertEquals ("-5,5_,00", -6, Decimal.Round (five, 0));
+ AssertEquals ("-5,5_,01", -5.6m, Decimal.Round (five, 1));
+ AssertEquals ("-5,5_,02", -5.56m, Decimal.Round (five, 2));
+ AssertEquals ("-5,5_,03", -5.556m, Decimal.Round (five, 3));
+ AssertEquals ("-5,5_,04", -5.5556m, Decimal.Round (five, 4));
+ AssertEquals ("-5,5_,05", -5.55556m, Decimal.Round (five, 5));
+ AssertEquals ("-5,5_,06", -5.555556m, Decimal.Round (five, 6));
+ AssertEquals ("-5,5_,07", -5.5555556m, Decimal.Round (five, 7));
+ AssertEquals ("-5,5_,08", -5.55555556m, Decimal.Round (five, 8));
+ AssertEquals ("-5,5_,09", -5.555555556m, Decimal.Round (five, 9));
+ AssertEquals ("-5,5_,10", -5.5555555556m, Decimal.Round (five, 10));
+ AssertEquals ("-5,5_,11", -5.55555555556m, Decimal.Round (five, 11));
+ AssertEquals ("-5,5_,12", -5.555555555556m, Decimal.Round (five, 12));
+ AssertEquals ("-5,5_,13", -5.5555555555556m, Decimal.Round (five, 13));
+ AssertEquals ("-5,5_,14", -5.55555555555556m, Decimal.Round (five, 14));
+ AssertEquals ("-5,5_,15", -5.555555555555556m, Decimal.Round (five, 15));
+ AssertEquals ("-5,5_,16", -5.5555555555555556m, Decimal.Round (five, 16));
+ AssertEquals ("-5,5_,17", -5.55555555555555556m, Decimal.Round (five, 17));
+ AssertEquals ("-5,5_,18", -5.555555555555555556m, Decimal.Round (five, 18));
+ AssertEquals ("-5,5_,19", -5.5555555555555555556m, Decimal.Round (five, 19));
+ AssertEquals ("-5,5_,20", -5.55555555555555555556m, Decimal.Round (five, 20));
+ AssertEquals ("-5,5_,21", -5.555555555555555555556m, Decimal.Round (five, 21));
+ AssertEquals ("-5,5_,22", -5.5555555555555555555556m, Decimal.Round (five, 22));
+ AssertEquals ("-5,5_,23", -5.55555555555555555555556m, Decimal.Round (five, 23));
+ AssertEquals ("-5,5_,24", -5.555555555555555555555556m, Decimal.Round (five, 24));
+ AssertEquals ("-5,5_,25", -5.5555555555555555555555556m, Decimal.Round (five, 25));
+ AssertEquals ("-5,5_,26", -5.55555555555555555555555556m, Decimal.Round (five, 26));
+ AssertEquals ("-5,5_,27", -5.555555555555555555555555556m, Decimal.Round (five, 27));
+ AssertEquals ("-5.5_,28", -5.5555555555555555555555555555m, Decimal.Round (five, 28));
+ }
- [Test]
- // http://bugzilla.ximian.com/show_bug.cgi?id=59425
- public void ParseAndKeepPrecision ()
- {
- string value = "5";
- AssertEquals (value, value, Decimal.Parse (value).ToString ());
- value += '.';
- for (int i=0; i < 28; i++) {
- value += "0";
- AssertEquals (i.ToString(), value, Decimal.Parse (value).ToString ());
+ [Test]
+ public void Round_EvenValue_Negative ()
+ {
+ AssertEquals ("-2,2_5,00", -2, Decimal.Round (-2.5m, 0));
+ AssertEquals ("-2,2_5,01", -2.2m, Decimal.Round (-2.25m, 1));
+ AssertEquals ("-2,2_5,02", -2.22m, Decimal.Round (-2.225m, 2));
+ AssertEquals ("-2,2_5,03", -2.222m, Decimal.Round (-2.2225m, 3));
+ AssertEquals ("-2,2_5,04", -2.2222m, Decimal.Round (-2.22225m, 4));
+ AssertEquals ("-2,2_5,05", -2.22222m, Decimal.Round (-2.222225m, 5));
+ AssertEquals ("-2,2_5,06", -2.222222m, Decimal.Round (-2.2222225m, 6));
+ AssertEquals ("-2,2_5,07", -2.2222222m, Decimal.Round (-2.22222225m, 7));
+ AssertEquals ("-2,2_5,08", -2.22222222m, Decimal.Round (-2.222222225m, 8));
+ AssertEquals ("-2,2_5,09", -2.222222222m, Decimal.Round (-2.2222222225m, 9));
+ AssertEquals ("-2,2_5,10", -2.2222222222m, Decimal.Round (-2.22222222225m, 10));
+ AssertEquals ("-2,2_5,11", -2.22222222222m, Decimal.Round (-2.222222222225m, 11));
+ AssertEquals ("-2,2_5,12", -2.222222222222m, Decimal.Round (-2.2222222222225m, 12));
+ AssertEquals ("-2,2_5,13", -2.2222222222222m, Decimal.Round (-2.22222222222225m, 13));
+ AssertEquals ("-2,2_5,14", -2.22222222222222m, Decimal.Round (-2.222222222222225m, 14));
+ AssertEquals ("-2,2_5,15", -2.222222222222222m, Decimal.Round (-2.2222222222222225m, 15));
+ AssertEquals ("-2,2_5,16", -2.2222222222222222m, Decimal.Round (-2.22222222222222225m, 16));
+ AssertEquals ("-2,2_5,17", -2.22222222222222222m, Decimal.Round (-2.222222222222222225m, 17));
+ AssertEquals ("-2,2_5,18", -2.222222222222222222m, Decimal.Round (-2.2222222222222222225m, 18));
+ AssertEquals ("-2,2_5,19", -2.2222222222222222222m, Decimal.Round (-2.22222222222222222225m, 19));
+ AssertEquals ("-2,2_5,20", -2.22222222222222222222m, Decimal.Round (-2.222222222222222222225m, 20));
+ AssertEquals ("-2,2_5,21", -2.222222222222222222222m, Decimal.Round (-2.2222222222222222222225m, 21));
+ AssertEquals ("-2,2_5,22", -2.2222222222222222222222m, Decimal.Round (-2.22222222222222222222225m, 22));
+ AssertEquals ("-2,2_5,23", -2.22222222222222222222222m, Decimal.Round (-2.222222222222222222222225m, 23));
+ AssertEquals ("-2,2_5,24", -2.222222222222222222222222m, Decimal.Round (-2.2222222222222222222222225m, 24));
+ AssertEquals ("-2,2_5,25", -2.2222222222222222222222222m, Decimal.Round (-2.22222222222222222222222225m, 25));
+ AssertEquals ("-2,2_5,26", -2.22222222222222222222222222m, Decimal.Round (-2.222222222222222222222222225m, 26));
+ AssertEquals ("-2,2_5,27", -2.222222222222222222222222222m, Decimal.Round (-2.2222222222222222222222222225m, 27));
+ AssertEquals ("-2,2_5,28", -2.2222222222222222222222222222m, Decimal.Round (-2.22222222222222222222222222225m, 28));
}
- value = "-5";
- AssertEquals (value, value, Decimal.Parse (value).ToString ());
- value += '.';
- for (int i=0; i < 28; i++) {
- value += "0";
- AssertEquals ("-" + i.ToString(), value, Decimal.Parse (value).ToString ());
+ [Test] // bug #59425
+ public void ParseAndKeepPrecision ()
+ {
+ string value = "5";
+ AssertEquals (value, value, Decimal.Parse (value).ToString ());
+ value += '.';
+ for (int i = 0; i < 28; i++) {
+ value += "0";
+ AssertEquals (i.ToString (), value, Decimal.Parse (value).ToString ());
+ }
+
+ value = "-5";
+ AssertEquals (value, value, Decimal.Parse (value).ToString ());
+ value += '.';
+ for (int i = 0; i < 28; i++) {
+ value += "0";
+ AssertEquals ("-" + i.ToString (), value, Decimal.Parse (value).ToString ());
+ }
}
- }
- [Test]
- public void ToString_G ()
- {
- AssertEquals ("00", "1.0", (1.0m).ToString ());
- AssertEquals ("01", "0.1", (0.1m).ToString ());
- AssertEquals ("02", "0.01", (0.01m).ToString ());
- AssertEquals ("03", "0.001", (0.001m).ToString ());
- AssertEquals ("04", "0.0001", (0.0001m).ToString ());
- AssertEquals ("05", "0.00001", (0.00001m).ToString ());
- AssertEquals ("06", "0.000001", (0.000001m).ToString ());
- AssertEquals ("07", "0.0000001", (0.0000001m).ToString ());
- AssertEquals ("08", "0.00000001", (0.00000001m).ToString ());
- AssertEquals ("09", "0.000000001", (0.000000001m).ToString ());
- AssertEquals ("10", "0.0000000001", (0.0000000001m).ToString ());
- AssertEquals ("11", "0.00000000001", (0.00000000001m).ToString ());
- AssertEquals ("12", "0.000000000001", (0.000000000001m).ToString ());
- AssertEquals ("13", "0.0000000000001", (0.0000000000001m).ToString ());
- AssertEquals ("14", "0.00000000000001", (0.00000000000001m).ToString ());
- AssertEquals ("15", "0.000000000000001", (0.000000000000001m).ToString ());
- AssertEquals ("16", "0.0000000000000001", (0.0000000000000001m).ToString ());
- AssertEquals ("17", "0.00000000000000001", (0.00000000000000001m).ToString ());
- AssertEquals ("18", "0.000000000000000001", (0.000000000000000001m).ToString ());
- AssertEquals ("19", "0.0000000000000000001", (0.0000000000000000001m).ToString ());
- AssertEquals ("20", "0.00000000000000000001", (0.00000000000000000001m).ToString ());
- AssertEquals ("21", "0.000000000000000000001", (0.000000000000000000001m).ToString ());
- AssertEquals ("22", "0.0000000000000000000001", (0.0000000000000000000001m).ToString ());
- AssertEquals ("23", "0.00000000000000000000001", (0.00000000000000000000001m).ToString ());
- AssertEquals ("24", "0.000000000000000000000001", (0.000000000000000000000001m).ToString ());
- AssertEquals ("25", "0.0000000000000000000000001", (0.0000000000000000000000001m).ToString ());
- AssertEquals ("26", "0.00000000000000000000000001", (0.00000000000000000000000001m).ToString ());
- AssertEquals ("27", "0.000000000000000000000000001", (0.000000000000000000000000001m).ToString ());
- AssertEquals ("28", "0.0000000000000000000000000001", (0.0000000000000000000000000001m).ToString ());
+ [Test]
+ public void ToString_G ()
+ {
+ AssertEquals ("00", "1.0", (1.0m).ToString ());
+ AssertEquals ("01", "0.1", (0.1m).ToString ());
+ AssertEquals ("02", "0.01", (0.01m).ToString ());
+ AssertEquals ("03", "0.001", (0.001m).ToString ());
+ AssertEquals ("04", "0.0001", (0.0001m).ToString ());
+ AssertEquals ("05", "0.00001", (0.00001m).ToString ());
+ AssertEquals ("06", "0.000001", (0.000001m).ToString ());
+ AssertEquals ("07", "0.0000001", (0.0000001m).ToString ());
+ AssertEquals ("08", "0.00000001", (0.00000001m).ToString ());
+ AssertEquals ("09", "0.000000001", (0.000000001m).ToString ());
+ AssertEquals ("10", "0.0000000001", (0.0000000001m).ToString ());
+ AssertEquals ("11", "0.00000000001", (0.00000000001m).ToString ());
+ AssertEquals ("12", "0.000000000001", (0.000000000001m).ToString ());
+ AssertEquals ("13", "0.0000000000001", (0.0000000000001m).ToString ());
+ AssertEquals ("14", "0.00000000000001", (0.00000000000001m).ToString ());
+ AssertEquals ("15", "0.000000000000001", (0.000000000000001m).ToString ());
+ AssertEquals ("16", "0.0000000000000001", (0.0000000000000001m).ToString ());
+ AssertEquals ("17", "0.00000000000000001", (0.00000000000000001m).ToString ());
+ AssertEquals ("18", "0.000000000000000001", (0.000000000000000001m).ToString ());
+ AssertEquals ("19", "0.0000000000000000001", (0.0000000000000000001m).ToString ());
+ AssertEquals ("20", "0.00000000000000000001", (0.00000000000000000001m).ToString ());
+ AssertEquals ("21", "0.000000000000000000001", (0.000000000000000000001m).ToString ());
+ AssertEquals ("22", "0.0000000000000000000001", (0.0000000000000000000001m).ToString ());
+ AssertEquals ("23", "0.00000000000000000000001", (0.00000000000000000000001m).ToString ());
+ AssertEquals ("24", "0.000000000000000000000001", (0.000000000000000000000001m).ToString ());
+ AssertEquals ("25", "0.0000000000000000000000001", (0.0000000000000000000000001m).ToString ());
+ AssertEquals ("26", "0.00000000000000000000000001", (0.00000000000000000000000001m).ToString ());
+ AssertEquals ("27", "0.000000000000000000000000001", (0.000000000000000000000000001m).ToString ());
+ AssertEquals ("28", "0.0000000000000000000000000001", (0.0000000000000000000000000001m).ToString ());
+ }
}
- }
}
using System.Threading;
using System.Globalization;
-namespace MonoTests.System {
-
+namespace MonoTests.System
+{
[TestFixture]
public class DoubleFormatterTest : Assertion
{
+ CultureInfo old_culture;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+ }
+
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
[Test]
[ExpectedException(typeof(FormatException))]
public void TestToDecimal()
// (C) 2004 Novell Inc.
//
-using NUnit.Framework;
using System;
using System.Globalization;
using System.IO;
+using System.Threading;
+
+using NUnit.Framework;
namespace MonoTests.System
{
[TestFixture]
public class FloatingPointFormatterTest : Assertion
{
+ CultureInfo old_culture;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+ }
+
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
[Test]
public void Format1 ()
{
AssertEquals ("#2", "235 hoge", 234.56.ToString ("### 'hoge'", ci));
AssertEquals ("#3", "234 hoge.56", 234.56.ToString ("### 'hoge'.###", ci));
}
- }
+ }
}
\r
using System;\r
using System.Globalization;\r
-using NUnit.Framework;\r
+using System.Threading;\r
\r
-namespace MonoTests.System {\r
- \r
- public class NumberFormatterTest : TestCase {\r
+using NUnit.Framework;\r
\r
+namespace MonoTests.System\r
+{\r
+ [TestFixture]\r
+ public class NumberFormatterTest : Assertion\r
+ {\r
+ CultureInfo old_culture;\r
NumberFormatInfo _nfi;\r
+\r
[SetUp]\r
- protected override void SetUp () {\r
- _nfi = NumberFormatInfo.InvariantInfo.Clone() as NumberFormatInfo;\r
+ public void SetUp ()\r
+ {\r
+ old_culture = Thread.CurrentThread.CurrentCulture;\r
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);\r
+ _nfi = NumberFormatInfo.InvariantInfo.Clone () as NumberFormatInfo;\r
+ }\r
+\r
+ [TearDown]\r
+ public void TearDown ()\r
+ {\r
+ Thread.CurrentThread.CurrentCulture = old_culture;\r
}\r
\r
// Test00000- Int32 and D\r
[Test]\r
- public void Test00000 () {\r
+ public void Test00000 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("D", _nfi));\r
AssertEquals ("#02", "0", 0.ToString ("d", _nfi));\r
AssertEquals ("#03", "-2147483648", Int32.MinValue.ToString ("D", _nfi));\r
}\r
\r
[Test]\r
- public void Test00001 () {\r
+ public void Test00001 ()\r
+ {\r
AssertEquals ("#01", "D ", 0.ToString ("D ", _nfi));\r
AssertEquals ("#02", " D", 0.ToString (" D", _nfi));\r
AssertEquals ("#03", " D ", 0.ToString (" D ", _nfi));\r
}\r
\r
[Test]\r
- public void Test00002 () {\r
+ public void Test00002 ()\r
+ {\r
AssertEquals ("#01", "-D ", (-1).ToString ("D ", _nfi));\r
AssertEquals ("#02", "- D", (-1).ToString (" D", _nfi));\r
AssertEquals ("#03", "- D ", (-1).ToString (" D ", _nfi));\r
}\r
\r
[Test]\r
- public void Test00003 () {\r
+ public void Test00003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("D0", _nfi));\r
AssertEquals ("#02", "0000000000", 0.ToString ("D10", _nfi));\r
AssertEquals ("#03", "00000000000", 0.ToString ("D11", _nfi));\r
}\r
\r
[Test]\r
- public void Test00004 () {\r
+ public void Test00004 ()\r
+ {\r
AssertEquals ("#01", "2147483647", Int32.MaxValue.ToString ("D0", _nfi));\r
AssertEquals ("#02", "2147483647", Int32.MaxValue.ToString ("D10", _nfi));\r
AssertEquals ("#03", "02147483647", Int32.MaxValue.ToString ("D11", _nfi));\r
}\r
\r
[Test]\r
- public void Test00005 () {\r
+ public void Test00005 ()\r
+ {\r
AssertEquals ("#01", "-2147483648", Int32.MinValue.ToString ("D0", _nfi));\r
AssertEquals ("#02", "-2147483648", Int32.MinValue.ToString ("D10", _nfi));\r
AssertEquals ("#03", "-02147483648", Int32.MinValue.ToString ("D11", _nfi));\r
}\r
\r
[Test]\r
- public void Test00006 () {\r
+ public void Test00006 ()\r
+ {\r
AssertEquals ("#01", "DF", 0.ToString ("DF", _nfi));\r
AssertEquals ("#02", "D0F", 0.ToString ("D0F", _nfi));\r
AssertEquals ("#03", "D0xF", 0.ToString ("D0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test00007 () {\r
+ public void Test00007 ()\r
+ {\r
AssertEquals ("#01", "DF", Int32.MaxValue.ToString ("DF", _nfi));\r
AssertEquals ("#02", "D2147483647F", Int32.MaxValue.ToString ("D0F", _nfi));\r
AssertEquals ("#03", "D2147483647xF", Int32.MaxValue.ToString ("D0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test00008 () {\r
+ public void Test00008 ()\r
+ {\r
AssertEquals ("#01", "-DF", Int32.MinValue.ToString ("DF", _nfi));\r
AssertEquals ("#02", "-D2147483648F", Int32.MinValue.ToString ("D0F", _nfi));\r
AssertEquals ("#03", "-D2147483648xF", Int32.MinValue.ToString ("D0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test00009 () {\r
+ public void Test00009 ()\r
+ {\r
AssertEquals ("#01", "00000000000", 0.ToString ("D0000000000000000000000000000000000000011", _nfi));\r
AssertEquals ("#02", "02147483647", Int32.MaxValue.ToString ("D0000000000000000000000000000000000000011", _nfi));\r
AssertEquals ("#03", "-02147483648", Int32.MinValue.ToString ("D0000000000000000000000000000000000000011", _nfi));\r
}\r
\r
[Test]\r
- public void Test00010 () {\r
+ public void Test00010 ()\r
+ {\r
AssertEquals ("#01", "+D", 0.ToString ("+D", _nfi));\r
AssertEquals ("#02", "D+", 0.ToString ("D+", _nfi));\r
AssertEquals ("#03", "+D+", 0.ToString ("+D+", _nfi));\r
}\r
\r
[Test]\r
- public void Test00011 () {\r
+ public void Test00011 ()\r
+ {\r
AssertEquals ("#01", "+D", Int32.MaxValue.ToString ("+D", _nfi));\r
AssertEquals ("#02", "D+", Int32.MaxValue.ToString ("D+", _nfi));\r
AssertEquals ("#03", "+D+", Int32.MaxValue.ToString ("+D+", _nfi));\r
}\r
\r
[Test]\r
- public void Test00012 () {\r
+ public void Test00012 ()\r
+ {\r
AssertEquals ("#01", "-+D", Int32.MinValue.ToString ("+D", _nfi));\r
AssertEquals ("#02", "-D+", Int32.MinValue.ToString ("D+", _nfi));\r
AssertEquals ("#03", "-+D+", Int32.MinValue.ToString ("+D+", _nfi));\r
}\r
\r
[Test]\r
- public void Test00013 () {\r
+ public void Test00013 ()\r
+ {\r
AssertEquals ("#01", "-D", 0.ToString ("-D", _nfi));\r
AssertEquals ("#02", "D-", 0.ToString ("D-", _nfi));\r
AssertEquals ("#03", "-D-", 0.ToString ("-D-", _nfi));\r
}\r
\r
[Test]\r
- public void Test00014 () {\r
+ public void Test00014 ()\r
+ {\r
AssertEquals ("#01", "-D", Int32.MaxValue.ToString ("-D", _nfi));\r
AssertEquals ("#02", "D-", Int32.MaxValue.ToString ("D-", _nfi));\r
AssertEquals ("#03", "-D-", Int32.MaxValue.ToString ("-D-", _nfi));\r
}\r
\r
[Test]\r
- public void Test00015 () {\r
+ public void Test00015 ()\r
+ {\r
AssertEquals ("#01", "--D", Int32.MinValue.ToString ("-D", _nfi));\r
AssertEquals ("#02", "-D-", Int32.MinValue.ToString ("D-", _nfi));\r
AssertEquals ("#03", "--D-", Int32.MinValue.ToString ("-D-", _nfi));\r
}\r
\r
[Test]\r
- public void Test00016 () {\r
+ public void Test00016 ()\r
+ {\r
AssertEquals ("#01", "D+0", 0.ToString ("D+0", _nfi));\r
AssertEquals ("#02", "D+2147483647", Int32.MaxValue.ToString ("D+0", _nfi));\r
AssertEquals ("#03", "-D+2147483648", Int32.MinValue.ToString ("D+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test00017 () {\r
+ public void Test00017 ()\r
+ {\r
AssertEquals ("#01", "D+9", 0.ToString ("D+9", _nfi));\r
AssertEquals ("#02", "D+9", Int32.MaxValue.ToString ("D+9", _nfi));\r
AssertEquals ("#03", "-D+9", Int32.MinValue.ToString ("D+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test00018 () {\r
+ public void Test00018 ()\r
+ {\r
AssertEquals ("#01", "D-9", 0.ToString ("D-9", _nfi));\r
AssertEquals ("#02", "D-9", Int32.MaxValue.ToString ("D-9", _nfi));\r
AssertEquals ("#03", "-D-9", Int32.MinValue.ToString ("D-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test00019 () {\r
+ public void Test00019 ()\r
+ {\r
AssertEquals ("#01", "D0", 0.ToString ("D0,", _nfi));\r
AssertEquals ("#02", "D2147484", Int32.MaxValue.ToString ("D0,", _nfi));\r
AssertEquals ("#03", "-D2147484", Int32.MinValue.ToString ("D0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test00020 () {\r
+ public void Test00020 ()\r
+ {\r
AssertEquals ("#01", "D0", 0.ToString ("D0.", _nfi));\r
AssertEquals ("#02", "D2147483647", Int32.MaxValue.ToString ("D0.", _nfi));\r
AssertEquals ("#03", "-D2147483648", Int32.MinValue.ToString ("D0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test00021 () {\r
+ public void Test00021 ()\r
+ {\r
AssertEquals ("#01", "D0.0", 0.ToString ("D0.0", _nfi));\r
AssertEquals ("#02", "D2147483647.0", Int32.MaxValue.ToString ("D0.0", _nfi));\r
AssertEquals ("#03", "-D2147483648.0", Int32.MinValue.ToString ("D0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test00022 () {\r
+ public void Test00022 ()\r
+ {\r
AssertEquals ("#01", "D09", 0.ToString ("D0.9", _nfi));\r
AssertEquals ("#02", "D21474836479", Int32.MaxValue.ToString ("D0.9", _nfi));\r
AssertEquals ("#03", "-D21474836489", Int32.MinValue.ToString ("D0.9", _nfi));\r
\r
// Test01000- Int32 and E\r
[Test]\r
- public void Test01000 () {\r
+ public void Test01000 ()\r
+ {\r
AssertEquals ("#01", "0.000000E+000", 0.ToString ("E", _nfi));\r
AssertEquals ("#02", "0.000000e+000", 0.ToString ("e", _nfi));\r
AssertEquals ("#03", "-2.147484E+009", Int32.MinValue.ToString ("E", _nfi));\r
}\r
\r
[Test]\r
- public void Test01001 () {\r
+ public void Test01001 ()\r
+ {\r
AssertEquals ("#01", "E ", 0.ToString ("E ", _nfi));\r
AssertEquals ("#02", " E", 0.ToString (" E", _nfi));\r
AssertEquals ("#03", " E ", 0.ToString (" E ", _nfi));\r
}\r
\r
[Test]\r
- public void Test01002 () {\r
+ public void Test01002 ()\r
+ {\r
AssertEquals ("#01", "-E ", (-1).ToString ("E ", _nfi));\r
AssertEquals ("#02", "- E", (-1).ToString (" E", _nfi));\r
AssertEquals ("#03", "- E ", (-1).ToString (" E ", _nfi));\r
}\r
\r
[Test]\r
- public void Test01003 () {\r
+ public void Test01003 ()\r
+ {\r
AssertEquals ("#01", "0E+000", 0.ToString ("E0", _nfi));\r
AssertEquals ("#02", "0.000000000E+000", 0.ToString ("E9", _nfi));\r
AssertEquals ("#03", "0.0000000000E+000", 0.ToString ("E10", _nfi));\r
}\r
\r
[Test]\r
- public void Test01004 () {\r
+ public void Test01004 ()\r
+ {\r
AssertEquals ("#01", "2E+009", Int32.MaxValue.ToString ("E0", _nfi));\r
AssertEquals ("#02", "2.147483647E+009", Int32.MaxValue.ToString ("E9", _nfi));\r
AssertEquals ("#03", "2.1474836470E+009", Int32.MaxValue.ToString ("E10", _nfi));\r
}\r
\r
[Test]\r
- public void Test01005 () {\r
+ public void Test01005 ()\r
+ {\r
AssertEquals ("#01", "-2E+009", Int32.MinValue.ToString ("E0", _nfi));\r
AssertEquals ("#02", "-2.147483648E+009", Int32.MinValue.ToString ("E9", _nfi));\r
AssertEquals ("#03", "-2.1474836480E+009", Int32.MinValue.ToString ("E10", _nfi));\r
}\r
\r
[Test]\r
- public void Test01006 () {\r
+ public void Test01006 ()\r
+ {\r
AssertEquals ("#01", "EF", 0.ToString ("EF", _nfi));\r
AssertEquals ("#02", "E0F", 0.ToString ("E0F", _nfi));\r
AssertEquals ("#03", "E0xF", 0.ToString ("E0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test01007 () {\r
+ public void Test01007 ()\r
+ {\r
AssertEquals ("#01", "EF", Int32.MaxValue.ToString ("EF", _nfi));\r
AssertEquals ("#02", "E0F", Int32.MaxValue.ToString ("E0F", _nfi));\r
AssertEquals ("#03", "E0xF", Int32.MaxValue.ToString ("E0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test01008 () {\r
+ public void Test01008 ()\r
+ {\r
AssertEquals ("#01", "-EF", Int32.MinValue.ToString ("EF", _nfi));\r
AssertEquals ("#02", "E0F", Int32.MinValue.ToString ("E0F", _nfi));\r
AssertEquals ("#03", "E0xF", Int32.MinValue.ToString ("E0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test01009 () {\r
+ public void Test01009 ()\r
+ {\r
AssertEquals ("#01", "0.0000000000E+000", 0.ToString ("E0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#02", "2.1474836470E+009", Int32.MaxValue.ToString ("E0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#03", "-2.1474836480E+009", Int32.MinValue.ToString ("E0000000000000000000000000000000000000010", _nfi));\r
}\r
\r
[Test]\r
- public void Test01010 () {\r
+ public void Test01010 ()\r
+ {\r
AssertEquals ("#01", "+E", 0.ToString ("+E", _nfi));\r
AssertEquals ("#02", "E+", 0.ToString ("E+", _nfi));\r
AssertEquals ("#03", "+E+", 0.ToString ("+E+", _nfi));\r
}\r
\r
[Test]\r
- public void Test01011 () {\r
+ public void Test01011 ()\r
+ {\r
AssertEquals ("#01", "+E", Int32.MaxValue.ToString ("+E", _nfi));\r
AssertEquals ("#02", "E+", Int32.MaxValue.ToString ("E+", _nfi));\r
AssertEquals ("#03", "+E+", Int32.MaxValue.ToString ("+E+", _nfi));\r
}\r
\r
[Test]\r
- public void Test01012 () {\r
+ public void Test01012 ()\r
+ {\r
AssertEquals ("#01", "-+E", Int32.MinValue.ToString ("+E", _nfi));\r
AssertEquals ("#02", "-E+", Int32.MinValue.ToString ("E+", _nfi));\r
AssertEquals ("#03", "-+E+", Int32.MinValue.ToString ("+E+", _nfi));\r
}\r
\r
[Test]\r
- public void Test01013 () {\r
+ public void Test01013 ()\r
+ {\r
AssertEquals ("#01", "-E", 0.ToString ("-E", _nfi));\r
AssertEquals ("#02", "E-", 0.ToString ("E-", _nfi));\r
AssertEquals ("#03", "-E-", 0.ToString ("-E-", _nfi));\r
}\r
\r
[Test]\r
- public void Test01014 () {\r
+ public void Test01014 ()\r
+ {\r
AssertEquals ("#01", "-E", Int32.MaxValue.ToString ("-E", _nfi));\r
AssertEquals ("#02", "E-", Int32.MaxValue.ToString ("E-", _nfi));\r
AssertEquals ("#03", "-E-", Int32.MaxValue.ToString ("-E-", _nfi));\r
}\r
\r
[Test]\r
- public void Test01015 () {\r
+ public void Test01015 ()\r
+ {\r
AssertEquals ("#01", "--E", Int32.MinValue.ToString ("-E", _nfi));\r
AssertEquals ("#02", "-E-", Int32.MinValue.ToString ("E-", _nfi));\r
AssertEquals ("#03", "--E-", Int32.MinValue.ToString ("-E-", _nfi));\r
}\r
\r
[Test]\r
- public void Test01016 () {\r
+ public void Test01016 ()\r
+ {\r
AssertEquals ("#01", "E+0", 0.ToString ("E+0", _nfi));\r
AssertEquals ("#02", "E+0", Int32.MaxValue.ToString ("E+0", _nfi));\r
AssertEquals ("#03", "E+0", Int32.MinValue.ToString ("E+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test01017 () {\r
+ public void Test01017 ()\r
+ {\r
AssertEquals ("#01", "E+9", 0.ToString ("E+9", _nfi));\r
AssertEquals ("#02", "E+9", Int32.MaxValue.ToString ("E+9", _nfi));\r
AssertEquals ("#03", "-E+9", Int32.MinValue.ToString ("E+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test01018 () {\r
+ public void Test01018 ()\r
+ {\r
AssertEquals ("#01", "E-9", 0.ToString ("E-9", _nfi));\r
AssertEquals ("#02", "E-9", Int32.MaxValue.ToString ("E-9", _nfi));\r
AssertEquals ("#03", "-E-9", Int32.MinValue.ToString ("E-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test01019 () {\r
+ public void Test01019 ()\r
+ {\r
AssertEquals ("#01", "E0", 0.ToString ("E0,", _nfi));\r
AssertEquals ("#02", "E0", Int32.MaxValue.ToString ("E0,", _nfi));\r
AssertEquals ("#03", "E0", Int32.MinValue.ToString ("E0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test01020 () {\r
+ public void Test01020 ()\r
+ {\r
AssertEquals ("#01", "E0", 0.ToString ("E0.", _nfi));\r
AssertEquals ("#02", "E0", Int32.MaxValue.ToString ("E0.", _nfi));\r
AssertEquals ("#03", "E0", Int32.MinValue.ToString ("E0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test01021 () {\r
+ public void Test01021 ()\r
+ {\r
AssertEquals ("#01", "E0.0", 0.ToString ("E0.0", _nfi));\r
AssertEquals ("#02", "E10.2", Int32.MaxValue.ToString ("E0.0", _nfi));\r
AssertEquals ("#03", "-E10.2", Int32.MinValue.ToString ("E0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test01022 () {\r
+ public void Test01022 ()\r
+ {\r
AssertEquals ("#01", "E09", 0.ToString ("E0.9", _nfi));\r
AssertEquals ("#02", "E09", Int32.MaxValue.ToString ("E0.9", _nfi));\r
AssertEquals ("#03", "E09", Int32.MinValue.ToString ("E0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test01023 () {\r
+ public void Test01023 ()\r
+ {\r
AssertEquals ("#01", "9.999999E+007", 99999990.ToString ("E", _nfi));\r
AssertEquals ("#02", "9.999999E+007", 99999991.ToString ("E", _nfi));\r
AssertEquals ("#03", "9.999999E+007", 99999992.ToString ("E", _nfi));\r
}\r
\r
[Test]\r
- public void Test01024 () {\r
+ public void Test01024 ()\r
+ {\r
AssertEquals ("#01", "-9.999999E+007", (-99999990).ToString ("E", _nfi));\r
AssertEquals ("#02", "-9.999999E+007", (-99999991).ToString ("E", _nfi));\r
AssertEquals ("#03", "-9.999999E+007", (-99999992).ToString ("E", _nfi));\r
}\r
\r
[Test]\r
- public void Test01025 () {\r
+ public void Test01025 ()\r
+ {\r
AssertEquals ("#01", "9.999998E+007", 99999980.ToString ("E", _nfi));\r
AssertEquals ("#02", "9.999998E+007", 99999981.ToString ("E", _nfi));\r
AssertEquals ("#03", "9.999998E+007", 99999982.ToString ("E", _nfi));\r
}\r
\r
[Test]\r
- public void Test01026 () {\r
+ public void Test01026 ()\r
+ {\r
AssertEquals ("#01", "-9.999998E+007", (-99999980).ToString ("E", _nfi));\r
AssertEquals ("#02", "-9.999998E+007", (-99999981).ToString ("E", _nfi));\r
AssertEquals ("#03", "-9.999998E+007", (-99999982).ToString ("E", _nfi));\r
}\r
\r
[Test]\r
- public void Test01027 () {\r
+ public void Test01027 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "-1#000000E+008", (-99999999).ToString ("E", nfi));\r
}\r
\r
[Test]\r
- public void Test01028 () {\r
+ public void Test01028 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
\r
// Test02000- Int32 and F\r
[Test]\r
- public void Test02000 () {\r
+ public void Test02000 ()\r
+ {\r
AssertEquals ("#01", "0.00", 0.ToString ("F", _nfi));\r
AssertEquals ("#02", "0.00", 0.ToString ("f", _nfi));\r
AssertEquals ("#03", "-2147483648.00", Int32.MinValue.ToString ("F", _nfi));\r
}\r
\r
[Test]\r
- public void Test02001 () {\r
+ public void Test02001 ()\r
+ {\r
AssertEquals ("#01", "F ", 0.ToString ("F ", _nfi));\r
AssertEquals ("#02", " F", 0.ToString (" F", _nfi));\r
AssertEquals ("#03", " F ", 0.ToString (" F ", _nfi));\r
}\r
\r
[Test]\r
- public void Test02002 () {\r
+ public void Test02002 ()\r
+ {\r
AssertEquals ("#01", "-F ", (-1).ToString ("F ", _nfi));\r
AssertEquals ("#02", "- F", (-1).ToString (" F", _nfi));\r
AssertEquals ("#03", "- F ", (-1).ToString (" F ", _nfi));\r
}\r
\r
[Test]\r
- public void Test02003 () {\r
+ public void Test02003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("F0", _nfi));\r
AssertEquals ("#02", "0.000000000", 0.ToString ("F9", _nfi));\r
AssertEquals ("#03", "0.0000000000", 0.ToString ("F10", _nfi));\r
}\r
\r
[Test]\r
- public void Test02004 () {\r
+ public void Test02004 ()\r
+ {\r
AssertEquals ("#01", "2147483647", Int32.MaxValue.ToString ("F0", _nfi));\r
AssertEquals ("#02", "2147483647.000000000", Int32.MaxValue.ToString ("F9", _nfi));\r
AssertEquals ("#03", "2147483647.0000000000", Int32.MaxValue.ToString ("F10", _nfi));\r
}\r
\r
[Test]\r
- public void Test02005 () {\r
+ public void Test02005 ()\r
+ {\r
AssertEquals ("#01", "-2147483648", Int32.MinValue.ToString ("F0", _nfi));\r
AssertEquals ("#02", "-2147483648.000000000", Int32.MinValue.ToString ("F9", _nfi));\r
AssertEquals ("#03", "-2147483648.0000000000", Int32.MinValue.ToString ("F10", _nfi));\r
}\r
\r
[Test]\r
- public void Test02006 () {\r
+ public void Test02006 ()\r
+ {\r
AssertEquals ("#01", "FF", 0.ToString ("FF", _nfi));\r
AssertEquals ("#02", "F0F", 0.ToString ("F0F", _nfi));\r
AssertEquals ("#03", "F0xF", 0.ToString ("F0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test02007 () {\r
+ public void Test02007 ()\r
+ {\r
AssertEquals ("#01", "FF", Int32.MaxValue.ToString ("FF", _nfi));\r
AssertEquals ("#02", "F2147483647F", Int32.MaxValue.ToString ("F0F", _nfi));\r
AssertEquals ("#03", "F2147483647xF", Int32.MaxValue.ToString ("F0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test02008 () {\r
+ public void Test02008 ()\r
+ {\r
AssertEquals ("#01", "-FF", Int32.MinValue.ToString ("FF", _nfi));\r
AssertEquals ("#02", "-F2147483648F", Int32.MinValue.ToString ("F0F", _nfi));\r
AssertEquals ("#03", "-F2147483648xF", Int32.MinValue.ToString ("F0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test02009 () {\r
+ public void Test02009 ()\r
+ {\r
AssertEquals ("#01", "0.0000000000", 0.ToString ("F0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#02", "2147483647.0000000000", Int32.MaxValue.ToString ("F0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#03", "-2147483648.0000000000", Int32.MinValue.ToString ("F0000000000000000000000000000000000000010", _nfi));\r
}\r
\r
[Test]\r
- public void Test02010 () {\r
+ public void Test02010 ()\r
+ {\r
AssertEquals ("#01", "+F", 0.ToString ("+F", _nfi));\r
AssertEquals ("#02", "F+", 0.ToString ("F+", _nfi));\r
AssertEquals ("#03", "+F+", 0.ToString ("+F+", _nfi));\r
}\r
\r
[Test]\r
- public void Test02011 () {\r
+ public void Test02011 ()\r
+ {\r
AssertEquals ("#01", "+F", Int32.MaxValue.ToString ("+F", _nfi));\r
AssertEquals ("#02", "F+", Int32.MaxValue.ToString ("F+", _nfi));\r
AssertEquals ("#03", "+F+", Int32.MaxValue.ToString ("+F+", _nfi));\r
}\r
\r
[Test]\r
- public void Test02012 () {\r
+ public void Test02012 ()\r
+ {\r
AssertEquals ("#01", "-+F", Int32.MinValue.ToString ("+F", _nfi));\r
AssertEquals ("#02", "-F+", Int32.MinValue.ToString ("F+", _nfi));\r
AssertEquals ("#03", "-+F+", Int32.MinValue.ToString ("+F+", _nfi));\r
}\r
\r
[Test]\r
- public void Test02013 () {\r
+ public void Test02013 ()\r
+ {\r
AssertEquals ("#01", "-F", 0.ToString ("-F", _nfi));\r
AssertEquals ("#02", "F-", 0.ToString ("F-", _nfi));\r
AssertEquals ("#03", "-F-", 0.ToString ("-F-", _nfi));\r
}\r
\r
[Test]\r
- public void Test02014 () {\r
+ public void Test02014 ()\r
+ {\r
AssertEquals ("#01", "-F", Int32.MaxValue.ToString ("-F", _nfi));\r
AssertEquals ("#02", "F-", Int32.MaxValue.ToString ("F-", _nfi));\r
AssertEquals ("#03", "-F-", Int32.MaxValue.ToString ("-F-", _nfi));\r
}\r
\r
[Test]\r
- public void Test02015 () {\r
+ public void Test02015 ()\r
+ {\r
AssertEquals ("#01", "--F", Int32.MinValue.ToString ("-F", _nfi));\r
AssertEquals ("#02", "-F-", Int32.MinValue.ToString ("F-", _nfi));\r
AssertEquals ("#03", "--F-", Int32.MinValue.ToString ("-F-", _nfi));\r
}\r
\r
[Test]\r
- public void Test02016 () {\r
+ public void Test02016 ()\r
+ {\r
AssertEquals ("#01", "F+0", 0.ToString ("F+0", _nfi));\r
AssertEquals ("#02", "F+2147483647", Int32.MaxValue.ToString ("F+0", _nfi));\r
AssertEquals ("#03", "-F+2147483648", Int32.MinValue.ToString ("F+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test02017 () {\r
+ public void Test02017 ()\r
+ {\r
AssertEquals ("#01", "F+9", 0.ToString ("F+9", _nfi));\r
AssertEquals ("#02", "F+9", Int32.MaxValue.ToString ("F+9", _nfi));\r
AssertEquals ("#03", "-F+9", Int32.MinValue.ToString ("F+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test02018 () {\r
+ public void Test02018 ()\r
+ {\r
AssertEquals ("#01", "F-9", 0.ToString ("F-9", _nfi));\r
AssertEquals ("#02", "F-9", Int32.MaxValue.ToString ("F-9", _nfi));\r
AssertEquals ("#03", "-F-9", Int32.MinValue.ToString ("F-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test02019 () {\r
+ public void Test02019 ()\r
+ {\r
AssertEquals ("#01", "F0", 0.ToString ("F0,", _nfi));\r
AssertEquals ("#02", "F2147484", Int32.MaxValue.ToString ("F0,", _nfi));\r
AssertEquals ("#03", "-F2147484", Int32.MinValue.ToString ("F0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test02020 () {\r
+ public void Test02020 ()\r
+ {\r
AssertEquals ("#01", "F0", 0.ToString ("F0.", _nfi));\r
AssertEquals ("#02", "F2147483647", Int32.MaxValue.ToString ("F0.", _nfi));\r
AssertEquals ("#03", "-F2147483648", Int32.MinValue.ToString ("F0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test02021 () {\r
+ public void Test02021 ()\r
+ {\r
AssertEquals ("#01", "F0.0", 0.ToString ("F0.0", _nfi));\r
AssertEquals ("#02", "F2147483647.0", Int32.MaxValue.ToString ("F0.0", _nfi));\r
AssertEquals ("#03", "-F2147483648.0", Int32.MinValue.ToString ("F0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test02022 () {\r
+ public void Test02022 ()\r
+ {\r
AssertEquals ("#01", "F09", 0.ToString ("F0.9", _nfi));\r
AssertEquals ("#02", "F21474836479", Int32.MaxValue.ToString ("F0.9", _nfi));\r
AssertEquals ("#03", "-F21474836489", Int32.MinValue.ToString ("F0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test02023 () {\r
+ public void Test02023 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalDigits = 0;\r
AssertEquals ("#01", "0", 0.ToString ("F", nfi));\r
}\r
\r
[Test]\r
- public void Test02024 () {\r
+ public void Test02024 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "";\r
AssertEquals ("#01", "2147483648.00", Int32.MinValue.ToString ("F", nfi));\r
}\r
\r
[Test]\r
- public void Test02025 () {\r
+ public void Test02025 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "-";\r
nfi.PositiveSign = "+";\r
}\r
\r
[Test]\r
- public void Test02026 () {\r
+ public void Test02026 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test02027 () {\r
+ public void Test02027 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "1#00",1.ToString ("F", nfi));\r
\r
// Test03000 - Int32 and G\r
[Test]\r
- public void Test03000 () {\r
+ public void Test03000 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("G", _nfi));\r
AssertEquals ("#02", "0", 0.ToString ("g", _nfi));\r
AssertEquals ("#03", "-2147483648", Int32.MinValue.ToString ("G", _nfi));\r
}\r
\r
[Test]\r
- public void Test03001 () {\r
+ public void Test03001 ()\r
+ {\r
AssertEquals ("#01", "G ", 0.ToString ("G ", _nfi));\r
AssertEquals ("#02", " G", 0.ToString (" G", _nfi));\r
AssertEquals ("#03", " G ", 0.ToString (" G ", _nfi));\r
}\r
\r
[Test]\r
- public void Test03002 () {\r
+ public void Test03002 ()\r
+ {\r
AssertEquals ("#01", "-G ", (-1).ToString ("G ", _nfi));\r
AssertEquals ("#02", "- G", (-1).ToString (" G", _nfi));\r
AssertEquals ("#03", "- G ", (-1).ToString (" G ", _nfi));\r
}\r
\r
[Test]\r
- public void Test03003 () {\r
+ public void Test03003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("G0", _nfi));\r
AssertEquals ("#02", "0", 0.ToString ("G9", _nfi));\r
AssertEquals ("#03", "0", 0.ToString ("G10", _nfi));\r
}\r
\r
[Test]\r
- public void Test03004 () {\r
+ public void Test03004 ()\r
+ {\r
AssertEquals ("#01", "2147483647", Int32.MaxValue.ToString ("G0", _nfi));\r
AssertEquals ("#02", "2.14748365E+09", Int32.MaxValue.ToString ("G9", _nfi));\r
AssertEquals ("#03", "2147483647", Int32.MaxValue.ToString ("G10", _nfi));\r
}\r
\r
[Test]\r
- public void Test03005 () {\r
+ public void Test03005 ()\r
+ {\r
AssertEquals ("#01", "-2147483648", Int32.MinValue.ToString ("G0", _nfi));\r
AssertEquals ("#02", "-2.14748365E+09", Int32.MinValue.ToString ("G9", _nfi));\r
AssertEquals ("#03", "-2147483648", Int32.MinValue.ToString ("G10", _nfi));\r
}\r
\r
[Test]\r
- public void Test03006 () {\r
+ public void Test03006 ()\r
+ {\r
AssertEquals ("#01", "GF", 0.ToString ("GF", _nfi));\r
AssertEquals ("#02", "G0F", 0.ToString ("G0F", _nfi));\r
AssertEquals ("#03", "G0xF", 0.ToString ("G0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test03007 () {\r
+ public void Test03007 ()\r
+ {\r
AssertEquals ("#01", "GF", Int32.MaxValue.ToString ("GF", _nfi));\r
AssertEquals ("#02", "G2147483647F", Int32.MaxValue.ToString ("G0F", _nfi));\r
AssertEquals ("#03", "G2147483647xF", Int32.MaxValue.ToString ("G0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test03008 () {\r
+ public void Test03008 ()\r
+ {\r
AssertEquals ("#01", "-GF", Int32.MinValue.ToString ("GF", _nfi));\r
AssertEquals ("#02", "-G2147483648F", Int32.MinValue.ToString ("G0F", _nfi));\r
AssertEquals ("#03", "-G2147483648xF", Int32.MinValue.ToString ("G0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test03009 () {\r
+ public void Test03009 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("G0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#02", "2147483647", Int32.MaxValue.ToString ("G0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#03", "-2147483648", Int32.MinValue.ToString ("G0000000000000000000000000000000000000010", _nfi));\r
}\r
\r
[Test]\r
- public void Test03010 () {\r
+ public void Test03010 ()\r
+ {\r
AssertEquals ("#01", "+G", 0.ToString ("+G", _nfi));\r
AssertEquals ("#02", "G+", 0.ToString ("G+", _nfi));\r
AssertEquals ("#03", "+G+", 0.ToString ("+G+", _nfi));\r
}\r
\r
[Test]\r
- public void Test03011 () {\r
+ public void Test03011 ()\r
+ {\r
AssertEquals ("#01", "+G", Int32.MaxValue.ToString ("+G", _nfi));\r
AssertEquals ("#02", "G+", Int32.MaxValue.ToString ("G+", _nfi));\r
AssertEquals ("#03", "+G+", Int32.MaxValue.ToString ("+G+", _nfi));\r
}\r
\r
[Test]\r
- public void Test03012 () {\r
+ public void Test03012 ()\r
+ {\r
AssertEquals ("#01", "-+G", Int32.MinValue.ToString ("+G", _nfi));\r
AssertEquals ("#02", "-G+", Int32.MinValue.ToString ("G+", _nfi));\r
AssertEquals ("#03", "-+G+", Int32.MinValue.ToString ("+G+", _nfi));\r
}\r
\r
[Test]\r
- public void Test03013 () {\r
+ public void Test03013 ()\r
+ {\r
AssertEquals ("#01", "-G", 0.ToString ("-G", _nfi));\r
AssertEquals ("#02", "G-", 0.ToString ("G-", _nfi));\r
AssertEquals ("#03", "-G-", 0.ToString ("-G-", _nfi));\r
}\r
\r
[Test]\r
- public void Test03014 () {\r
+ public void Test03014 ()\r
+ {\r
AssertEquals ("#01", "-G", Int32.MaxValue.ToString ("-G", _nfi));\r
AssertEquals ("#02", "G-", Int32.MaxValue.ToString ("G-", _nfi));\r
AssertEquals ("#03", "-G-", Int32.MaxValue.ToString ("-G-", _nfi));\r
}\r
\r
[Test]\r
- public void Test03015 () {\r
+ public void Test03015 ()\r
+ {\r
AssertEquals ("#01", "--G", Int32.MinValue.ToString ("-G", _nfi));\r
AssertEquals ("#02", "-G-", Int32.MinValue.ToString ("G-", _nfi));\r
AssertEquals ("#03", "--G-", Int32.MinValue.ToString ("-G-", _nfi));\r
}\r
\r
[Test]\r
- public void Test03016 () {\r
+ public void Test03016 ()\r
+ {\r
AssertEquals ("#01", "G+0", 0.ToString ("G+0", _nfi));\r
AssertEquals ("#02", "G+2147483647", Int32.MaxValue.ToString ("G+0", _nfi));\r
AssertEquals ("#03", "-G+2147483648", Int32.MinValue.ToString ("G+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test03017 () {\r
+ public void Test03017 ()\r
+ {\r
AssertEquals ("#01", "G+9", 0.ToString ("G+9", _nfi));\r
AssertEquals ("#02", "G+9", Int32.MaxValue.ToString ("G+9", _nfi));\r
AssertEquals ("#03", "-G+9", Int32.MinValue.ToString ("G+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test03018 () {\r
+ public void Test03018 ()\r
+ {\r
AssertEquals ("#01", "G-9", 0.ToString ("G-9", _nfi));\r
AssertEquals ("#02", "G-9", Int32.MaxValue.ToString ("G-9", _nfi));\r
AssertEquals ("#03", "-G-9", Int32.MinValue.ToString ("G-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test03019 () {\r
+ public void Test03019 ()\r
+ {\r
AssertEquals ("#01", "G0", 0.ToString ("G0,", _nfi));\r
AssertEquals ("#02", "G2147484", Int32.MaxValue.ToString ("G0,", _nfi));\r
AssertEquals ("#03", "-G2147484", Int32.MinValue.ToString ("G0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test03020 () {\r
+ public void Test03020 ()\r
+ {\r
AssertEquals ("#01", "G0", 0.ToString ("G0.", _nfi));\r
AssertEquals ("#02", "G2147483647", Int32.MaxValue.ToString ("G0.", _nfi));\r
AssertEquals ("#03", "-G2147483648", Int32.MinValue.ToString ("G0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test03021 () {\r
+ public void Test03021 ()\r
+ {\r
AssertEquals ("#01", "G0.0", 0.ToString ("G0.0", _nfi));\r
AssertEquals ("#02", "G2147483647.0", Int32.MaxValue.ToString ("G0.0", _nfi));\r
AssertEquals ("#03", "-G2147483648.0", Int32.MinValue.ToString ("G0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test03022 () {\r
+ public void Test03022 ()\r
+ {\r
AssertEquals ("#01", "G09", 0.ToString ("G0.9", _nfi));\r
AssertEquals ("#02", "G21474836479", Int32.MaxValue.ToString ("G0.9", _nfi));\r
AssertEquals ("#03", "-G21474836489", Int32.MinValue.ToString ("G0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test03023 () {\r
+ public void Test03023 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalDigits = 0;\r
AssertEquals ("#01", "0", 0.ToString ("G", nfi));\r
}\r
\r
[Test]\r
- public void Test03024 () {\r
+ public void Test03024 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "";\r
AssertEquals ("#01", "2147483648", Int32.MinValue.ToString ("G", nfi));\r
}\r
\r
[Test]\r
- public void Test03025 () {\r
+ public void Test03025 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "-";\r
nfi.PositiveSign = "+";\r
}\r
\r
[Test]\r
- public void Test03026 () {\r
+ public void Test03026 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test03027 () {\r
+ public void Test03027 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "1#2E+02",123.ToString ("G2", nfi));\r
\r
// Test04000 - Int32 and N\r
[Test]\r
- public void Test04000 () {\r
+ public void Test04000 ()\r
+ {\r
AssertEquals ("#01", "0.00", 0.ToString ("N", _nfi));\r
AssertEquals ("#02", "0.00", 0.ToString ("n", _nfi));\r
AssertEquals ("#03", "-2,147,483,648.00", Int32.MinValue.ToString ("N", _nfi));\r
}\r
\r
[Test]\r
- public void Test04001 () {\r
+ public void Test04001 ()\r
+ {\r
AssertEquals ("#01", "N ", 0.ToString ("N ", _nfi));\r
AssertEquals ("#02", " N", 0.ToString (" N", _nfi));\r
AssertEquals ("#03", " N ", 0.ToString (" N ", _nfi));\r
}\r
\r
[Test]\r
- public void Test04002 () {\r
+ public void Test04002 ()\r
+ {\r
AssertEquals ("#01", "-N ", (-1).ToString ("N ", _nfi));\r
AssertEquals ("#02", "- N", (-1).ToString (" N", _nfi));\r
AssertEquals ("#03", "- N ", (-1).ToString (" N ", _nfi));\r
}\r
\r
[Test]\r
- public void Test04003 () {\r
+ public void Test04003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("N0", _nfi));\r
AssertEquals ("#02", "0.000000000", 0.ToString ("N9", _nfi));\r
AssertEquals ("#03", "0.0000000000", 0.ToString ("N10", _nfi));\r
}\r
\r
[Test]\r
- public void Test04004 () {\r
+ public void Test04004 ()\r
+ {\r
AssertEquals ("#01", "2,147,483,647", Int32.MaxValue.ToString ("N0", _nfi));\r
AssertEquals ("#02", "2,147,483,647.000000000", Int32.MaxValue.ToString ("N9", _nfi));\r
AssertEquals ("#03", "2,147,483,647.0000000000", Int32.MaxValue.ToString ("N10", _nfi));\r
}\r
\r
[Test]\r
- public void Test04005 () {\r
+ public void Test04005 ()\r
+ {\r
AssertEquals ("#01", "-2,147,483,648", Int32.MinValue.ToString ("N0", _nfi));\r
AssertEquals ("#02", "-2,147,483,648.000000000", Int32.MinValue.ToString ("N9", _nfi));\r
AssertEquals ("#03", "-2,147,483,648.0000000000", Int32.MinValue.ToString ("N10", _nfi));\r
}\r
\r
[Test]\r
- public void Test04006 () {\r
+ public void Test04006 ()\r
+ {\r
AssertEquals ("#01", "NF", 0.ToString ("NF", _nfi));\r
AssertEquals ("#02", "N0F", 0.ToString ("N0F", _nfi));\r
AssertEquals ("#03", "N0xF", 0.ToString ("N0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test04007 () {\r
+ public void Test04007 ()\r
+ {\r
AssertEquals ("#01", "NF", Int32.MaxValue.ToString ("NF", _nfi));\r
AssertEquals ("#02", "N2147483647F", Int32.MaxValue.ToString ("N0F", _nfi));\r
AssertEquals ("#03", "N2147483647xF", Int32.MaxValue.ToString ("N0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test04008 () {\r
+ public void Test04008 ()\r
+ {\r
AssertEquals ("#01", "-NF", Int32.MinValue.ToString ("NF", _nfi));\r
AssertEquals ("#02", "-N2147483648F", Int32.MinValue.ToString ("N0F", _nfi));\r
AssertEquals ("#03", "-N2147483648xF", Int32.MinValue.ToString ("N0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test04009 () {\r
+ public void Test04009 ()\r
+ {\r
AssertEquals ("#01", "0.0000000000", 0.ToString ("N0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#02", "2,147,483,647.0000000000", Int32.MaxValue.ToString ("N0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#03", "-2,147,483,648.0000000000", Int32.MinValue.ToString ("N0000000000000000000000000000000000000010", _nfi));\r
}\r
\r
[Test]\r
- public void Test04010 () {\r
+ public void Test04010 ()\r
+ {\r
AssertEquals ("#01", "+N", 0.ToString ("+N", _nfi));\r
AssertEquals ("#02", "N+", 0.ToString ("N+", _nfi));\r
AssertEquals ("#03", "+N+", 0.ToString ("+N+", _nfi));\r
}\r
\r
[Test]\r
- public void Test04011 () {\r
+ public void Test04011 ()\r
+ {\r
AssertEquals ("#01", "+N", Int32.MaxValue.ToString ("+N", _nfi));\r
AssertEquals ("#02", "N+", Int32.MaxValue.ToString ("N+", _nfi));\r
AssertEquals ("#03", "+N+", Int32.MaxValue.ToString ("+N+", _nfi));\r
}\r
\r
[Test]\r
- public void Test04012 () {\r
+ public void Test04012 ()\r
+ {\r
AssertEquals ("#01", "-+N", Int32.MinValue.ToString ("+N", _nfi));\r
AssertEquals ("#02", "-N+", Int32.MinValue.ToString ("N+", _nfi));\r
AssertEquals ("#03", "-+N+", Int32.MinValue.ToString ("+N+", _nfi));\r
}\r
\r
[Test]\r
- public void Test04013 () {\r
+ public void Test04013 ()\r
+ {\r
AssertEquals ("#01", "-N", 0.ToString ("-N", _nfi));\r
AssertEquals ("#02", "N-", 0.ToString ("N-", _nfi));\r
AssertEquals ("#03", "-N-", 0.ToString ("-N-", _nfi));\r
}\r
\r
[Test]\r
- public void Test04014 () {\r
+ public void Test04014 ()\r
+ {\r
AssertEquals ("#01", "-N", Int32.MaxValue.ToString ("-N", _nfi));\r
AssertEquals ("#02", "N-", Int32.MaxValue.ToString ("N-", _nfi));\r
AssertEquals ("#03", "-N-", Int32.MaxValue.ToString ("-N-", _nfi));\r
}\r
\r
[Test]\r
- public void Test04015 () {\r
+ public void Test04015 ()\r
+ {\r
AssertEquals ("#01", "--N", Int32.MinValue.ToString ("-N", _nfi));\r
AssertEquals ("#02", "-N-", Int32.MinValue.ToString ("N-", _nfi));\r
AssertEquals ("#03", "--N-", Int32.MinValue.ToString ("-N-", _nfi));\r
}\r
\r
[Test]\r
- public void Test04016 () {\r
+ public void Test04016 ()\r
+ {\r
AssertEquals ("#01", "N+0", 0.ToString ("N+0", _nfi));\r
AssertEquals ("#02", "N+2147483647", Int32.MaxValue.ToString ("N+0", _nfi));\r
AssertEquals ("#03", "-N+2147483648", Int32.MinValue.ToString ("N+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test04017 () {\r
+ public void Test04017 ()\r
+ {\r
AssertEquals ("#01", "N+9", 0.ToString ("N+9", _nfi));\r
AssertEquals ("#02", "N+9", Int32.MaxValue.ToString ("N+9", _nfi));\r
AssertEquals ("#03", "-N+9", Int32.MinValue.ToString ("N+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test04018 () {\r
+ public void Test04018 ()\r
+ {\r
AssertEquals ("#01", "N-9", 0.ToString ("N-9", _nfi));\r
AssertEquals ("#02", "N-9", Int32.MaxValue.ToString ("N-9", _nfi));\r
AssertEquals ("#03", "-N-9", Int32.MinValue.ToString ("N-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test04019 () {\r
+ public void Test04019 ()\r
+ {\r
AssertEquals ("#01", "N0", 0.ToString ("N0,", _nfi));\r
AssertEquals ("#02", "N2147484", Int32.MaxValue.ToString ("N0,", _nfi));\r
AssertEquals ("#03", "-N2147484", Int32.MinValue.ToString ("N0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test04020 () {\r
+ public void Test04020 ()\r
+ {\r
AssertEquals ("#01", "N0", 0.ToString ("N0.", _nfi));\r
AssertEquals ("#02", "N2147483647", Int32.MaxValue.ToString ("N0.", _nfi));\r
AssertEquals ("#03", "-N2147483648", Int32.MinValue.ToString ("N0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test04021 () {\r
+ public void Test04021 ()\r
+ {\r
AssertEquals ("#01", "N0.0", 0.ToString ("N0.0", _nfi));\r
AssertEquals ("#02", "N2147483647.0", Int32.MaxValue.ToString ("N0.0", _nfi));\r
AssertEquals ("#03", "-N2147483648.0", Int32.MinValue.ToString ("N0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test04022 () {\r
+ public void Test04022 ()\r
+ {\r
AssertEquals ("#01", "N09", 0.ToString ("N0.9", _nfi));\r
AssertEquals ("#02", "N21474836479", Int32.MaxValue.ToString ("N0.9", _nfi));\r
AssertEquals ("#03", "-N21474836489", Int32.MinValue.ToString ("N0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test04023 () {\r
+ public void Test04023 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalDigits = 0;\r
AssertEquals ("#01", "0", 0.ToString ("N", nfi));\r
}\r
\r
[Test]\r
- public void Test04024 () {\r
+ public void Test04024 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "";\r
AssertEquals ("#01", "2,147,483,648.00", Int32.MinValue.ToString ("N", nfi));\r
}\r
\r
[Test]\r
- public void Test04025 () {\r
+ public void Test04025 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "-";\r
nfi.PositiveSign = "+";\r
}\r
\r
[Test]\r
- public void Test04026 () {\r
+ public void Test04026 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test04027 () {\r
+ public void Test04027 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "123#0",123.ToString ("N1", nfi));\r
}\r
\r
[Test]\r
- public void Test04028 () {\r
+ public void Test04028 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberGroupSeparator = "-";\r
AssertEquals ("#01", "-2-147-483-648.0",Int32.MinValue.ToString ("N1", nfi));\r
}\r
\r
[Test]\r
- public void Test04029 () {\r
+ public void Test04029 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberGroupSizes = new int [] {};\r
AssertEquals ("#01", "-2147483648.0",Int32.MinValue.ToString ("N1", nfi));\r
}\r
\r
[Test]\r
- public void Test04030 () {\r
+ public void Test04030 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberGroupSizes = new int [] {1,2};\r
AssertEquals ("#01", "-2,14,74,83,64,8.0",Int32.MinValue.ToString ("N1", nfi));\r
}\r
\r
[Test]\r
- public void Test04031 () {\r
+ public void Test04031 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "1234567890";\r
AssertEquals ("#01", "12345678902,147,483,648.00", Int32.MinValue.ToString ("N", nfi));\r
\r
// Test05000 - Int32 and P\r
[Test]\r
- public void Test05000 () {\r
+ public void Test05000 ()\r
+ {\r
AssertEquals ("#01", "0.00 %", 0.ToString ("P", _nfi));\r
AssertEquals ("#02", "0.00 %", 0.ToString ("p", _nfi));\r
AssertEquals ("#03", "-214,748,364,800.00 %", Int32.MinValue.ToString ("P", _nfi));\r
}\r
\r
[Test]\r
- public void Test05001 () {\r
+ public void Test05001 ()\r
+ {\r
AssertEquals ("#01", "P ", 0.ToString ("P ", _nfi));\r
AssertEquals ("#02", " P", 0.ToString (" P", _nfi));\r
AssertEquals ("#03", " P ", 0.ToString (" P ", _nfi));\r
}\r
\r
[Test]\r
- public void Test05002 () {\r
+ public void Test05002 ()\r
+ {\r
AssertEquals ("#01", "-P ", (-1).ToString ("P ", _nfi));\r
AssertEquals ("#02", "- P", (-1).ToString (" P", _nfi));\r
AssertEquals ("#03", "- P ", (-1).ToString (" P ", _nfi));\r
}\r
\r
[Test]\r
- public void Test05003 () {\r
+ public void Test05003 ()\r
+ {\r
AssertEquals ("#01", "0 %", 0.ToString ("P0", _nfi));\r
AssertEquals ("#02", "0.000000000 %", 0.ToString ("P9", _nfi));\r
AssertEquals ("#03", "0.0000000000 %", 0.ToString ("P10", _nfi));\r
}\r
\r
[Test]\r
- public void Test05004 () {\r
+ public void Test05004 ()\r
+ {\r
AssertEquals ("#01", "214,748,364,700 %", Int32.MaxValue.ToString ("P0", _nfi));\r
AssertEquals ("#02", "214,748,364,700.000000000 %", Int32.MaxValue.ToString ("P9", _nfi));\r
AssertEquals ("#03", "214,748,364,700.0000000000 %", Int32.MaxValue.ToString ("P10", _nfi));\r
}\r
\r
[Test]\r
- public void Test05005 () {\r
+ public void Test05005 ()\r
+ {\r
AssertEquals ("#01", "-214,748,364,800 %", Int32.MinValue.ToString ("P0", _nfi));\r
AssertEquals ("#02", "-214,748,364,800.000000000 %", Int32.MinValue.ToString ("P9", _nfi));\r
AssertEquals ("#03", "-214,748,364,800.0000000000 %", Int32.MinValue.ToString ("P10", _nfi));\r
}\r
\r
[Test]\r
- public void Test05006 () {\r
+ public void Test05006 ()\r
+ {\r
AssertEquals ("#01", "PF", 0.ToString ("PF", _nfi));\r
AssertEquals ("#02", "P0F", 0.ToString ("P0F", _nfi));\r
AssertEquals ("#03", "P0xF", 0.ToString ("P0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test05007 () {\r
+ public void Test05007 ()\r
+ {\r
AssertEquals ("#01", "PF", Int32.MaxValue.ToString ("PF", _nfi));\r
AssertEquals ("#02", "P2147483647F", Int32.MaxValue.ToString ("P0F", _nfi));\r
AssertEquals ("#03", "P2147483647xF", Int32.MaxValue.ToString ("P0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test05008 () {\r
+ public void Test05008 ()\r
+ {\r
AssertEquals ("#01", "-PF", Int32.MinValue.ToString ("PF", _nfi));\r
AssertEquals ("#02", "-P2147483648F", Int32.MinValue.ToString ("P0F", _nfi));\r
AssertEquals ("#03", "-P2147483648xF", Int32.MinValue.ToString ("P0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test05009 () {\r
+ public void Test05009 ()\r
+ {\r
AssertEquals ("#01", "0.0000000000 %", 0.ToString ("P0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#02", "214,748,364,700.0000000000 %", Int32.MaxValue.ToString ("P0000000000000000000000000000000000000010", _nfi));\r
AssertEquals ("#03", "-214,748,364,800.0000000000 %", Int32.MinValue.ToString ("P0000000000000000000000000000000000000010", _nfi));\r
}\r
\r
[Test]\r
- public void Test05010 () {\r
+ public void Test05010 ()\r
+ {\r
AssertEquals ("#01", "+P", 0.ToString ("+P", _nfi));\r
AssertEquals ("#02", "P+", 0.ToString ("P+", _nfi));\r
AssertEquals ("#03", "+P+", 0.ToString ("+P+", _nfi));\r
}\r
\r
[Test]\r
- public void Test05011 () {\r
+ public void Test05011 ()\r
+ {\r
AssertEquals ("#01", "+P", Int32.MaxValue.ToString ("+P", _nfi));\r
AssertEquals ("#02", "P+", Int32.MaxValue.ToString ("P+", _nfi));\r
AssertEquals ("#03", "+P+", Int32.MaxValue.ToString ("+P+", _nfi));\r
}\r
\r
[Test]\r
- public void Test05012 () {\r
+ public void Test05012 ()\r
+ {\r
AssertEquals ("#01", "-+P", Int32.MinValue.ToString ("+P", _nfi));\r
AssertEquals ("#02", "-P+", Int32.MinValue.ToString ("P+", _nfi));\r
AssertEquals ("#03", "-+P+", Int32.MinValue.ToString ("+P+", _nfi));\r
}\r
\r
[Test]\r
- public void Test05013 () {\r
+ public void Test05013 ()\r
+ {\r
AssertEquals ("#01", "-P", 0.ToString ("-P", _nfi));\r
AssertEquals ("#02", "P-", 0.ToString ("P-", _nfi));\r
AssertEquals ("#03", "-P-", 0.ToString ("-P-", _nfi));\r
}\r
\r
[Test]\r
- public void Test05014 () {\r
+ public void Test05014 ()\r
+ {\r
AssertEquals ("#01", "-P", Int32.MaxValue.ToString ("-P", _nfi));\r
AssertEquals ("#02", "P-", Int32.MaxValue.ToString ("P-", _nfi));\r
AssertEquals ("#03", "-P-", Int32.MaxValue.ToString ("-P-", _nfi));\r
}\r
\r
[Test]\r
- public void Test05015 () {\r
+ public void Test05015 ()\r
+ {\r
AssertEquals ("#01", "--P", Int32.MinValue.ToString ("-P", _nfi));\r
AssertEquals ("#02", "-P-", Int32.MinValue.ToString ("P-", _nfi));\r
AssertEquals ("#03", "--P-", Int32.MinValue.ToString ("-P-", _nfi));\r
}\r
\r
[Test]\r
- public void Test05016 () {\r
+ public void Test05016 ()\r
+ {\r
AssertEquals ("#01", "P+0", 0.ToString ("P+0", _nfi));\r
AssertEquals ("#02", "P+2147483647", Int32.MaxValue.ToString ("P+0", _nfi));\r
AssertEquals ("#03", "-P+2147483648", Int32.MinValue.ToString ("P+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test05017 () {\r
+ public void Test05017 ()\r
+ {\r
AssertEquals ("#01", "P+9", 0.ToString ("P+9", _nfi));\r
AssertEquals ("#02", "P+9", Int32.MaxValue.ToString ("P+9", _nfi));\r
AssertEquals ("#03", "-P+9", Int32.MinValue.ToString ("P+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test05018 () {\r
+ public void Test05018 ()\r
+ {\r
AssertEquals ("#01", "P-9", 0.ToString ("P-9", _nfi));\r
AssertEquals ("#02", "P-9", Int32.MaxValue.ToString ("P-9", _nfi));\r
AssertEquals ("#03", "-P-9", Int32.MinValue.ToString ("P-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test05019 () {\r
+ public void Test05019 ()\r
+ {\r
AssertEquals ("#01", "P0", 0.ToString ("P0,", _nfi));\r
AssertEquals ("#02", "P2147484", Int32.MaxValue.ToString ("P0,", _nfi));\r
AssertEquals ("#03", "-P2147484", Int32.MinValue.ToString ("P0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test05020 () {\r
+ public void Test05020 ()\r
+ {\r
AssertEquals ("#01", "P0", 0.ToString ("P0.", _nfi));\r
AssertEquals ("#02", "P2147483647", Int32.MaxValue.ToString ("P0.", _nfi));\r
AssertEquals ("#03", "-P2147483648", Int32.MinValue.ToString ("P0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test05021 () {\r
+ public void Test05021 ()\r
+ {\r
AssertEquals ("#01", "P0.0", 0.ToString ("P0.0", _nfi));\r
AssertEquals ("#02", "P2147483647.0", Int32.MaxValue.ToString ("P0.0", _nfi));\r
AssertEquals ("#03", "-P2147483648.0", Int32.MinValue.ToString ("P0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test05022 () {\r
+ public void Test05022 ()\r
+ {\r
AssertEquals ("#01", "P09", 0.ToString ("P0.9", _nfi));\r
AssertEquals ("#02", "P21474836479", Int32.MaxValue.ToString ("P0.9", _nfi));\r
AssertEquals ("#03", "-P21474836489", Int32.MinValue.ToString ("P0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test05023 () {\r
+ public void Test05023 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentDecimalDigits = 0;\r
AssertEquals ("#01", "0 %", 0.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05024 () {\r
+ public void Test05024 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "";\r
AssertEquals ("#01", "214,748,364,800.00 %", Int32.MinValue.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05025 () {\r
+ public void Test05025 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "-";\r
nfi.PositiveSign = "+";\r
}\r
\r
[Test]\r
- public void Test05026 () {\r
+ public void Test05026 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test05027 () {\r
+ public void Test05027 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentDecimalSeparator = "#";\r
AssertEquals ("#01", "12,300#0 %",123.ToString ("P1", nfi));\r
}\r
\r
[Test]\r
- public void Test05028 () {\r
+ public void Test05028 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentGroupSeparator = "-";\r
AssertEquals ("#01", "-214-748-364-800.0 %",Int32.MinValue.ToString ("P1", nfi));\r
}\r
\r
[Test]\r
- public void Test05029 () {\r
+ public void Test05029 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentGroupSizes = new int [] {};\r
AssertEquals ("#01", "-214748364800.0 %",Int32.MinValue.ToString ("P1", nfi));\r
}\r
\r
[Test]\r
- public void Test05030 () {\r
+ public void Test05030 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentGroupSizes = new int [] {1,2};\r
AssertEquals ("#01", "-2,14,74,83,64,80,0.0 %",Int32.MinValue.ToString ("P1", nfi));\r
}\r
\r
[Test]\r
- public void Test05031 () {\r
+ public void Test05031 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "1234567890";\r
AssertEquals ("#01", "1234567890214,748,364,800.00 %", Int32.MinValue.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05032 () {\r
+ public void Test05032 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentNegativePattern = 0;\r
AssertEquals ("#01", "-214,748,364,800.00 %", Int32.MinValue.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05033 () {\r
+ public void Test05033 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentNegativePattern = 1;\r
AssertEquals ("#01", "-214,748,364,800.00%", Int32.MinValue.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05034 () {\r
+ public void Test05034 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentNegativePattern = 2;\r
AssertEquals ("#01", "-%214,748,364,800.00", Int32.MinValue.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05035 () {\r
+ public void Test05035 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentPositivePattern = 0;\r
AssertEquals ("#01", "-214,748,364,800.00 %", Int32.MinValue.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05036 () {\r
+ public void Test05036 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentPositivePattern = 1;\r
AssertEquals ("#01", "-214,748,364,800.00 %", Int32.MinValue.ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test05037 () {\r
+ public void Test05037 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentPositivePattern = 2;\r
AssertEquals ("#01", "-214,748,364,800.00 %", Int32.MinValue.ToString ("P", nfi));\r
// Test06000 - Int32 and R\r
[Test]\r
[ExpectedException (typeof (FormatException))]\r
- public void Test06000 () {\r
+ public void Test06000 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("R", _nfi));\r
}\r
\r
// Test07000- Int32 and X\r
[Test]\r
- public void Test07000 () {\r
+ public void Test07000 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("X", _nfi));\r
AssertEquals ("#02", "0", 0.ToString ("x", _nfi));\r
AssertEquals ("#03", "80000000", Int32.MinValue.ToString ("X", _nfi));\r
}\r
\r
[Test]\r
- public void Test07001 () {\r
+ public void Test07001 ()\r
+ {\r
AssertEquals ("#01", "X ", 0.ToString ("X ", _nfi));\r
AssertEquals ("#02", " X", 0.ToString (" X", _nfi));\r
AssertEquals ("#03", " X ", 0.ToString (" X ", _nfi));\r
}\r
\r
[Test]\r
- public void Test07002 () {\r
+ public void Test07002 ()\r
+ {\r
AssertEquals ("#01", "-X ", (-1).ToString ("X ", _nfi));\r
AssertEquals ("#02", "- X", (-1).ToString (" X", _nfi));\r
AssertEquals ("#03", "- X ", (-1).ToString (" X ", _nfi));\r
}\r
\r
[Test]\r
- public void Test07003 () {\r
+ public void Test07003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("X0", _nfi));\r
AssertEquals ("#02", "0000000000", 0.ToString ("X10", _nfi));\r
AssertEquals ("#03", "00000000000", 0.ToString ("X11", _nfi));\r
}\r
\r
[Test]\r
- public void Test07004 () {\r
+ public void Test07004 ()\r
+ {\r
AssertEquals ("#01", "7FFFFFFF", Int32.MaxValue.ToString ("X0", _nfi));\r
AssertEquals ("#02", "007FFFFFFF", Int32.MaxValue.ToString ("X10", _nfi));\r
AssertEquals ("#03", "0007FFFFFFF", Int32.MaxValue.ToString ("X11", _nfi));\r
}\r
\r
[Test]\r
- public void Test07005 () {\r
+ public void Test07005 ()\r
+ {\r
AssertEquals ("#01", "80000000", Int32.MinValue.ToString ("X0", _nfi));\r
AssertEquals ("#02", "0080000000", Int32.MinValue.ToString ("X10", _nfi));\r
AssertEquals ("#03", "00080000000", Int32.MinValue.ToString ("X11", _nfi));\r
}\r
\r
[Test]\r
- public void Test07006 () {\r
+ public void Test07006 ()\r
+ {\r
AssertEquals ("#01", "XF", 0.ToString ("XF", _nfi));\r
AssertEquals ("#02", "X0F", 0.ToString ("X0F", _nfi));\r
AssertEquals ("#03", "X0xF", 0.ToString ("X0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test07007 () {\r
+ public void Test07007 ()\r
+ {\r
AssertEquals ("#01", "XF", Int32.MaxValue.ToString ("XF", _nfi));\r
AssertEquals ("#02", "X2147483647F", Int32.MaxValue.ToString ("X0F", _nfi));\r
AssertEquals ("#03", "X2147483647xF", Int32.MaxValue.ToString ("X0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test07008 () {\r
+ public void Test07008 ()\r
+ {\r
AssertEquals ("#01", "-XF", Int32.MinValue.ToString ("XF", _nfi));\r
AssertEquals ("#02", "-X2147483648F", Int32.MinValue.ToString ("X0F", _nfi));\r
AssertEquals ("#03", "-X2147483648xF", Int32.MinValue.ToString ("X0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test07009 () {\r
+ public void Test07009 ()\r
+ {\r
AssertEquals ("#01", "00000000000", 0.ToString ("X0000000000000000000000000000000000000011", _nfi));\r
AssertEquals ("#02", "0007FFFFFFF", Int32.MaxValue.ToString ("X0000000000000000000000000000000000000011", _nfi));\r
AssertEquals ("#03", "00080000000", Int32.MinValue.ToString ("X0000000000000000000000000000000000000011", _nfi));\r
}\r
\r
[Test]\r
- public void Test07010 () {\r
+ public void Test07010 ()\r
+ {\r
AssertEquals ("#01", "+X", 0.ToString ("+X", _nfi));\r
AssertEquals ("#02", "X+", 0.ToString ("X+", _nfi));\r
AssertEquals ("#03", "+X+", 0.ToString ("+X+", _nfi));\r
}\r
\r
[Test]\r
- public void Test07011 () {\r
+ public void Test07011 ()\r
+ {\r
AssertEquals ("#01", "+X", Int32.MaxValue.ToString ("+X", _nfi));\r
AssertEquals ("#02", "X+", Int32.MaxValue.ToString ("X+", _nfi));\r
AssertEquals ("#03", "+X+", Int32.MaxValue.ToString ("+X+", _nfi));\r
}\r
\r
[Test]\r
- public void Test07012 () {\r
+ public void Test07012 ()\r
+ {\r
AssertEquals ("#01", "-+X", Int32.MinValue.ToString ("+X", _nfi));\r
AssertEquals ("#02", "-X+", Int32.MinValue.ToString ("X+", _nfi));\r
AssertEquals ("#03", "-+X+", Int32.MinValue.ToString ("+X+", _nfi));\r
}\r
\r
[Test]\r
- public void Test07013 () {\r
+ public void Test07013 ()\r
+ {\r
AssertEquals ("#01", "-X", 0.ToString ("-X", _nfi));\r
AssertEquals ("#02", "X-", 0.ToString ("X-", _nfi));\r
AssertEquals ("#03", "-X-", 0.ToString ("-X-", _nfi));\r
}\r
\r
[Test]\r
- public void Test07014 () {\r
+ public void Test07014 ()\r
+ {\r
AssertEquals ("#01", "-X", Int32.MaxValue.ToString ("-X", _nfi));\r
AssertEquals ("#02", "X-", Int32.MaxValue.ToString ("X-", _nfi));\r
AssertEquals ("#03", "-X-", Int32.MaxValue.ToString ("-X-", _nfi));\r
}\r
\r
[Test]\r
- public void Test07015 () {\r
+ public void Test07015 ()\r
+ {\r
AssertEquals ("#01", "--X", Int32.MinValue.ToString ("-X", _nfi));\r
AssertEquals ("#02", "-X-", Int32.MinValue.ToString ("X-", _nfi));\r
AssertEquals ("#03", "--X-", Int32.MinValue.ToString ("-X-", _nfi));\r
}\r
\r
[Test]\r
- public void Test07016 () {\r
+ public void Test07016 ()\r
+ {\r
AssertEquals ("#01", "X+0", 0.ToString ("X+0", _nfi));\r
AssertEquals ("#02", "X+2147483647", Int32.MaxValue.ToString ("X+0", _nfi));\r
AssertEquals ("#03", "-X+2147483648", Int32.MinValue.ToString ("X+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test07017 () {\r
+ public void Test07017 ()\r
+ {\r
AssertEquals ("#01", "X+9", 0.ToString ("X+9", _nfi));\r
AssertEquals ("#02", "X+9", Int32.MaxValue.ToString ("X+9", _nfi));\r
AssertEquals ("#03", "-X+9", Int32.MinValue.ToString ("X+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test07018 () {\r
+ public void Test07018 ()\r
+ {\r
AssertEquals ("#01", "X-9", 0.ToString ("X-9", _nfi));\r
AssertEquals ("#02", "X-9", Int32.MaxValue.ToString ("X-9", _nfi));\r
AssertEquals ("#03", "-X-9", Int32.MinValue.ToString ("X-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test07019 () {\r
+ public void Test07019 ()\r
+ {\r
AssertEquals ("#01", "X0", 0.ToString ("X0,", _nfi));\r
AssertEquals ("#02", "X2147484", Int32.MaxValue.ToString ("X0,", _nfi));\r
AssertEquals ("#03", "-X2147484", Int32.MinValue.ToString ("X0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test07020 () {\r
+ public void Test07020 ()\r
+ {\r
AssertEquals ("#01", "X0", 0.ToString ("X0.", _nfi));\r
AssertEquals ("#02", "X2147483647", Int32.MaxValue.ToString ("X0.", _nfi));\r
AssertEquals ("#03", "-X2147483648", Int32.MinValue.ToString ("X0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test07021 () {\r
+ public void Test07021 ()\r
+ {\r
AssertEquals ("#01", "X0.0", 0.ToString ("X0.0", _nfi));\r
AssertEquals ("#02", "X2147483647.0", Int32.MaxValue.ToString ("X0.0", _nfi));\r
AssertEquals ("#03", "-X2147483648.0", Int32.MinValue.ToString ("X0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test07022 () {\r
+ public void Test07022 ()\r
+ {\r
AssertEquals ("#01", "X09", 0.ToString ("X0.9", _nfi));\r
AssertEquals ("#02", "X21474836479", Int32.MaxValue.ToString ("X0.9", _nfi));\r
AssertEquals ("#03", "-X21474836489", Int32.MinValue.ToString ("X0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test08000 () {\r
+ public void Test08000 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("0", _nfi));\r
AssertEquals ("#02", "2147483647", Int32.MaxValue.ToString ("0", _nfi));\r
AssertEquals ("#03", "-2147483648", Int32.MinValue.ToString ("0", _nfi));\r
\r
// Test08000 - Int32 and Custom\r
[Test]\r
- public void Test08001 () {\r
+ public void Test08001 ()\r
+ {\r
AssertEquals ("#01", "00000000000", 0.ToString ("00000000000", _nfi));\r
AssertEquals ("#02", "02147483647", Int32.MaxValue.ToString ("00000000000", _nfi));\r
AssertEquals ("#03", "-02147483648", Int32.MinValue.ToString ("00000000000", _nfi));\r
}\r
\r
[Test]\r
- public void Test08002 () {\r
+ public void Test08002 ()\r
+ {\r
AssertEquals ("#01", " 00000000000 ", 0.ToString (" 00000000000 ", _nfi));\r
AssertEquals ("#02", " 02147483647 ", Int32.MaxValue.ToString (" 00000000000 ", _nfi));\r
AssertEquals ("#03", "- 02147483648 ", Int32.MinValue.ToString (" 00000000000 ", _nfi));\r
}\r
\r
[Test]\r
- public void Test08003 () {\r
+ public void Test08003 ()\r
+ {\r
AssertEquals ("#01", "", 0.ToString ("#", _nfi));\r
AssertEquals ("#02", "2147483647", Int32.MaxValue.ToString ("#", _nfi));\r
AssertEquals ("#03", "-2147483648", Int32.MinValue.ToString ("#", _nfi));\r
}\r
\r
[Test]\r
- public void Test08004 () {\r
+ public void Test08004 ()\r
+ {\r
AssertEquals ("#01", "", 0.ToString ("##########", _nfi));\r
AssertEquals ("#02", "2147483647", Int32.MaxValue.ToString ("##########", _nfi));\r
AssertEquals ("#03", "-2147483648", Int32.MinValue.ToString ("##########", _nfi));\r
}\r
\r
[Test]\r
- public void Test08005 () {\r
+ public void Test08005 ()\r
+ {\r
AssertEquals ("#01", " ", 0.ToString (" ########## ", _nfi));\r
AssertEquals ("#02", " 2147483647 ", Int32.MaxValue.ToString (" ########## ", _nfi));\r
AssertEquals ("#03", "- 2147483648 ", Int32.MinValue.ToString (" ########## ", _nfi));\r
}\r
\r
[Test]\r
- public void Test08006 () {\r
+ public void Test08006 ()\r
+ {\r
AssertEquals ("#01", "", 0.ToString (".", _nfi));\r
AssertEquals ("#02", "", Int32.MaxValue.ToString (".", _nfi));\r
AssertEquals ("#03", "-", Int32.MinValue.ToString (".", _nfi));\r
}\r
\r
[Test]\r
- public void Test08007 () {\r
+ public void Test08007 ()\r
+ {\r
AssertEquals ("#01", "00000000000", 0.ToString ("00000000000.", _nfi));\r
AssertEquals ("#02", "02147483647", Int32.MaxValue.ToString ("00000000000.", _nfi));\r
AssertEquals ("#03", "-02147483648", Int32.MinValue.ToString ("00000000000.", _nfi));\r
}\r
\r
[Test]\r
- public void Test08008 () {\r
+ public void Test08008 ()\r
+ {\r
AssertEquals ("#01", ".00000000000", 0.ToString (".00000000000", _nfi));\r
AssertEquals ("#02", "2147483647.00000000000", Int32.MaxValue.ToString (".00000000000", _nfi));\r
AssertEquals ("#03", "-2147483648.00000000000", Int32.MinValue.ToString (".00000000000", _nfi));\r
}\r
\r
[Test]\r
- public void Test08009 () {\r
+ public void Test08009 ()\r
+ {\r
AssertEquals ("#01", "00000000000.00000000000", 0.ToString ("00000000000.00000000000", _nfi));\r
AssertEquals ("#02", "02147483647.00000000000", Int32.MaxValue.ToString ("00000000000.00000000000", _nfi));\r
AssertEquals ("#03", "-02147483648.00000000000", Int32.MinValue.ToString ("00000000000.00000000000", _nfi));\r
}\r
\r
[Test]\r
- public void Test08010 () {\r
+ public void Test08010 ()\r
+ {\r
AssertEquals ("#01", "00.0000000000", 0.ToString ("00.0.00.000.0000", _nfi));\r
AssertEquals ("#02", "01.0000000000", 1.ToString ("00.0.00.000.0000", _nfi));\r
AssertEquals ("#03", "-01.0000000000", (-1).ToString ("00.0.00.000.0000", _nfi));\r
}\r
\r
[Test]\r
- public void Test08011 () {\r
+ public void Test08011 ()\r
+ {\r
AssertEquals ("#01", "", 0.ToString ("##.#.##.###.####", _nfi));\r
AssertEquals ("#02", "1", 1.ToString ("##.#.##.###.####", _nfi));\r
AssertEquals ("#03", "-1", (-1).ToString ("##.#.##.###.####", _nfi));\r
}\r
\r
- public void Test08012 () {\r
+ [Test]\r
+ public void Test08012 ()\r
+ {\r
AssertEquals ("#01", "00", 0.ToString ("0#.#.##.###.####", _nfi));\r
AssertEquals ("#02", "01", 1.ToString ("0#.#.##.###.####", _nfi));\r
AssertEquals ("#03", "-01", (-1).ToString ("0#.#.##.###.####", _nfi));\r
}\r
\r
- public void Test08013 () {\r
+ [Test]\r
+ public void Test08013 ()\r
+ {\r
AssertEquals ("#01", "0", 0.ToString ("#0.#.##.###.####", _nfi));\r
AssertEquals ("#02", "1", 1.ToString ("#0.#.##.###.####", _nfi));\r
AssertEquals ("#03", "-1", (-1).ToString ("#0.#.##.###.####", _nfi));\r
}\r
\r
- public void Test08014 () {\r
+ [Test]\r
+ public void Test08014 ()\r
+ {\r
AssertEquals ("#01", ".0000000000", 0.ToString ("##.#.##.###.###0", _nfi));\r
AssertEquals ("#02", "1.0000000000", 1.ToString ("##.#.##.###.###0", _nfi));\r
AssertEquals ("#03", "-1.0000000000", (-1).ToString ("##.#.##.###.###0", _nfi));\r
}\r
\r
- public void Test08015 () {\r
+ [Test]\r
+ public void Test08015 ()\r
+ {\r
AssertEquals ("#01", ".000000000", 0.ToString ("##.#.##.###.##0#", _nfi));\r
AssertEquals ("#02", "1.000000000", 1.ToString ("##.#.##.###.##0#", _nfi));\r
AssertEquals ("#03", "-1.000000000", (-1).ToString ("##.#.##.###.##0#", _nfi));\r
}\r
\r
- public void Test08016 () {\r
+ [Test]\r
+ public void Test08016 ()\r
+ {\r
AssertEquals ("#01", ".000000000", 0.ToString ("##.#.##.##0.##0#", _nfi));\r
AssertEquals ("#02", "1.000000000", 1.ToString ("##.#.##.##0.##0#", _nfi));\r
AssertEquals ("#03", "-1.000000000", (-1).ToString ("##.#.##.##0.##0#", _nfi));\r
}\r
\r
- public void Test08017 () {\r
+ [Test]\r
+ public void Test08017 ()\r
+ {\r
AssertEquals ("#01", "0.000000000", 0.ToString ("#0.#.##.##0.##0#", _nfi));\r
AssertEquals ("#02", "1.000000000", 1.ToString ("#0.#.##.##0.##0#", _nfi));\r
AssertEquals ("#03", "-1.000000000", (-1).ToString ("#0.#.##.##0.##0#", _nfi));\r
}\r
\r
- public void Test08018 () {\r
+ [Test]\r
+ public void Test08018 ()\r
+ {\r
AssertEquals ("#01", "-0002147484", Int32.MinValue.ToString ("0000000000,", _nfi));\r
AssertEquals ("#02", "-0000002147", Int32.MinValue.ToString ("0000000000,,", _nfi));\r
AssertEquals ("#03", "-0000000002", Int32.MinValue.ToString ("0000000000,,,", _nfi));\r
AssertEquals ("#05", "0000000000", Int32.MinValue.ToString ("0000000000,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", _nfi));\r
}\r
\r
- public void Test08019 () {\r
+ [Test]\r
+ public void Test08019 ()\r
+ {\r
AssertEquals ("#01", "-2147483648", Int32.MinValue.ToString (",0000000000", _nfi));\r
}\r
\r
- public void Test08020 () {\r
+ [Test]\r
+ public void Test08020 ()\r
+ {\r
AssertEquals ("#01", "-0002147484", Int32.MinValue.ToString (",0000000000,", _nfi));\r
}\r
\r
- public void Test08021 () {\r
+ [Test]\r
+ public void Test08021 ()\r
+ {\r
AssertEquals ("#01", "-02,147,483,648", Int32.MinValue.ToString ("0,0000000000", _nfi));\r
}\r
\r
- public void Test08022 () {\r
+ [Test]\r
+ public void Test08022 ()\r
+ {\r
AssertEquals ("#01", "-02,147,483,648", Int32.MinValue.ToString ("0000000000,0", _nfi));\r
}\r
\r
- public void Test08023 () {\r
+ [Test]\r
+ public void Test08023 ()\r
+ {\r
AssertEquals ("#01", "-02,147,483,648", Int32.MinValue.ToString ("0,0,0,0,0,0,0,0,0,0,0", _nfi));\r
}\r
\r
- public void Test08024 () {\r
+ [Test]\r
+ public void Test08024 ()\r
+ {\r
AssertEquals ("#01", "-02,147,483,648", Int32.MinValue.ToString (",0,0,0,0,0,0,0,0,0,0,0", _nfi));\r
}\r
\r
- public void Test08025 () {\r
+ [Test]\r
+ public void Test08025 ()\r
+ {\r
AssertEquals ("#01", "-00,002,147,484", Int32.MinValue.ToString ("0,0,0,0,0,0,0,0,0,0,0,", _nfi));\r
}\r
\r
- public void Test08026 () {\r
+ [Test]\r
+ public void Test08026 ()\r
+ {\r
AssertEquals ("#01", "-00,002,147,484", Int32.MinValue.ToString (",0,0,0,0,0,0,0,0,0,0,0,", _nfi));\r
}\r
\r
- public void Test08027 () {\r
+ [Test]\r
+ public void Test08027 ()\r
+ {\r
AssertEquals ("#01", "-", Int32.MinValue.ToString (",", _nfi));\r
}\r
\r
- public void Test08028 () {\r
+ [Test]\r
+ public void Test08028 ()\r
+ {\r
AssertEquals ("#01", "-2147483648", Int32.MinValue.ToString (",##########", _nfi));\r
}\r
\r
- public void Test08029 () {\r
+ [Test]\r
+ public void Test08029 ()\r
+ {\r
AssertEquals ("#01", "-2147484", Int32.MinValue.ToString (",##########,", _nfi));\r
}\r
\r
- public void Test08030 () {\r
+ [Test]\r
+ public void Test08030 ()\r
+ {\r
AssertEquals ("#01", "-2,147,483,648", Int32.MinValue.ToString ("#,##########", _nfi));\r
}\r
\r
- public void Test08031 () {\r
+ [Test]\r
+ public void Test08031 ()\r
+ {\r
AssertEquals ("#01", "-2,147,483,648", Int32.MinValue.ToString ("##########,#", _nfi));\r
}\r
\r
- public void Test08032 () {\r
+ [Test]\r
+ public void Test08032 ()\r
+ {\r
AssertEquals ("#01", "-2,147,483,648", Int32.MinValue.ToString ("#,#,#,#,#,#,#,#,#,#,#", _nfi));\r
}\r
\r
- public void Test08033 () {\r
+ [Test]\r
+ public void Test08033 ()\r
+ {\r
AssertEquals ("#01", "-2,147,483,648", Int32.MinValue.ToString (",#,#,#,#,#,#,#,#,#,#,#", _nfi));\r
}\r
\r
- public void Test08034 () {\r
+ [Test]\r
+ public void Test08034 ()\r
+ {\r
AssertEquals ("#01", "-2,147,484", Int32.MinValue.ToString ("#,#,#,#,#,#,#,#,#,#,#,", _nfi));\r
}\r
\r
- public void Test08035 () {\r
+ [Test]\r
+ public void Test08035 ()\r
+ {\r
AssertEquals ("#01", "-2,147,484", Int32.MinValue.ToString (",#,#,#,#,#,#,#,#,#,#,#,", _nfi));\r
}\r
\r
- public void Test08036 () {\r
+ [Test]\r
+ public void Test08036 ()\r
+ {\r
AssertEquals ("#01", "-1", (-1000).ToString ("##########,", _nfi));\r
}\r
- public void Test08037 () {\r
+\r
+ [Test]\r
+ public void Test08037 ()\r
+ {\r
AssertEquals ("#01", "", (-100).ToString ("##########,", _nfi));\r
}\r
\r
- public void Test08038 () {\r
+ [Test]\r
+ public void Test08038 ()\r
+ {\r
AssertEquals ("#01", "-%", Int32.MinValue.ToString ("%", _nfi));\r
}\r
\r
- public void Test08039 () {\r
+ [Test]\r
+ public void Test08039 ()\r
+ {\r
AssertEquals ("#01", "-214748364800%", Int32.MinValue.ToString ("0%", _nfi));\r
}\r
\r
- public void Test08040 () {\r
+ [Test]\r
+ public void Test08040 ()\r
+ {\r
AssertEquals ("#01", "-%214748364800", Int32.MinValue.ToString ("%0", _nfi));\r
}\r
\r
- public void Test08041 () {\r
+ [Test]\r
+ public void Test08041 ()\r
+ {\r
AssertEquals ("#01", "-%21474836480000%", Int32.MinValue.ToString ("%0%", _nfi));\r
}\r
\r
- public void Test08042 () {\r
+ [Test]\r
+ public void Test08042 ()\r
+ {\r
AssertEquals ("#01", "- % 21474836480000 % ", Int32.MinValue.ToString (" % 0 % ", _nfi));\r
}\r
\r
- public void Test08043 () {\r
+ [Test]\r
+ public void Test08043 ()\r
+ {\r
AssertEquals ("#01", "-214748365%", Int32.MinValue.ToString ("0%,", _nfi));\r
}\r
\r
- public void Test08044 () {\r
+ [Test]\r
+ public void Test08044 ()\r
+ {\r
AssertEquals ("#01", "-214748365%", Int32.MinValue.ToString ("0,%", _nfi));\r
}\r
\r
- public void Test08045 () {\r
+ [Test]\r
+ public void Test08045 ()\r
+ {\r
AssertEquals ("#01", "-%214748364800", Int32.MinValue.ToString (",%0", _nfi));\r
}\r
\r
- public void Test08046 () {\r
+ [Test]\r
+ public void Test08046 ()\r
+ {\r
AssertEquals ("#01", "-%214748364800", Int32.MinValue.ToString ("%,0", _nfi));\r
}\r
\r
- public void Test08047 () {\r
+ [Test]\r
+ public void Test08047 ()\r
+ {\r
AssertEquals ("#01", "-2147483648%%%%%%", Int32.MinValue.ToString ("0,,,,%%%%%%", _nfi));\r
}\r
\r
- public void Test08048 () {\r
+ [Test]\r
+ public void Test08048 ()\r
+ {\r
AssertEquals ("#01", "-2147483648%%%%%%", Int32.MinValue.ToString ("0%%%%%%,,,,", _nfi));\r
}\r
\r
- public void Test08049 () {\r
+ [Test]\r
+ public void Test08049 ()\r
+ {\r
AssertEquals ("#01", "-%%%%%%2147483648", Int32.MinValue.ToString ("%%%%%%0,,,,", _nfi));\r
}\r
\r
- public void Test08050 () {\r
+ [Test]\r
+ public void Test08050 ()\r
+ {\r
AssertEquals ("#01", "E+0", Int32.MinValue.ToString ("E+0", _nfi));\r
AssertEquals ("#02", "e+0", Int32.MinValue.ToString ("e+0", _nfi));\r
AssertEquals ("#03", "E0", Int32.MinValue.ToString ("E-0", _nfi));\r
AssertEquals ("#04", "e0", Int32.MinValue.ToString ("e-0", _nfi));\r
}\r
\r
- public void Test08051 () {\r
+ [Test]\r
+ public void Test08051 ()\r
+ {\r
AssertEquals ("#01", "-2E+9", Int32.MinValue.ToString ("0E+0", _nfi));\r
AssertEquals ("#02", "-2e+9", Int32.MinValue.ToString ("0e+0", _nfi));\r
AssertEquals ("#03", "-2E9", Int32.MinValue.ToString ("0E-0", _nfi));\r
AssertEquals ("#06", "-2e9", Int32.MinValue.ToString ("0e0", _nfi));\r
}\r
\r
- public void Test08052 () {\r
+ [Test]\r
+ public void Test08052 ()\r
+ {\r
AssertEquals ("#01", "-2E+9", Int32.MinValue.ToString ("#E+0", _nfi));\r
AssertEquals ("#02", "-2e+9", Int32.MinValue.ToString ("#e+0", _nfi));\r
AssertEquals ("#03", "-2E9", Int32.MinValue.ToString ("#E-0", _nfi));\r
AssertEquals ("#06", "-2e9", Int32.MinValue.ToString ("#e0", _nfi));\r
}\r
\r
- public void Test08053 () {\r
+ [Test]\r
+ public void Test08053 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E+0", Int32.MinValue.ToString ("0000000000E+0", _nfi));\r
AssertEquals ("#02", "-2147483648e+0", Int32.MinValue.ToString ("0000000000e+0", _nfi));\r
AssertEquals ("#03", "-2147483648E0", Int32.MinValue.ToString ("0000000000E-0", _nfi));\r
AssertEquals ("#06", "-2147483648e0", Int32.MinValue.ToString ("0000000000e0", _nfi));\r
}\r
\r
- public void Test08054 () {\r
+ [Test]\r
+ public void Test08054 ()\r
+ {\r
AssertEquals ("#01", "-21474836480E-1", Int32.MinValue.ToString ("00000000000E+0", _nfi));\r
AssertEquals ("#02", "-21474836480e-1", Int32.MinValue.ToString ("00000000000e+0", _nfi));\r
AssertEquals ("#03", "-21474836480E-1", Int32.MinValue.ToString ("00000000000E-0", _nfi));\r
AssertEquals ("#06", "-21474836480e-1", Int32.MinValue.ToString ("00000000000e0", _nfi));\r
}\r
\r
- public void Test08055 () {\r
+ [Test]\r
+ public void Test08055 ()\r
+ {\r
AssertEquals ("#01", "-214748365E+1", Int32.MinValue.ToString ("000000000E+0", _nfi));\r
AssertEquals ("#02", "-214748365e+1", Int32.MinValue.ToString ("000000000e+0", _nfi));\r
AssertEquals ("#03", "-214748365E1", Int32.MinValue.ToString ("000000000E-0", _nfi));\r
AssertEquals ("#06", "-214748365e1", Int32.MinValue.ToString ("000000000e0", _nfi));\r
}\r
\r
- public void Test08056 () {\r
+ [Test]\r
+ public void Test08056 ()\r
+ {\r
AssertEquals ("#01", "-21474836E+2", Int32.MinValue.ToString ("00000000E+0", _nfi));\r
AssertEquals ("#02", "-21474836e+2", Int32.MinValue.ToString ("00000000e+0", _nfi));\r
AssertEquals ("#03", "-21474836E2", Int32.MinValue.ToString ("00000000E-0", _nfi));\r
AssertEquals ("#06", "-21474836e2", Int32.MinValue.ToString ("00000000e0", _nfi));\r
}\r
\r
- public void Test08057 () {\r
+ [Test]\r
+ public void Test08057 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E+00", Int32.MinValue.ToString ("0000000000E+00", _nfi));\r
AssertEquals ("#02", "-2147483648e+00", Int32.MinValue.ToString ("0000000000e+00", _nfi));\r
AssertEquals ("#03", "-2147483648E00", Int32.MinValue.ToString ("0000000000E-00", _nfi));\r
AssertEquals ("#06", "-2147483648e00", Int32.MinValue.ToString ("0000000000e00", _nfi));\r
}\r
\r
- public void Test08058 () {\r
+ [Test]\r
+ public void Test08058 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E+02%", Int32.MinValue.ToString ("0000000000E+00%", _nfi));\r
AssertEquals ("#02", "-2147483648e+02%", Int32.MinValue.ToString ("0000000000e+00%", _nfi));\r
AssertEquals ("#03", "-2147483648E02%", Int32.MinValue.ToString ("0000000000E-00%", _nfi));\r
AssertEquals ("#06", "-2147483648e02%", Int32.MinValue.ToString ("0000000000e00%", _nfi));\r
}\r
\r
- public void Test08059 () {\r
+ [Test]\r
+ public void Test08059 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E+10%%%%%", Int32.MinValue.ToString ("0000000000E+00%%%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e+10%%%%%", Int32.MinValue.ToString ("0000000000e+00%%%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E10%%%%%", Int32.MinValue.ToString ("0000000000E-00%%%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e10%%%%%", Int32.MinValue.ToString ("0000000000e00%%%%%", _nfi));\r
}\r
\r
- public void Test08060 () {\r
+ [Test]\r
+ public void Test08060 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-03", Int32.MinValue.ToString ("0000000000E+00,", _nfi));\r
AssertEquals ("#02", "-2147483648e-03", Int32.MinValue.ToString ("0000000000e+00,", _nfi));\r
AssertEquals ("#03", "-2147483648E-03", Int32.MinValue.ToString ("0000000000E-00,", _nfi));\r
AssertEquals ("#06", "-2147483648e-03", Int32.MinValue.ToString ("0000000000e00,", _nfi));\r
}\r
\r
- public void Test08061 () {\r
+ [Test]\r
+ public void Test08061 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-12", Int32.MinValue.ToString ("0000000000E+00,,,,", _nfi));\r
AssertEquals ("#02", "-2147483648e-12", Int32.MinValue.ToString ("0000000000e+00,,,,", _nfi));\r
AssertEquals ("#03", "-2147483648E-12", Int32.MinValue.ToString ("0000000000E-00,,,,", _nfi));\r
AssertEquals ("#06", "-2147483648e-12", Int32.MinValue.ToString ("0000000000e00,,,,", _nfi));\r
}\r
\r
- public void Test08062 () {\r
+ [Test]\r
+ public void Test08062 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-04%%%%", Int32.MinValue.ToString ("0000000000E+00,,,,%%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e-04%%%%", Int32.MinValue.ToString ("0000000000e+00,,,,%%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E-04%%%%", Int32.MinValue.ToString ("0000000000E-00,,,,%%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e-04%%%%", Int32.MinValue.ToString ("0000000000e00,,,,%%%%", _nfi));\r
}\r
\r
- public void Test08063 () {\r
+ [Test]\r
+ public void Test08063 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-07%%%%", Int32.MinValue.ToString ("0000000000,E+00,,,,%%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e-07%%%%", Int32.MinValue.ToString ("0000000000,e+00,,,,%%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E-07%%%%", Int32.MinValue.ToString ("0000000000,E-00,,,,%%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e-07%%%%", Int32.MinValue.ToString ("0000000000,e00,,,,%%%%", _nfi));\r
}\r
\r
- public void Test08064 () {\r
+ [Test]\r
+ public void Test08064 ()\r
+ {\r
AssertEquals ("#01", "-000,000,214,7E+48%%%%", Int32.MinValue.ToString ("0000000000,E,+00,,,,%%%%", _nfi));\r
AssertEquals ("#02", "-000,000,214,7e+48%%%%", Int32.MinValue.ToString ("0000000000,e,+00,,,,%%%%", _nfi));\r
AssertEquals ("#03", "-000,000,214,7E-48%%%%", Int32.MinValue.ToString ("0000000000,E,-00,,,,%%%%", _nfi));\r
AssertEquals ("#06", "-000,000,214,7e48%%%%", Int32.MinValue.ToString ("0000000000,e,00,,,,%%%%", _nfi));\r
}\r
\r
- public void Test08065 () {\r
+ [Test]\r
+ public void Test08065 ()\r
+ {\r
AssertEquals ("#01", "-000,000,214,7E+48%%%%", Int32.MinValue.ToString ("0000000000,E+,00,,,,%%%%", _nfi));\r
AssertEquals ("#02", "-000,000,214,7e+48%%%%", Int32.MinValue.ToString ("0000000000,e+,00,,,,%%%%", _nfi));\r
AssertEquals ("#03", "-000,000,214,7E-48%%%%", Int32.MinValue.ToString ("0000000000,E-,00,,,,%%%%", _nfi));\r
AssertEquals ("#04", "-000,000,214,7e-48%%%%", Int32.MinValue.ToString ("0000000000,e-,00,,,,%%%%", _nfi));\r
}\r
\r
- public void Test08066 () {\r
+ [Test]\r
+ public void Test08066 ()\r
+ {\r
AssertEquals ("#01", "-21,474,836,48E-50%%%%", Int32.MinValue.ToString ("0000000000,E+0,0,,,,%%%%", _nfi));\r
AssertEquals ("#02", "-21,474,836,48e-50%%%%", Int32.MinValue.ToString ("0000000000,e+0,0,,,,%%%%", _nfi));\r
AssertEquals ("#03", "-21,474,836,48E-50%%%%", Int32.MinValue.ToString ("0000000000,E-0,0,,,,%%%%", _nfi));\r
AssertEquals ("#06", "-21,474,836,48e-50%%%%", Int32.MinValue.ToString ("0000000000,e0,0,,,,%%%%", _nfi));\r
}\r
\r
- public void Test08067 () {\r
+ [Test]\r
+ public void Test08067 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-01,%%%%", Int32.MinValue.ToString (@"0000000000E+00\,,,,%%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e-01,%%%%", Int32.MinValue.ToString (@"0000000000e+00\,,,,%%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E-01,%%%%", Int32.MinValue.ToString (@"0000000000E-00\,,,,%%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e-01,%%%%", Int32.MinValue.ToString (@"0000000000e00\,,,,%%%%", _nfi));\r
}\r
\r
- public void Test08068 () {\r
+ [Test]\r
+ public void Test08068 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E+02,,%%%%", Int32.MinValue.ToString (@"0000000000E+00\,,,\,%%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e+02,,%%%%", Int32.MinValue.ToString (@"0000000000e+00\,,,\,%%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E02,,%%%%", Int32.MinValue.ToString (@"0000000000E-00\,,,\,%%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e02,,%%%%", Int32.MinValue.ToString (@"0000000000e00\,,,\,%%%%", _nfi));\r
}\r
\r
- public void Test08069 () {\r
+ [Test]\r
+ public void Test08069 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E+00,,%%%%", Int32.MinValue.ToString (@"0000000000E+00\,,,\,\%%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e+00,,%%%%", Int32.MinValue.ToString (@"0000000000e+00\,,,\,\%%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E00,,%%%%", Int32.MinValue.ToString (@"0000000000E-00\,,,\,\%%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e00,,%%%%", Int32.MinValue.ToString (@"0000000000e00\,,,\,\%%%%", _nfi));\r
}\r
\r
- public void Test08070 () {\r
+ [Test]\r
+ public void Test08070 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-02,,%%%%", Int32.MinValue.ToString (@"0000000000E+00\,,,\,\%%%\%", _nfi));\r
AssertEquals ("#02", "-2147483648e-02,,%%%%", Int32.MinValue.ToString (@"0000000000e+00\,,,\,\%%%\%", _nfi));\r
AssertEquals ("#03", "-2147483648E-02,,%%%%", Int32.MinValue.ToString (@"0000000000E-00\,,,\,\%%%\%", _nfi));\r
AssertEquals ("#06", "-2147483648e-02,,%%%%", Int32.MinValue.ToString (@"0000000000e00\,,,\,\%%%\%", _nfi));\r
}\r
\r
- public void Test08071 () {\r
+ [Test]\r
+ public void Test08071 ()\r
+ {\r
AssertEquals ("#01", @"-2147483648E-04\\\%%%\%", Int32.MinValue.ToString (@"0000000000E+00\\,,,\\,\\%%%\\%", _nfi));\r
AssertEquals ("#02", @"-2147483648e-04\\\%%%\%", Int32.MinValue.ToString (@"0000000000e+00\\,,,\\,\\%%%\\%", _nfi));\r
AssertEquals ("#03", @"-2147483648E-04\\\%%%\%", Int32.MinValue.ToString (@"0000000000E-00\\,,,\\,\\%%%\\%", _nfi));\r
AssertEquals ("#06", @"-2147483648e-04\\\%%%\%", Int32.MinValue.ToString (@"0000000000e00\\,,,\\,\\%%%\\%", _nfi));\r
}\r
\r
- public void Test08072 () {\r
+ [Test]\r
+ public void Test08072 ()\r
+ {\r
AssertEquals ("#01", @"-2147483648E+00\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000E+00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#02", @"-2147483648e+00\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000e+00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#03", @"-2147483648E00\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000E-00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#06", @"-2147483648e00\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000e00\\,\,,\\\,\\%%%\\\%", _nfi));\r
}\r
\r
- public void Test08073 () {\r
+ [Test]\r
+ public void Test08073 ()\r
+ {\r
AssertEquals ("#01", @"-0021474836E+48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000\E+00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#02", @"-0021474836e+48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000\e+00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#03", @"-0021474836E-48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000\E-00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#06", @"-0021474836e48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000\e00\\,\,,\\\,\\%%%\\\%", _nfi));\r
}\r
\r
- public void Test08074 () {\r
+ [Test]\r
+ public void Test08074 ()\r
+ {\r
AssertEquals ("#01", @"-0021474836E+48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000E\+00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#02", @"-0021474836e+48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000e\+00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#03", @"-0021474836E-48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000E\-00\\,\,,\\\,\\%%%\\\%", _nfi));\r
AssertEquals ("#04", @"-0021474836e-48\,\,\%%%\%", Int32.MinValue.ToString (@"0000000000e\-00\\,\,,\\\,\\%%%\\\%", _nfi));\r
}\r
\r
- public void Test08075 () {\r
+ [Test]\r
+ public void Test08075 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-03,%%%%", Int32.MinValue.ToString ("0000000000E+00,,,',%'%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e-03,%%%%", Int32.MinValue.ToString ("0000000000e+00,,,',%'%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E-03,%%%%", Int32.MinValue.ToString ("0000000000E-00,,,',%'%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e-03,%%%%", Int32.MinValue.ToString ("0000000000e00,,,',%'%%%", _nfi));\r
}\r
\r
- public void Test08076 () {\r
+ [Test]\r
+ public void Test08076 ()\r
+ {\r
AssertEquals ("#01", "-2147483648E-03,%%%%", Int32.MinValue.ToString ("0000000000E+00,,,\",%\"%%%", _nfi));\r
AssertEquals ("#02", "-2147483648e-03,%%%%", Int32.MinValue.ToString ("0000000000e+00,,,\",%\"%%%", _nfi));\r
AssertEquals ("#03", "-2147483648E-03,%%%%", Int32.MinValue.ToString ("0000000000E-00,,,\",%\"%%%", _nfi));\r
AssertEquals ("#06", "-2147483648e-03,%%%%", Int32.MinValue.ToString ("0000000000e00,,,\",%\"%%%", _nfi));\r
}\r
\r
- public void Test08077 () {\r
+ [Test]\r
+ public void Test08077 ()\r
+ {\r
AssertEquals ("#01", "-", Int32.MinValue.ToString (";", _nfi));\r
AssertEquals ("#02", "", Int32.MaxValue.ToString (";", _nfi));\r
AssertEquals ("#03", "",0.ToString (";", _nfi));\r
}\r
\r
- public void Test08078 () {\r
+ [Test]\r
+ public void Test08078 ()\r
+ {\r
AssertEquals ("#01", "-2,147,483,648", Int32.MinValue.ToString ("#,#;", _nfi));\r
AssertEquals ("#02", "2,147,483,647", Int32.MaxValue.ToString ("#,#;", _nfi));\r
AssertEquals ("#03", "", 0.ToString ("#,#;", _nfi));\r
}\r
\r
- public void Test08079 () {\r
+ [Test]\r
+ public void Test08079 ()\r
+ {\r
AssertEquals ("#01", "2,147,483,648", Int32.MinValue.ToString (";#,#", _nfi));\r
AssertEquals ("#02", "", Int32.MaxValue.ToString (";#,#", _nfi));\r
AssertEquals ("#03", "", 0.ToString (";#,#", _nfi));\r
}\r
\r
- public void Test08080 () {\r
+ [Test]\r
+ public void Test08080 ()\r
+ {\r
AssertEquals ("#01", "2,147,483,648", Int32.MinValue.ToString ("0000000000,.0000000000;#,#", _nfi));\r
AssertEquals ("#02", "0002147483.6470000000", Int32.MaxValue.ToString ("0000000000,.0000000000;#,#", _nfi));\r
AssertEquals ("#03", "0000000000.0000000000", 0.ToString ("0000000000,.0000000000;#,#", _nfi));\r
}\r
\r
- public void Test08081 () {\r
+ [Test]\r
+ public void Test08081 ()\r
+ {\r
AssertEquals ("#01", "-", Int32.MinValue.ToString (";;", _nfi));\r
AssertEquals ("#02", "", Int32.MaxValue.ToString (";;", _nfi));\r
AssertEquals ("#03", "",0.ToString (";;", _nfi));\r
}\r
\r
- public void Test08082 () {\r
+ [Test]\r
+ public void Test08082 ()\r
+ {\r
AssertEquals ("#01", "-", Int32.MinValue.ToString (";;0%", _nfi));\r
AssertEquals ("#02", "", Int32.MaxValue.ToString (";;0%", _nfi));\r
AssertEquals ("#03", "0%",0.ToString (";;0%", _nfi));\r
}\r
\r
- public void Test08083 () {\r
+ [Test]\r
+ public void Test08083 ()\r
+ {\r
AssertEquals ("#01", "2147484", Int32.MinValue.ToString (";0,;0%", _nfi));\r
AssertEquals ("#02", "", Int32.MaxValue.ToString (";0,;0%", _nfi));\r
AssertEquals ("#03", "0%",0.ToString (";0,;0%", _nfi));\r
}\r
\r
- public void Test08084 () {\r
+ [Test]\r
+ public void Test08084 ()\r
+ {\r
AssertEquals ("#01", "2147484", Int32.MinValue.ToString ("0E+0;0,;0%", _nfi));\r
AssertEquals ("#02", "2E+9", Int32.MaxValue.ToString ("0E+0;0,;0%", _nfi));\r
AssertEquals ("#03", "0%",0.ToString ("0E+0;0,;0%", _nfi));\r
}\r
\r
- public void Test08085 () {\r
+ [Test]\r
+ public void Test08085 ()\r
+ {\r
AssertEquals ("#01", "214,748,364,80;0%", Int32.MinValue.ToString (@"0E+0;0,\;0%", _nfi));\r
AssertEquals ("#02", "2E+9", Int32.MaxValue.ToString (@"0E+0;0,\;0%", _nfi));\r
AssertEquals ("#03", "0E+0",0.ToString (@"0E+0;0,\;0%", _nfi));\r
}\r
\r
- public void Test08086 () {\r
+ [Test]\r
+ public void Test08086 ()\r
+ {\r
AssertEquals ("#01", "214,748,364,80;0%", Int32.MinValue.ToString ("0E+0;0,\";\"0%", _nfi));\r
AssertEquals ("#02", "2E+9", Int32.MaxValue.ToString ("0E+0;0,\";\"0%", _nfi));\r
AssertEquals ("#03", "0E+0",0.ToString ("0E+0;0,\";\"0%", _nfi));\r
}\r
\r
- public void Test08087 () {\r
+ [Test]\r
+ public void Test08087 ()\r
+ {\r
// MS.NET bug?\r
NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "$$$";\r
AssertEquals ("#01", "-0000000000$$$2147483648", Int32.MinValue.ToString ("0000000000$$$0000000000", nfi));\r
}\r
\r
- public void Test08088 () {\r
+ [Test]\r
+ public void Test08088 ()\r
+ {\r
// MS.NET bug?\r
NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo.Clone() as NumberFormatInfo;\r
nfi.NumberGroupSeparator = "$$$";\r
AssertEquals ("#01", "-0000000000$$$2147483648", Int32.MinValue.ToString ("0000000000$$$0000000000", nfi));\r
}\r
\r
- public void Test08089 () {\r
+ [Test]\r
+ public void Test08089 ()\r
+ {\r
NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo.Clone() as NumberFormatInfo;\r
nfi.NumberGroupSizes = new int[] {3,2,1,0};\r
AssertEquals ("#01", "-00000000002147,4,83,648", Int32.MinValue.ToString ("0000000000,0000000000", nfi));\r
}\r
\r
- public void Test08090 () {\r
+ [Test]\r
+ public void Test08090 ()\r
+ {\r
// MS.NET bug?\r
NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo.Clone() as NumberFormatInfo;\r
nfi.PercentSymbol = "$$$";\r
AssertEquals ("#01", "-0000000000$$$2147483648", Int32.MinValue.ToString ("0000000000$$$0000000000", nfi));\r
}\r
\r
- public void Test08091 () {\r
+ [Test]\r
+ public void Test08091 ()\r
+ {\r
// MS.NET bug?\r
AssertEquals ("#01", "B2147", Int32.MinValue.ToString ("A0,;B0,,;C0,,,;D0,,,,;E0,,,,,", _nfi));\r
AssertEquals ("#02", "A2147484", Int32.MaxValue.ToString ("A0,;B0,,;C0,,,;D0,,,,;E0,,,,,", _nfi));\r
// Test10000- Double and D\r
[Test]\r
[ExpectedException (typeof (FormatException))]\r
- public void Test10000 () {\r
+ public void Test10000 ()\r
+ {\r
AssertEquals ("#01", "0", 0.0.ToString ("D", _nfi));\r
}\r
\r
// Test11000- Double and E\r
[Test]\r
- public void Test11000 () {\r
+ public void Test11000 ()\r
+ {\r
AssertEquals ("#01", "0.000000E+000", 0.0.ToString ("E", _nfi));\r
AssertEquals ("#02", "0.000000e+000", 0.0.ToString ("e", _nfi));\r
AssertEquals ("#03", "-1.797693E+308", Double.MinValue.ToString ("E", _nfi));\r
}\r
\r
[Test]\r
- public void Test11001 () {\r
+ public void Test11001 ()\r
+ {\r
AssertEquals ("#01", "E ", 0.0.ToString ("E ", _nfi));\r
AssertEquals ("#02", " E", 0.0.ToString (" E", _nfi));\r
AssertEquals ("#03", " E ", 0.0.ToString (" E ", _nfi));\r
}\r
\r
[Test]\r
- public void Test11002 () {\r
+ public void Test11002 ()\r
+ {\r
AssertEquals ("#01", "-E ", (-1.0).ToString ("E ", _nfi));\r
AssertEquals ("#02", "- E", (-1.0).ToString (" E", _nfi));\r
AssertEquals ("#03", "- E ", (-1.0).ToString (" E ", _nfi));\r
}\r
\r
[Test]\r
- public void Test11003 () {\r
+ public void Test11003 ()\r
+ {\r
AssertEquals ("#01", "0E+000", 0.0.ToString ("E0", _nfi));\r
AssertEquals ("#02", "0.0000000000000000E+000", 0.0.ToString ("E16", _nfi));\r
AssertEquals ("#03", "0.00000000000000000E+000", 0.0.ToString ("E17", _nfi));\r
}\r
\r
[Test]\r
- public void Test11004 () {\r
+ public void Test11004 ()\r
+ {\r
AssertEquals ("#01", "2E+308", Double.MaxValue.ToString ("E0", _nfi));\r
AssertEquals ("#02", "1.7976931348623157E+308", Double.MaxValue.ToString ("E16", _nfi));\r
AssertEquals ("#03", "1.79769313486231570E+308", Double.MaxValue.ToString ("E17", _nfi));\r
}\r
\r
[Test]\r
- public void Test11005 () {\r
+ public void Test11005 ()\r
+ {\r
AssertEquals ("#01", "-2E+308", Double.MinValue.ToString ("E0", _nfi));\r
AssertEquals ("#02", "-1.7976931348623157E+308", Double.MinValue.ToString ("E16", _nfi));\r
AssertEquals ("#03", "-1.79769313486231570E+308", Double.MinValue.ToString ("E17", _nfi));\r
}\r
\r
[Test]\r
- public void Test11006 () {\r
+ public void Test11006 ()\r
+ {\r
AssertEquals ("#01", "EF", 0.0.ToString ("EF", _nfi));\r
AssertEquals ("#02", "E0F", 0.0.ToString ("E0F", _nfi));\r
AssertEquals ("#03", "E0xF", 0.0.ToString ("E0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test11007 () {\r
+ public void Test11007 ()\r
+ {\r
AssertEquals ("#01", "EF", Double.MaxValue.ToString ("EF", _nfi));\r
AssertEquals ("#02", "E0F", Double.MaxValue.ToString ("E0F", _nfi));\r
AssertEquals ("#03", "E0xF", Double.MaxValue.ToString ("E0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test11008 () {\r
+ public void Test11008 ()\r
+ {\r
AssertEquals ("#01", "-EF", Double.MinValue.ToString ("EF", _nfi));\r
AssertEquals ("#02", "E0F", Double.MinValue.ToString ("E0F", _nfi));\r
AssertEquals ("#03", "E0xF", Double.MinValue.ToString ("E0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test11009 () {\r
+ public void Test11009 ()\r
+ {\r
AssertEquals ("#01", "0.00000000000000000E+000", 0.0.ToString ("E0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#02", "1.79769313486231570E+308", Double.MaxValue.ToString ("E0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#03", "-1.79769313486231570E+308", Double.MinValue.ToString ("E0000000000000000000000000000000000000017", _nfi));\r
}\r
\r
[Test]\r
- public void Test11010 () {\r
+ public void Test11010 ()\r
+ {\r
AssertEquals ("#01", "+E", 0.0.ToString ("+E", _nfi));\r
AssertEquals ("#02", "E+", 0.0.ToString ("E+", _nfi));\r
AssertEquals ("#03", "+E+", 0.0.ToString ("+E+", _nfi));\r
}\r
\r
[Test]\r
- public void Test11011 () {\r
+ public void Test11011 ()\r
+ {\r
AssertEquals ("#01", "+E", Double.MaxValue.ToString ("+E", _nfi));\r
AssertEquals ("#02", "E+", Double.MaxValue.ToString ("E+", _nfi));\r
AssertEquals ("#03", "+E+", Double.MaxValue.ToString ("+E+", _nfi));\r
}\r
\r
[Test]\r
- public void Test11012 () {\r
+ public void Test11012 ()\r
+ {\r
AssertEquals ("#01", "-+E", Double.MinValue.ToString ("+E", _nfi));\r
AssertEquals ("#02", "-E+", Double.MinValue.ToString ("E+", _nfi));\r
AssertEquals ("#03", "-+E+", Double.MinValue.ToString ("+E+", _nfi));\r
}\r
\r
[Test]\r
- public void Test11013 () {\r
+ public void Test11013 ()\r
+ {\r
AssertEquals ("#01", "-E", 0.0.ToString ("-E", _nfi));\r
AssertEquals ("#02", "E-", 0.0.ToString ("E-", _nfi));\r
AssertEquals ("#03", "-E-", 0.0.ToString ("-E-", _nfi));\r
}\r
\r
[Test]\r
- public void Test11014 () {\r
+ public void Test11014 ()\r
+ {\r
AssertEquals ("#01", "-E", Double.MaxValue.ToString ("-E", _nfi));\r
AssertEquals ("#02", "E-", Double.MaxValue.ToString ("E-", _nfi));\r
AssertEquals ("#03", "-E-", Double.MaxValue.ToString ("-E-", _nfi));\r
}\r
\r
[Test]\r
- public void Test11015 () {\r
+ public void Test11015 ()\r
+ {\r
AssertEquals ("#01", "--E", Double.MinValue.ToString ("-E", _nfi));\r
AssertEquals ("#02", "-E-", Double.MinValue.ToString ("E-", _nfi));\r
AssertEquals ("#03", "--E-", Double.MinValue.ToString ("-E-", _nfi));\r
}\r
\r
[Test]\r
- public void Test11016 () {\r
+ public void Test11016 ()\r
+ {\r
AssertEquals ("#01", "E+0", 0.0.ToString ("E+0", _nfi));\r
AssertEquals ("#02", "E+0", Double.MaxValue.ToString ("E+0", _nfi));\r
AssertEquals ("#03", "E+0", Double.MinValue.ToString ("E+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test11017 () {\r
+ public void Test11017 ()\r
+ {\r
AssertEquals ("#01", "E+9", 0.0.ToString ("E+9", _nfi));\r
AssertEquals ("#02", "E+9", Double.MaxValue.ToString ("E+9", _nfi));\r
AssertEquals ("#03", "-E+9", Double.MinValue.ToString ("E+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test11018 () {\r
+ public void Test11018 ()\r
+ {\r
AssertEquals ("#01", "E-9", 0.0.ToString ("E-9", _nfi));\r
AssertEquals ("#02", "E-9", Double.MaxValue.ToString ("E-9", _nfi));\r
AssertEquals ("#03", "-E-9", Double.MinValue.ToString ("E-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test11019 () {\r
+ public void Test11019 ()\r
+ {\r
AssertEquals ("#01", "E0", 0.0.ToString ("E0,", _nfi));\r
AssertEquals ("#02", "E0", Double.MaxValue.ToString ("E0,", _nfi));\r
AssertEquals ("#03", "E0", Double.MinValue.ToString ("E0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test11020 () {\r
+ public void Test11020 ()\r
+ {\r
AssertEquals ("#01", "E0", 0.0.ToString ("E0.", _nfi));\r
AssertEquals ("#02", "E0", Double.MaxValue.ToString ("E0.", _nfi));\r
AssertEquals ("#03", "E0", Double.MinValue.ToString ("E0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test11021 () {\r
+ public void Test11021 ()\r
+ {\r
AssertEquals ("#01", "E0.0", 0.0.ToString ("E0.0", _nfi));\r
AssertEquals ("#02", "E309.2", Double.MaxValue.ToString ("E0.0", _nfi));\r
AssertEquals ("#03", "-E309.2", Double.MinValue.ToString ("E0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test11022 () {\r
+ public void Test11022 ()\r
+ {\r
AssertEquals ("#01", "E09", 0.0.ToString ("E0.9", _nfi));\r
AssertEquals ("#02", "E09", Double.MaxValue.ToString ("E0.9", _nfi));\r
AssertEquals ("#03", "E09", Double.MinValue.ToString ("E0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test11023 () {\r
+ public void Test11023 ()\r
+ {\r
AssertEquals ("#01", "1.1E+000", 1.05.ToString ("E1", _nfi));\r
AssertEquals ("#02", "1.2E+000", 1.15.ToString ("E1", _nfi));\r
AssertEquals ("#03", "1.3E+000", 1.25.ToString ("E1", _nfi));\r
}\r
\r
[Test]\r
- public void Test11024 () {\r
+ public void Test11024 ()\r
+ {\r
AssertEquals ("#01", "1.01E+000", 1.005.ToString ("E2", _nfi));\r
AssertEquals ("#02", "1.02E+000", 1.015.ToString ("E2", _nfi));\r
AssertEquals ("#03", "1.03E+000", 1.025.ToString ("E2", _nfi));\r
}\r
\r
[Test]\r
- public void Test11025 () {\r
+ public void Test11025 ()\r
+ {\r
AssertEquals ("#01", "1.00000000000001E+000", 1.000000000000005.ToString ("E14", _nfi));\r
AssertEquals ("#02", "1.00000000000002E+000", 1.000000000000015.ToString ("E14", _nfi));\r
AssertEquals ("#03", "1.00000000000003E+000", 1.000000000000025.ToString ("E14", _nfi));\r
}\r
\r
[Test]\r
- public void Test11026 () {\r
+ public void Test11026 ()\r
+ {\r
AssertEquals ("#01", "1.000000000000000E+000", 1.0000000000000005.ToString ("E15", _nfi));\r
AssertEquals ("#02", "1.000000000000002E+000", 1.0000000000000015.ToString ("E15", _nfi));\r
AssertEquals ("#03", "1.000000000000002E+000", 1.0000000000000025.ToString ("E15", _nfi));\r
}\r
\r
[Test]\r
- public void Test11027 () {\r
+ public void Test11027 ()\r
+ {\r
AssertEquals ("#01", "1.0000000000000000E+000", 1.00000000000000005.ToString ("E16", _nfi));\r
AssertEquals ("#02", "1.0000000000000002E+000", 1.00000000000000015.ToString ("E16", _nfi));\r
AssertEquals ("#03", "1.0000000000000002E+000", 1.00000000000000025.ToString ("E16", _nfi));\r
}\r
\r
[Test]\r
- public void Test11028 () {\r
+ public void Test11028 ()\r
+ {\r
AssertEquals ("#01", "1.00000000000000000E+000", 1.000000000000000005.ToString ("E17", _nfi));\r
AssertEquals ("#02", "1.00000000000000000E+000", 1.000000000000000015.ToString ("E17", _nfi));\r
AssertEquals ("#03", "1.00000000000000000E+000", 1.000000000000000025.ToString ("E17", _nfi));\r
}\r
\r
[Test]\r
- public void Test11029 () {\r
+ public void Test11029 ()\r
+ {\r
AssertEquals ("#01", "1E+000", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("E0"));\r
AssertEquals ("#02", "1.2345678901234567E+000", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("E16"));\r
AssertEquals ("#03", "1.23456789012345670E+000", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("E17"));\r
}\r
\r
[Test]\r
- public void Test11030 () {\r
+ public void Test11030 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "-1#000000E+008", (-99999999.9).ToString ("E", nfi));\r
}\r
\r
[Test]\r
- public void Test11031 () {\r
+ public void Test11031 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test11032 () {\r
+ public void Test11032 ()\r
+ {\r
AssertEquals ("#01", "Infinity", (Double.MaxValue / 0.0).ToString ("E99", _nfi)); \r
AssertEquals ("#02", "-Infinity", (Double.MinValue / 0.0).ToString ("E99", _nfi)); \r
AssertEquals ("#03", "NaN", (0.0 / 0.0).ToString ("E99", _nfi)); \r
\r
// Test12000- Double and F\r
[Test]\r
- public void Test12000 () {\r
+ public void Test12000 ()\r
+ {\r
AssertEquals ("#01", "0.00", 0.0.ToString ("F", _nfi));\r
AssertEquals ("#02", "0.00", 0.0.ToString ("f", _nfi));\r
AssertEquals ("#03", "-179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00", Double.MinValue.ToString ("F", _nfi));\r
}\r
\r
[Test]\r
- public void Test12001 () {\r
+ public void Test12001 ()\r
+ {\r
AssertEquals ("#01", "F ", 0.0.ToString ("F ", _nfi));\r
AssertEquals ("#02", " F", 0.0.ToString (" F", _nfi));\r
AssertEquals ("#03", " F ", 0.0.ToString (" F ", _nfi));\r
}\r
\r
[Test]\r
- public void Test12002 () {\r
+ public void Test12002 ()\r
+ {\r
AssertEquals ("#01", "-F ", (-1.0).ToString ("F ", _nfi));\r
AssertEquals ("#02", "- F", (-1.0).ToString (" F", _nfi));\r
AssertEquals ("#03", "- F ", (-1.0).ToString (" F ", _nfi));\r
}\r
\r
[Test]\r
- public void Test12003 () {\r
+ public void Test12003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.0.ToString ("F0", _nfi));\r
AssertEquals ("#02", "0.0000000000000000", 0.0.ToString ("F16", _nfi));\r
AssertEquals ("#03", "0.00000000000000000", 0.0.ToString ("F17", _nfi));\r
}\r
\r
[Test]\r
- public void Test12004 () {\r
+ public void Test12004 ()\r
+ {\r
AssertEquals ("#01", "179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("F0", _nfi));\r
AssertEquals ("#02", "179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000000", Double.MaxValue.ToString ("F16", _nfi));\r
AssertEquals ("#03", "179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000", Double.MaxValue.ToString ("F17", _nfi));\r
}\r
\r
[Test]\r
- public void Test12005 () {\r
+ public void Test12005 ()\r
+ {\r
AssertEquals ("#01", "-179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("F0", _nfi));\r
AssertEquals ("#02", "-179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000000", Double.MinValue.ToString ("F16", _nfi));\r
AssertEquals ("#03", "-179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000", Double.MinValue.ToString ("F17", _nfi));\r
}\r
\r
[Test]\r
- public void Test12006 () {\r
+ public void Test12006 ()\r
+ {\r
AssertEquals ("#01", "FF", 0.0.ToString ("FF", _nfi));\r
AssertEquals ("#02", "F0F", 0.0.ToString ("F0F", _nfi));\r
AssertEquals ("#03", "F0xF", 0.0.ToString ("F0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test12007 () {\r
+ public void Test12007 ()\r
+ {\r
AssertEquals ("#01", "FF", Double.MaxValue.ToString ("FF", _nfi));\r
AssertEquals ("#02", "F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MaxValue.ToString ("F0F", _nfi));\r
AssertEquals ("#03", "F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MaxValue.ToString ("F0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test12008 () {\r
+ public void Test12008 ()\r
+ {\r
AssertEquals ("#01", "-FF", Double.MinValue.ToString ("FF", _nfi));\r
AssertEquals ("#02", "-F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MinValue.ToString ("F0F", _nfi));\r
AssertEquals ("#03", "-F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MinValue.ToString ("F0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test12009 () {\r
+ public void Test12009 ()\r
+ {\r
AssertEquals ("#01", "0.00000000000000000", 0.0.ToString ("F0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#02", "179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000", Double.MaxValue.ToString ("F0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#03", "-179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000", Double.MinValue.ToString ("F0000000000000000000000000000000000000017", _nfi));\r
}\r
\r
[Test]\r
- public void Test12010 () {\r
+ public void Test12010 ()\r
+ {\r
AssertEquals ("#01", "+F", 0.0.ToString ("+F", _nfi));\r
AssertEquals ("#02", "F+", 0.0.ToString ("F+", _nfi));\r
AssertEquals ("#03", "+F+", 0.0.ToString ("+F+", _nfi));\r
}\r
\r
[Test]\r
- public void Test12011 () {\r
+ public void Test12011 ()\r
+ {\r
AssertEquals ("#01", "+F", Double.MaxValue.ToString ("+F", _nfi));\r
AssertEquals ("#02", "F+", Double.MaxValue.ToString ("F+", _nfi));\r
AssertEquals ("#03", "+F+", Double.MaxValue.ToString ("+F+", _nfi));\r
}\r
\r
[Test]\r
- public void Test12012 () {\r
+ public void Test12012 ()\r
+ {\r
AssertEquals ("#01", "-+F", Double.MinValue.ToString ("+F", _nfi));\r
AssertEquals ("#02", "-F+", Double.MinValue.ToString ("F+", _nfi));\r
AssertEquals ("#03", "-+F+", Double.MinValue.ToString ("+F+", _nfi));\r
}\r
\r
[Test]\r
- public void Test12013 () {\r
+ public void Test12013 ()\r
+ {\r
AssertEquals ("#01", "-F", 0.0.ToString ("-F", _nfi));\r
AssertEquals ("#02", "F-", 0.0.ToString ("F-", _nfi));\r
AssertEquals ("#03", "-F-", 0.0.ToString ("-F-", _nfi));\r
}\r
\r
[Test]\r
- public void Test12014 () {\r
+ public void Test12014 ()\r
+ {\r
AssertEquals ("#01", "-F", Double.MaxValue.ToString ("-F", _nfi));\r
AssertEquals ("#02", "F-", Double.MaxValue.ToString ("F-", _nfi));\r
AssertEquals ("#03", "-F-", Double.MaxValue.ToString ("-F-", _nfi));\r
}\r
\r
[Test]\r
- public void Test12015 () {\r
+ public void Test12015 ()\r
+ {\r
AssertEquals ("#01", "--F", Double.MinValue.ToString ("-F", _nfi));\r
AssertEquals ("#02", "-F-", Double.MinValue.ToString ("F-", _nfi));\r
AssertEquals ("#03", "--F-", Double.MinValue.ToString ("-F-", _nfi));\r
}\r
\r
[Test]\r
- public void Test12016 () {\r
+ public void Test12016 ()\r
+ {\r
AssertEquals ("#01", "F+0", 0.0.ToString ("F+0", _nfi));\r
AssertEquals ("#02", "F+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("F+0", _nfi));\r
AssertEquals ("#03", "-F+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("F+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test12017 () {\r
+ public void Test12017 ()\r
+ {\r
AssertEquals ("#01", "F+9", 0.0.ToString ("F+9", _nfi));\r
AssertEquals ("#02", "F+9", Double.MaxValue.ToString ("F+9", _nfi));\r
AssertEquals ("#03", "-F+9", Double.MinValue.ToString ("F+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test12018 () {\r
+ public void Test12018 ()\r
+ {\r
AssertEquals ("#01", "F-9", 0.0.ToString ("F-9", _nfi));\r
AssertEquals ("#02", "F-9", Double.MaxValue.ToString ("F-9", _nfi));\r
AssertEquals ("#03", "-F-9", Double.MinValue.ToString ("F-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test12019 () {\r
+ public void Test12019 ()\r
+ {\r
AssertEquals ("#01", "F0", 0.0.ToString ("F0,", _nfi));\r
AssertEquals ("#02", "F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("F0,", _nfi));\r
AssertEquals ("#03", "-F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("F0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test12020 () {\r
+ public void Test12020 ()\r
+ {\r
AssertEquals ("#01", "F0", 0.0.ToString ("F0.", _nfi));\r
AssertEquals ("#02", "F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("F0.", _nfi));\r
AssertEquals ("#03", "-F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("F0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test12021 () {\r
+ public void Test12021 ()\r
+ {\r
AssertEquals ("#01", "F0.0", 0.0.ToString ("F0.0", _nfi));\r
AssertEquals ("#02", "F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MaxValue.ToString ("F0.0", _nfi));\r
AssertEquals ("#03", "-F179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MinValue.ToString ("F0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test12022 () {\r
+ public void Test12022 ()\r
+ {\r
AssertEquals ("#01", "F09", 0.0.ToString ("F0.9", _nfi));\r
AssertEquals ("#02", "F1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MaxValue.ToString ("F0.9", _nfi));\r
AssertEquals ("#03", "-F1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MinValue.ToString ("F0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test12023 () {\r
+ public void Test12023 ()\r
+ {\r
AssertEquals ("#01", "1.1", 1.05.ToString ("F1", _nfi));\r
AssertEquals ("#02", "1.2", 1.15.ToString ("F1", _nfi));\r
AssertEquals ("#03", "1.3", 1.25.ToString ("F1", _nfi));\r
}\r
\r
[Test]\r
- public void Test12024 () {\r
+ public void Test12024 ()\r
+ {\r
AssertEquals ("#01", "1.01", 1.005.ToString ("F2", _nfi));\r
AssertEquals ("#02", "1.02", 1.015.ToString ("F2", _nfi));\r
AssertEquals ("#03", "1.03", 1.025.ToString ("F2", _nfi));\r
}\r
\r
[Test]\r
- public void Test12025 () {\r
+ public void Test12025 ()\r
+ {\r
AssertEquals ("#01", "1.00000000000001", 1.000000000000005.ToString ("F14", _nfi));\r
AssertEquals ("#02", "1.00000000000002", 1.000000000000015.ToString ("F14", _nfi));\r
AssertEquals ("#03", "1.00000000000003", 1.000000000000025.ToString ("F14", _nfi));\r
}\r
\r
[Test]\r
- public void Test12026 () {\r
+ public void Test12026 ()\r
+ {\r
AssertEquals ("#01", "1.000000000000000", 1.0000000000000005.ToString ("F15", _nfi));\r
AssertEquals ("#02", "1.000000000000000", 1.0000000000000015.ToString ("F15", _nfi));\r
AssertEquals ("#03", "1.000000000000000", 1.0000000000000025.ToString ("F15", _nfi));\r
}\r
\r
[Test]\r
- public void Test12027 () {\r
+ public void Test12027 ()\r
+ {\r
AssertEquals ("#01", "1.0000000000000000", 1.00000000000000005.ToString ("F16", _nfi));\r
AssertEquals ("#02", "1.0000000000000000", 1.00000000000000015.ToString ("F16", _nfi));\r
AssertEquals ("#03", "1.0000000000000000", 1.00000000000000025.ToString ("F16", _nfi));\r
}\r
\r
[Test]\r
- public void Test12028 () {\r
+ public void Test12028 ()\r
+ {\r
AssertEquals ("#01", "1", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("F0", _nfi));\r
AssertEquals ("#02", "1.234567890123", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("F12", _nfi));\r
AssertEquals ("#03", "1.2345678901235", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("F13", _nfi));\r
}\r
\r
[Test]\r
- public void Test12029 () {\r
+ public void Test12029 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "-99999999#90", (-99999999.9).ToString ("F", nfi));\r
}\r
\r
[Test]\r
- public void Test12030 () {\r
+ public void Test12030 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test12031 () {\r
+ public void Test12031 ()\r
+ {\r
AssertEquals ("#01", "Infinity", (Double.MaxValue / 0.0).ToString ("F99", _nfi)); \r
AssertEquals ("#02", "-Infinity", (Double.MinValue / 0.0).ToString ("F99", _nfi)); \r
AssertEquals ("#03", "NaN", (0.0 / 0.0).ToString ("F99", _nfi)); \r
\r
// Test13000- Double and G\r
[Test]\r
- public void Test13000 () {\r
+ public void Test13000 ()\r
+ {\r
AssertEquals ("#01", "0", 0.0.ToString ("G", _nfi));\r
AssertEquals ("#02", "0", 0.0.ToString ("g", _nfi));\r
AssertEquals ("#03", "-1.79769313486232E+308", Double.MinValue.ToString ("G", _nfi));\r
}\r
\r
[Test]\r
- public void Test13001 () {\r
+ public void Test13001 ()\r
+ {\r
AssertEquals ("#01", "G ", 0.0.ToString ("G ", _nfi));\r
AssertEquals ("#02", " G", 0.0.ToString (" G", _nfi));\r
AssertEquals ("#03", " G ", 0.0.ToString (" G ", _nfi));\r
}\r
\r
[Test]\r
- public void Test13002 () {\r
+ public void Test13002 ()\r
+ {\r
AssertEquals ("#01", "-G ", (-1.0).ToString ("G ", _nfi));\r
AssertEquals ("#02", "- G", (-1.0).ToString (" G", _nfi));\r
AssertEquals ("#03", "- G ", (-1.0).ToString (" G ", _nfi));\r
}\r
\r
[Test]\r
- public void Test13003 () {\r
+ public void Test13003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.0.ToString ("G0", _nfi));\r
AssertEquals ("#02", "0", 0.0.ToString ("G16", _nfi));\r
AssertEquals ("#03", "0", 0.0.ToString ("G17", _nfi));\r
}\r
\r
[Test]\r
- public void Test13004 () {\r
+ public void Test13004 ()\r
+ {\r
AssertEquals ("#01", "1.79769313486232E+308", Double.MaxValue.ToString ("G0", _nfi));\r
AssertEquals ("#02", "1.797693134862316E+308", Double.MaxValue.ToString ("G16", _nfi));\r
AssertEquals ("#03", "1.7976931348623157E+308", Double.MaxValue.ToString ("G17", _nfi));\r
}\r
\r
[Test]\r
- public void Test13005 () {\r
+ public void Test13005 ()\r
+ {\r
AssertEquals ("#01", "-1.79769313486232E+308", Double.MinValue.ToString ("G0", _nfi));\r
AssertEquals ("#02", "-1.797693134862316E+308", Double.MinValue.ToString ("G16", _nfi));\r
AssertEquals ("#03", "-1.7976931348623157E+308", Double.MinValue.ToString ("G17", _nfi));\r
}\r
\r
[Test]\r
- public void Test13006 () {\r
+ public void Test13006 ()\r
+ {\r
AssertEquals ("#01", "GF", 0.0.ToString ("GF", _nfi));\r
AssertEquals ("#02", "G0F", 0.0.ToString ("G0F", _nfi));\r
AssertEquals ("#03", "G0xF", 0.0.ToString ("G0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test13007 () {\r
+ public void Test13007 ()\r
+ {\r
AssertEquals ("#01", "GF", Double.MaxValue.ToString ("GF", _nfi));\r
AssertEquals ("#02", "G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MaxValue.ToString ("G0F", _nfi));\r
AssertEquals ("#03", "G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MaxValue.ToString ("G0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test13008 () {\r
+ public void Test13008 ()\r
+ {\r
AssertEquals ("#01", "-GF", Double.MinValue.ToString ("GF", _nfi));\r
AssertEquals ("#02", "-G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MinValue.ToString ("G0F", _nfi));\r
AssertEquals ("#03", "-G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MinValue.ToString ("G0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test13009 () {\r
+ public void Test13009 ()\r
+ {\r
AssertEquals ("#01", "0", 0.0.ToString ("G0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#02", "1.7976931348623157E+308", Double.MaxValue.ToString ("G0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#03", "-1.7976931348623157E+308", Double.MinValue.ToString ("G0000000000000000000000000000000000000017", _nfi));\r
}\r
\r
[Test]\r
- public void Test13010 () {\r
+ public void Test13010 ()\r
+ {\r
AssertEquals ("#01", "+G", 0.0.ToString ("+G", _nfi));\r
AssertEquals ("#02", "G+", 0.0.ToString ("G+", _nfi));\r
AssertEquals ("#03", "+G+", 0.0.ToString ("+G+", _nfi));\r
}\r
\r
[Test]\r
- public void Test13011 () {\r
+ public void Test13011 ()\r
+ {\r
AssertEquals ("#01", "+G", Double.MaxValue.ToString ("+G", _nfi));\r
AssertEquals ("#02", "G+", Double.MaxValue.ToString ("G+", _nfi));\r
AssertEquals ("#03", "+G+", Double.MaxValue.ToString ("+G+", _nfi));\r
}\r
\r
[Test]\r
- public void Test13012 () {\r
+ public void Test13012 ()\r
+ {\r
AssertEquals ("#01", "-+G", Double.MinValue.ToString ("+G", _nfi));\r
AssertEquals ("#02", "-G+", Double.MinValue.ToString ("G+", _nfi));\r
AssertEquals ("#03", "-+G+", Double.MinValue.ToString ("+G+", _nfi));\r
}\r
\r
[Test]\r
- public void Test13013 () {\r
+ public void Test13013 ()\r
+ {\r
AssertEquals ("#01", "-G", 0.0.ToString ("-G", _nfi));\r
AssertEquals ("#02", "G-", 0.0.ToString ("G-", _nfi));\r
AssertEquals ("#03", "-G-", 0.0.ToString ("-G-", _nfi));\r
}\r
\r
[Test]\r
- public void Test13014 () {\r
+ public void Test13014 ()\r
+ {\r
AssertEquals ("#01", "-G", Double.MaxValue.ToString ("-G", _nfi));\r
AssertEquals ("#02", "G-", Double.MaxValue.ToString ("G-", _nfi));\r
AssertEquals ("#03", "-G-", Double.MaxValue.ToString ("-G-", _nfi));\r
}\r
\r
[Test]\r
- public void Test13015 () {\r
+ public void Test13015 ()\r
+ {\r
AssertEquals ("#01", "--G", Double.MinValue.ToString ("-G", _nfi));\r
AssertEquals ("#02", "-G-", Double.MinValue.ToString ("G-", _nfi));\r
AssertEquals ("#03", "--G-", Double.MinValue.ToString ("-G-", _nfi));\r
}\r
\r
[Test]\r
- public void Test13016 () {\r
+ public void Test13016 ()\r
+ {\r
AssertEquals ("#01", "G+0", 0.0.ToString ("G+0", _nfi));\r
AssertEquals ("#02", "G+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("G+0", _nfi));\r
AssertEquals ("#03", "-G+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("G+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test13017 () {\r
+ public void Test13017 ()\r
+ {\r
AssertEquals ("#01", "G+9", 0.0.ToString ("G+9", _nfi));\r
AssertEquals ("#02", "G+9", Double.MaxValue.ToString ("G+9", _nfi));\r
AssertEquals ("#03", "-G+9", Double.MinValue.ToString ("G+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test13018 () {\r
+ public void Test13018 ()\r
+ {\r
AssertEquals ("#01", "G-9", 0.0.ToString ("G-9", _nfi));\r
AssertEquals ("#02", "G-9", Double.MaxValue.ToString ("G-9", _nfi));\r
AssertEquals ("#03", "-G-9", Double.MinValue.ToString ("G-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test13019 () {\r
+ public void Test13019 ()\r
+ {\r
AssertEquals ("#01", "G0", 0.0.ToString ("G0,", _nfi));\r
AssertEquals ("#02", "G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("G0,", _nfi));\r
AssertEquals ("#03", "-G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("G0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test13020 () {\r
+ public void Test13020 ()\r
+ {\r
AssertEquals ("#01", "G0", 0.0.ToString ("G0.", _nfi));\r
AssertEquals ("#02", "G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("G0.", _nfi));\r
AssertEquals ("#03", "-G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("G0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test13021 () {\r
+ public void Test13021 ()\r
+ {\r
AssertEquals ("#01", "G0.0", 0.0.ToString ("G0.0", _nfi));\r
AssertEquals ("#02", "G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MaxValue.ToString ("G0.0", _nfi));\r
AssertEquals ("#03", "-G179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MinValue.ToString ("G0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test13022 () {\r
+ public void Test13022 ()\r
+ {\r
AssertEquals ("#01", "G09", 0.0.ToString ("G0.9", _nfi));\r
AssertEquals ("#02", "G1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MaxValue.ToString ("G0.9", _nfi));\r
AssertEquals ("#03", "-G1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MinValue.ToString ("G0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test13023 () {\r
+ public void Test13023 ()\r
+ {\r
AssertEquals ("#01", "0.5", 0.5.ToString ("G1", _nfi));\r
AssertEquals ("#02", "2", 1.5.ToString ("G1", _nfi));\r
AssertEquals ("#03", "3", 2.5.ToString ("G1", _nfi));\r
AssertEquals ("#09", "9", 8.5.ToString ("G1", _nfi));\r
AssertEquals ("#10", "1E+01", 9.5.ToString ("G1", _nfi));\r
}\r
-
+\r
[Test]\r
- public void Test13024_CarryPropagation ()
- {
+ public void Test13024_CarryPropagation () \r
+ {\r
Double d = 1.15;\r
AssertEquals ("#01", "1", d.ToString ("G1", _nfi));\r
- // NumberStore converts 1.15 into 1.14999...91 (1 in index 17)
+ // NumberStore converts 1.15 into 1.14999...91 (1 in index 17)\r
// so the call to NumberToString doesn't result in 1.2 but in 1.1\r
- // which seems "somewhat" normal considering the #17 results,
+ // which seems "somewhat" normal considering the #17 results,\r
AssertEquals ("#02", "1.2", d.ToString ("G2", _nfi));\r
AssertEquals ("#03", "1.15", d.ToString ("G3", _nfi));\r
AssertEquals ("#04", "1.15", d.ToString ("G4", _nfi));\r
AssertEquals ("#16", "1.15", d.ToString ("G16", _nfi));\r
AssertEquals ("#17", "1.1499999999999999", d.ToString ("G17", _nfi));\r
}\r
-
+\r
[Test]\r
- public void Test13024 () {\r
+ public void Test13024 ()\r
+ {\r
AssertEquals ("#01", "1.1", 1.05.ToString ("G2", _nfi));\r
AssertEquals ("#02", "1.2", 1.15.ToString ("G2", _nfi));\r
AssertEquals ("#03", "1.3", 1.25.ToString ("G2", _nfi));\r
}\r
\r
[Test]\r
- public void Test13025 () {\r
+ public void Test13025 ()\r
+ {\r
AssertEquals ("#01", "10", 10.05.ToString ("G2", _nfi));\r
AssertEquals ("#02", "10", 10.15.ToString ("G2", _nfi));\r
AssertEquals ("#03", "10", 10.25.ToString ("G2", _nfi));\r
}\r
\r
[Test]\r
- public void Test13026 () {\r
+ public void Test13026 ()\r
+ {\r
AssertEquals ("#01", "1.00000000000001", 1.000000000000005.ToString ("G15", _nfi));\r
AssertEquals ("#02", "1.00000000000002", 1.000000000000015.ToString ("G15", _nfi));\r
AssertEquals ("#03", "1.00000000000003", 1.000000000000025.ToString ("G15", _nfi));\r
}\r
\r
[Test]\r
- public void Test13027 () {\r
+ public void Test13027 ()\r
+ {\r
AssertEquals ("#01", "1", 1.0000000000000005.ToString ("G16", _nfi));\r
AssertEquals ("#02", "1.000000000000002", 1.0000000000000015.ToString ("G16", _nfi));\r
AssertEquals ("#03", "1.000000000000002", 1.0000000000000025.ToString ("G16", _nfi));\r
}\r
\r
[Test]\r
- public void Test13028 () {\r
+ public void Test13028 ()\r
+ {\r
AssertEquals ("#01", "1", 1.00000000000000005.ToString ("G17", _nfi));\r
AssertEquals ("#02", "1.0000000000000002", 1.00000000000000015.ToString ("G17", _nfi));\r
AssertEquals ("#03", "1.0000000000000002", 1.00000000000000025.ToString ("G17", _nfi));\r
}\r
\r
[Test]\r
- public void Test13029 () {\r
+ public void Test13029 ()\r
+ {\r
AssertEquals ("#01", "1", 1.000000000000000005.ToString ("G18", _nfi));\r
AssertEquals ("#02", "1", 1.000000000000000015.ToString ("G18", _nfi));\r
AssertEquals ("#03", "1", 1.000000000000000025.ToString ("G18", _nfi));\r
}\r
\r
[Test]\r
- public void Test13030 () {\r
+ public void Test13030 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "-99999999#9", (-99999999.9).ToString ("G", nfi));\r
}\r
\r
[Test]\r
- public void Test13031 () {\r
+ public void Test13031 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test13032 () {\r
+ public void Test13032 ()\r
+ {\r
AssertEquals ("#01", "Infinity", (Double.MaxValue / 0.0).ToString ("G99", _nfi)); \r
AssertEquals ("#02", "-Infinity", (Double.MinValue / 0.0).ToString ("G99", _nfi)); \r
AssertEquals ("#03", "NaN", (0.0 / 0.0).ToString ("G99", _nfi)); \r
}\r
\r
[Test]\r
- public void Test13033 () {\r
+ public void Test13033 ()\r
+ {\r
AssertEquals ("#01", "0.0001", 0.0001.ToString ("G", _nfi));\r
AssertEquals ("#02", "1E-05", 0.00001.ToString ("G", _nfi));\r
AssertEquals ("#03", "0.0001", 0.0001.ToString ("G0", _nfi));\r
\r
// Test14000- Double and N\r
[Test]\r
- public void Test14000 () {\r
+ public void Test14000 ()\r
+ {\r
AssertEquals ("#01", "0.00", 0.0.ToString ("N", _nfi));\r
AssertEquals ("#02", "0.00", 0.0.ToString ("n", _nfi));\r
AssertEquals ("#03", "-179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00", Double.MinValue.ToString ("N", _nfi));\r
}\r
\r
[Test]\r
- public void Test14001 () {\r
+ public void Test14001 ()\r
+ {\r
AssertEquals ("#01", "N ", 0.0.ToString ("N ", _nfi));\r
AssertEquals ("#02", " N", 0.0.ToString (" N", _nfi));\r
AssertEquals ("#03", " N ", 0.0.ToString (" N ", _nfi));\r
}\r
\r
[Test]\r
- public void Test14002 () {\r
+ public void Test14002 ()\r
+ {\r
AssertEquals ("#01", "-N ", (-1.0).ToString ("N ", _nfi));\r
AssertEquals ("#02", "- N", (-1.0).ToString (" N", _nfi));\r
AssertEquals ("#03", "- N ", (-1.0).ToString (" N ", _nfi));\r
}\r
\r
[Test]\r
- public void Test14003 () {\r
+ public void Test14003 ()\r
+ {\r
AssertEquals ("#01", "0", 0.0.ToString ("N0", _nfi));\r
AssertEquals ("#02", "0.0000000000000000", 0.0.ToString ("N16", _nfi));\r
AssertEquals ("#03", "0.00000000000000000", 0.0.ToString ("N17", _nfi));\r
}\r
\r
[Test]\r
- public void Test14004 () {\r
+ public void Test14004 ()\r
+ {\r
AssertEquals ("#01", "179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000", Double.MaxValue.ToString ("N0", _nfi));\r
AssertEquals ("#02", "179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.0000000000000000", Double.MaxValue.ToString ("N16", _nfi));\r
AssertEquals ("#03", "179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000", Double.MaxValue.ToString ("N17", _nfi));\r
}\r
\r
[Test]\r
- public void Test14005 () {\r
+ public void Test14005 ()\r
+ {\r
AssertEquals ("#01", "-179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000", Double.MinValue.ToString ("N0", _nfi));\r
AssertEquals ("#02", "-179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.0000000000000000", Double.MinValue.ToString ("N16", _nfi));\r
AssertEquals ("#03", "-179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000", Double.MinValue.ToString ("N17", _nfi));\r
}\r
\r
[Test]\r
- public void Test14006 () {\r
+ public void Test14006 ()\r
+ {\r
AssertEquals ("#01", "NF", 0.0.ToString ("NF", _nfi));\r
AssertEquals ("#02", "N0F", 0.0.ToString ("N0F", _nfi));\r
AssertEquals ("#03", "N0xF", 0.0.ToString ("N0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test14007 () {\r
+ public void Test14007 ()\r
+ {\r
AssertEquals ("#01", "NF", Double.MaxValue.ToString ("NF", _nfi));\r
AssertEquals ("#02", "N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MaxValue.ToString ("N0F", _nfi));\r
AssertEquals ("#03", "N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MaxValue.ToString ("N0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test14008 () {\r
+ public void Test14008 ()\r
+ {\r
AssertEquals ("#01", "-NF", Double.MinValue.ToString ("NF", _nfi));\r
AssertEquals ("#02", "-N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MinValue.ToString ("N0F", _nfi));\r
AssertEquals ("#03", "-N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MinValue.ToString ("N0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test14009 () {\r
+ public void Test14009 ()\r
+ {\r
AssertEquals ("#01", "0.00000000000000000", 0.0.ToString ("N0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#02", "179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000", Double.MaxValue.ToString ("N0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#03", "-179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000", Double.MinValue.ToString ("N0000000000000000000000000000000000000017", _nfi));\r
}\r
\r
[Test]\r
- public void Test14010 () {\r
+ public void Test14010 ()\r
+ {\r
AssertEquals ("#01", "+N", 0.0.ToString ("+N", _nfi));\r
AssertEquals ("#02", "N+", 0.0.ToString ("N+", _nfi));\r
AssertEquals ("#03", "+N+", 0.0.ToString ("+N+", _nfi));\r
}\r
\r
[Test]\r
- public void Test14011 () {\r
+ public void Test14011 ()\r
+ {\r
AssertEquals ("#01", "+N", Double.MaxValue.ToString ("+N", _nfi));\r
AssertEquals ("#02", "N+", Double.MaxValue.ToString ("N+", _nfi));\r
AssertEquals ("#03", "+N+", Double.MaxValue.ToString ("+N+", _nfi));\r
}\r
\r
[Test]\r
- public void Test14012 () {\r
+ public void Test14012 ()\r
+ {\r
AssertEquals ("#01", "-+N", Double.MinValue.ToString ("+N", _nfi));\r
AssertEquals ("#02", "-N+", Double.MinValue.ToString ("N+", _nfi));\r
AssertEquals ("#03", "-+N+", Double.MinValue.ToString ("+N+", _nfi));\r
}\r
\r
[Test]\r
- public void Test14013 () {\r
+ public void Test14013 ()\r
+ {\r
AssertEquals ("#01", "-N", 0.0.ToString ("-N", _nfi));\r
AssertEquals ("#02", "N-", 0.0.ToString ("N-", _nfi));\r
AssertEquals ("#03", "-N-", 0.0.ToString ("-N-", _nfi));\r
}\r
\r
[Test]\r
- public void Test14014 () {\r
+ public void Test14014 ()\r
+ {\r
AssertEquals ("#01", "-N", Double.MaxValue.ToString ("-N", _nfi));\r
AssertEquals ("#02", "N-", Double.MaxValue.ToString ("N-", _nfi));\r
AssertEquals ("#03", "-N-", Double.MaxValue.ToString ("-N-", _nfi));\r
}\r
\r
[Test]\r
- public void Test14015 () {\r
+ public void Test14015 ()\r
+ {\r
AssertEquals ("#01", "--N", Double.MinValue.ToString ("-N", _nfi));\r
AssertEquals ("#02", "-N-", Double.MinValue.ToString ("N-", _nfi));\r
AssertEquals ("#03", "--N-", Double.MinValue.ToString ("-N-", _nfi));\r
}\r
\r
[Test]\r
- public void Test14016 () {\r
+ public void Test14016 ()\r
+ {\r
AssertEquals ("#01", "N+0", 0.0.ToString ("N+0", _nfi));\r
AssertEquals ("#02", "N+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("N+0", _nfi));\r
AssertEquals ("#03", "-N+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("N+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test14017 () {\r
+ public void Test14017 ()\r
+ {\r
AssertEquals ("#01", "N+9", 0.0.ToString ("N+9", _nfi));\r
AssertEquals ("#02", "N+9", Double.MaxValue.ToString ("N+9", _nfi));\r
AssertEquals ("#03", "-N+9", Double.MinValue.ToString ("N+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test14018 () {\r
+ public void Test14018 ()\r
+ {\r
AssertEquals ("#01", "N-9", 0.0.ToString ("N-9", _nfi));\r
AssertEquals ("#02", "N-9", Double.MaxValue.ToString ("N-9", _nfi));\r
AssertEquals ("#03", "-N-9", Double.MinValue.ToString ("N-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test14019 () {\r
+ public void Test14019 ()\r
+ {\r
AssertEquals ("#01", "N0", 0.0.ToString ("N0,", _nfi));\r
AssertEquals ("#02", "N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("N0,", _nfi));\r
AssertEquals ("#03", "-N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("N0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test14020 () {\r
+ public void Test14020 ()\r
+ {\r
AssertEquals ("#01", "N0", 0.0.ToString ("N0.", _nfi));\r
AssertEquals ("#02", "N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("N0.", _nfi));\r
AssertEquals ("#03", "-N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("N0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test14021 () {\r
+ public void Test14021 ()\r
+ {\r
AssertEquals ("#01", "N0.0", 0.0.ToString ("N0.0", _nfi));\r
AssertEquals ("#02", "N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MaxValue.ToString ("N0.0", _nfi));\r
AssertEquals ("#03", "-N179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MinValue.ToString ("N0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test14022 () {\r
+ public void Test14022 ()\r
+ {\r
AssertEquals ("#01", "N09", 0.0.ToString ("N0.9", _nfi));\r
AssertEquals ("#02", "N1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MaxValue.ToString ("N0.9", _nfi));\r
AssertEquals ("#03", "-N1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MinValue.ToString ("N0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test14023 () {\r
+ public void Test14023 ()\r
+ {\r
AssertEquals ("#01", "999.1", 999.05.ToString ("N1", _nfi));\r
AssertEquals ("#02", "999.2", 999.15.ToString ("N1", _nfi));\r
AssertEquals ("#03", "999.3", 999.25.ToString ("N1", _nfi));\r
}\r
\r
[Test]\r
- public void Test14024 () {\r
+ public void Test14024 ()\r
+ {\r
AssertEquals ("#01", "999.91", 999.905.ToString ("N2", _nfi));\r
AssertEquals ("#02", "999.92", 999.915.ToString ("N2", _nfi));\r
AssertEquals ("#03", "999.93", 999.925.ToString ("N2", _nfi));\r
}\r
\r
[Test]\r
- public void Test14025 () {\r
+ public void Test14025 ()\r
+ {\r
AssertEquals ("#01", "999.99999999991", 999.999999999905.ToString ("N11", _nfi));\r
AssertEquals ("#02", "999.99999999992", 999.999999999915.ToString ("N11", _nfi));\r
AssertEquals ("#03", "999.99999999993", 999.999999999925.ToString ("N11", _nfi));\r
}\r
\r
[Test]\r
- public void Test14026 () {\r
+ public void Test14026 ()\r
+ {\r
AssertEquals ("#01", "999.999999999990", 999.9999999999905.ToString ("N12", _nfi));\r
AssertEquals ("#02", "999.999999999991", 999.9999999999915.ToString ("N12", _nfi));\r
AssertEquals ("#03", "999.999999999993", 999.9999999999925.ToString ("N12", _nfi));\r
}\r
\r
[Test]\r
- public void Test14027 () {\r
+ public void Test14027 ()\r
+ {\r
AssertEquals ("#01", "999.9999999999990", 999.99999999999905.ToString ("N13", _nfi));\r
AssertEquals ("#02", "999.9999999999990", 999.99999999999915.ToString ("N13", _nfi));\r
AssertEquals ("#03", "999.9999999999990", 999.99999999999925.ToString ("N13", _nfi));\r
}\r
\r
[Test]\r
- public void Test14028 () {\r
+ public void Test14028 ()\r
+ {\r
AssertEquals ("#01", "1", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("N0", _nfi));\r
AssertEquals ("#02", "1.234567890123", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("N12", _nfi));\r
AssertEquals ("#03", "1.2345678901235", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("N13", _nfi));\r
}\r
\r
[Test]\r
- public void Test14029 () {\r
+ public void Test14029 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NumberDecimalSeparator = "#";\r
AssertEquals ("#01", "-99,999,999#90", (-99999999.9).ToString ("N", nfi));\r
}\r
\r
[Test]\r
- public void Test14030 () {\r
+ public void Test14030 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test14031 () {\r
+ public void Test14031 ()\r
+ {\r
AssertEquals ("#01", "Infinity", (Double.MaxValue / 0.0).ToString ("N99", _nfi)); \r
AssertEquals ("#02", "-Infinity", (Double.MinValue / 0.0).ToString ("N99", _nfi)); \r
AssertEquals ("#03", "NaN", (0.0 / 0.0).ToString ("N99", _nfi)); \r
\r
// Test15000- Double and P\r
[Test]\r
- public void Test15000 () {\r
+ public void Test15000 ()\r
+ {\r
AssertEquals ("#01", "0.00 %", 0.0.ToString ("P", _nfi));\r
AssertEquals ("#02", "0.00 %", 0.0.ToString ("p", _nfi));\r
AssertEquals ("#03", "-17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00 %", Double.MinValue.ToString ("P", _nfi));\r
}\r
\r
[Test]\r
- public void Test15001 () {\r
+ public void Test15001 ()\r
+ {\r
AssertEquals ("#01", "P ", 0.0.ToString ("P ", _nfi));\r
AssertEquals ("#02", " P", 0.0.ToString (" P", _nfi));\r
AssertEquals ("#03", " P ", 0.0.ToString (" P ", _nfi));\r
}\r
\r
[Test]\r
- public void Test15002 () {\r
+ public void Test15002 ()\r
+ {\r
AssertEquals ("#01", "-P ", (-1.0).ToString ("P ", _nfi));\r
AssertEquals ("#02", "- P", (-1.0).ToString (" P", _nfi));\r
AssertEquals ("#03", "- P ", (-1.0).ToString (" P ", _nfi));\r
}\r
\r
[Test]\r
- public void Test15003 () {\r
+ public void Test15003 ()\r
+ {\r
AssertEquals ("#01", "0 %", 0.0.ToString ("P0", _nfi));\r
AssertEquals ("#02", "0.0000000000000000 %", 0.0.ToString ("P16", _nfi));\r
AssertEquals ("#03", "0.00000000000000000 %", 0.0.ToString ("P17", _nfi));\r
}\r
\r
[Test]\r
- public void Test15004 () {\r
+ public void Test15004 ()\r
+ {\r
AssertEquals ("#01", "17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 %", Double.MaxValue.ToString ("P0", _nfi));\r
AssertEquals ("#02", "17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.0000000000000000 %", Double.MaxValue.ToString ("P16", _nfi));\r
AssertEquals ("#03", "17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000 %", Double.MaxValue.ToString ("P17", _nfi));\r
}\r
\r
[Test]\r
- public void Test15005 () {\r
+ public void Test15005 ()\r
+ {\r
AssertEquals ("#01", "-17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 %", Double.MinValue.ToString ("P0", _nfi));\r
AssertEquals ("#02", "-17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.0000000000000000 %", Double.MinValue.ToString ("P16", _nfi));\r
AssertEquals ("#03", "-17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000 %", Double.MinValue.ToString ("P17", _nfi));\r
}\r
\r
[Test]\r
- public void Test15006 () {\r
+ public void Test15006 ()\r
+ {\r
AssertEquals ("#01", "PF", 0.0.ToString ("PF", _nfi));\r
AssertEquals ("#02", "P0F", 0.0.ToString ("P0F", _nfi));\r
AssertEquals ("#03", "P0xF", 0.0.ToString ("P0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test15007 () {\r
+ public void Test15007 ()\r
+ {\r
AssertEquals ("#01", "PF", Double.MaxValue.ToString ("PF", _nfi));\r
AssertEquals ("#02", "P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MaxValue.ToString ("P0F", _nfi));\r
AssertEquals ("#03", "P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MaxValue.ToString ("P0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test15008 () {\r
+ public void Test15008 ()\r
+ {\r
AssertEquals ("#01", "-PF", Double.MinValue.ToString ("PF", _nfi));\r
AssertEquals ("#02", "-P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F", Double.MinValue.ToString ("P0F", _nfi));\r
AssertEquals ("#03", "-P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xF", Double.MinValue.ToString ("P0xF", _nfi));\r
}\r
\r
[Test]\r
- public void Test15009 () {\r
+ public void Test15009 ()\r
+ {\r
AssertEquals ("#01", "0.00000000000000000 %", 0.0.ToString ("P0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#02", "17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000 %", Double.MaxValue.ToString ("P0000000000000000000000000000000000000017", _nfi));\r
AssertEquals ("#03", "-17,976,931,348,623,200,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000 %", Double.MinValue.ToString ("P0000000000000000000000000000000000000017", _nfi));\r
}\r
\r
[Test]\r
- public void Test15010 () {\r
+ public void Test15010 ()\r
+ {\r
AssertEquals ("#01", "+P", 0.0.ToString ("+P", _nfi));\r
AssertEquals ("#02", "P+", 0.0.ToString ("P+", _nfi));\r
AssertEquals ("#03", "+P+", 0.0.ToString ("+P+", _nfi));\r
}\r
\r
[Test]\r
- public void Test15011 () {\r
+ public void Test15011 ()\r
+ {\r
AssertEquals ("#01", "+P", Double.MaxValue.ToString ("+P", _nfi));\r
AssertEquals ("#02", "P+", Double.MaxValue.ToString ("P+", _nfi));\r
AssertEquals ("#03", "+P+", Double.MaxValue.ToString ("+P+", _nfi));\r
}\r
\r
[Test]\r
- public void Test15012 () {\r
+ public void Test15012 ()\r
+ {\r
AssertEquals ("#01", "-+P", Double.MinValue.ToString ("+P", _nfi));\r
AssertEquals ("#02", "-P+", Double.MinValue.ToString ("P+", _nfi));\r
AssertEquals ("#03", "-+P+", Double.MinValue.ToString ("+P+", _nfi));\r
}\r
\r
[Test]\r
- public void Test15013 () {\r
+ public void Test15013 ()\r
+ {\r
AssertEquals ("#01", "-P", 0.0.ToString ("-P", _nfi));\r
AssertEquals ("#02", "P-", 0.0.ToString ("P-", _nfi));\r
AssertEquals ("#03", "-P-", 0.0.ToString ("-P-", _nfi));\r
}\r
\r
[Test]\r
- public void Test15014 () {\r
+ public void Test15014 ()\r
+ {\r
AssertEquals ("#01", "-P", Double.MaxValue.ToString ("-P", _nfi));\r
AssertEquals ("#02", "P-", Double.MaxValue.ToString ("P-", _nfi));\r
AssertEquals ("#03", "-P-", Double.MaxValue.ToString ("-P-", _nfi));\r
}\r
\r
[Test]\r
- public void Test15015 () {\r
+ public void Test15015 ()\r
+ {\r
AssertEquals ("#01", "--P", Double.MinValue.ToString ("-P", _nfi));\r
AssertEquals ("#02", "-P-", Double.MinValue.ToString ("P-", _nfi));\r
AssertEquals ("#03", "--P-", Double.MinValue.ToString ("-P-", _nfi));\r
}\r
\r
[Test]\r
- public void Test15016 () {\r
+ public void Test15016 ()\r
+ {\r
AssertEquals ("#01", "P+0", 0.0.ToString ("P+0", _nfi));\r
AssertEquals ("#02", "P+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("P+0", _nfi));\r
AssertEquals ("#03", "-P+179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("P+0", _nfi));\r
}\r
\r
[Test]\r
- public void Test15017 () {\r
+ public void Test15017 ()\r
+ {\r
AssertEquals ("#01", "P+9", 0.0.ToString ("P+9", _nfi));\r
AssertEquals ("#02", "P+9", Double.MaxValue.ToString ("P+9", _nfi));\r
AssertEquals ("#03", "-P+9", Double.MinValue.ToString ("P+9", _nfi));\r
}\r
\r
[Test]\r
- public void Test15018 () {\r
+ public void Test15018 ()\r
+ {\r
AssertEquals ("#01", "P-9", 0.0.ToString ("P-9", _nfi));\r
AssertEquals ("#02", "P-9", Double.MaxValue.ToString ("P-9", _nfi));\r
AssertEquals ("#03", "-P-9", Double.MinValue.ToString ("P-9", _nfi));\r
}\r
\r
[Test]\r
- public void Test15019 () {\r
+ public void Test15019 ()\r
+ {\r
AssertEquals ("#01", "P0", 0.0.ToString ("P0,", _nfi));\r
AssertEquals ("#02", "P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("P0,", _nfi));\r
AssertEquals ("#03", "-P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("P0,", _nfi));\r
}\r
\r
[Test]\r
- public void Test15020 () {\r
+ public void Test15020 ()\r
+ {\r
AssertEquals ("#01", "P0", 0.0.ToString ("P0.", _nfi));\r
AssertEquals ("#02", "P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MaxValue.ToString ("P0.", _nfi));\r
AssertEquals ("#03", "-P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", Double.MinValue.ToString ("P0.", _nfi));\r
}\r
\r
[Test]\r
- public void Test15021 () {\r
+ public void Test15021 ()\r
+ {\r
AssertEquals ("#01", "P0.0", 0.0.ToString ("P0.0", _nfi));\r
AssertEquals ("#02", "P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MaxValue.ToString ("P0.0", _nfi));\r
AssertEquals ("#03", "-P179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0", Double.MinValue.ToString ("P0.0", _nfi));\r
}\r
\r
[Test]\r
- public void Test15022 () {\r
+ public void Test15022 ()\r
+ {\r
AssertEquals ("#01", "P09", 0.0.ToString ("P0.9", _nfi));\r
AssertEquals ("#02", "P1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MaxValue.ToString ("P0.9", _nfi));\r
AssertEquals ("#03", "-P1797693134862320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009", Double.MinValue.ToString ("P0.9", _nfi));\r
}\r
\r
[Test]\r
- public void Test15023 () {\r
+ public void Test15023 ()\r
+ {\r
AssertEquals ("#01", "999.1 %", 9.9905.ToString ("P1", _nfi));\r
AssertEquals ("#02", "999.2 %", 9.9915.ToString ("P1", _nfi));\r
AssertEquals ("#03", "999.3 %", 9.9925.ToString ("P1", _nfi));\r
}\r
\r
[Test]\r
- public void Test15024 () {\r
+ public void Test15024 ()\r
+ {\r
AssertEquals ("#01", "999.91 %", 9.99905.ToString ("P2", _nfi));\r
AssertEquals ("#02", "999.92 %", 9.99915.ToString ("P2", _nfi));\r
AssertEquals ("#03", "999.93 %", 9.99925.ToString ("P2", _nfi));\r
}\r
\r
[Test]\r
- public void Test15025 () {\r
+ public void Test15025 ()\r
+ {\r
AssertEquals ("#01", "999.99999999991 %", 9.99999999999905.ToString ("P11", _nfi));\r
AssertEquals ("#02", "999.99999999992 %", 9.99999999999915.ToString ("P11", _nfi));\r
AssertEquals ("#03", "999.99999999993 %", 9.99999999999925.ToString ("P11", _nfi));\r
}\r
\r
[Test]\r
- public void Test15026 () {\r
+ public void Test15026 ()\r
+ {\r
AssertEquals ("#01", "999.999999999991 %", 9.999999999999905.ToString ("P12", _nfi));\r
AssertEquals ("#02", "999.999999999991 %", 9.999999999999915.ToString ("P12", _nfi));\r
AssertEquals ("#03", "999.999999999993 %", 9.999999999999925.ToString ("P12", _nfi));\r
}\r
\r
[Test]\r
- public void Test15027 () {\r
+ public void Test15027 ()\r
+ {\r
AssertEquals ("#01", "999.9999999999990 %", 9.9999999999999905.ToString ("P13", _nfi));\r
AssertEquals ("#02", "999.9999999999990 %", 9.9999999999999915.ToString ("P13", _nfi));\r
AssertEquals ("#03", "999.9999999999990 %", 9.9999999999999925.ToString ("P13", _nfi));\r
}\r
\r
[Test]\r
- public void Test15028 () {\r
+ public void Test15028 ()\r
+ {\r
AssertEquals ("#01", "1", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("N0", _nfi));\r
AssertEquals ("#02", "1.234567890123", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("N12", _nfi));\r
AssertEquals ("#03", "1.2345678901235", 1.234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.ToString ("N13", _nfi));\r
}\r
\r
[Test]\r
- public void Test15029 () {\r
+ public void Test15029 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.PercentDecimalSeparator = "#";\r
AssertEquals ("#01", "-9,999,999,990#00 %", (-99999999.9).ToString ("P", nfi));\r
}\r
\r
[Test]\r
- public void Test15030 () {\r
+ public void Test15030 ()\r
+ {\r
NumberFormatInfo nfi = _nfi.Clone() as NumberFormatInfo;\r
nfi.NegativeSign = "+";\r
nfi.PositiveSign = "-";\r
}\r
\r
[Test]\r
- public void Test15031 () {\r
+ public void Test15031 ()\r
+ {\r
AssertEquals ("#01", "Infinity", (Double.MaxValue / 0.0).ToString ("N99", _nfi)); \r
AssertEquals ("#02", "-Infinity", (Double.MinValue / 0.0).ToString ("N99", _nfi)); \r
AssertEquals ("#03", "NaN", (0.0 / 0.0).ToString ("N99", _nfi)); \r
\r
// Test16000 - Double and R\r
[Test]\r
- public void Test16000 () {\r
+ public void Test16000 ()\r
+ {\r
AssertEquals ("#01", "1.2345678901234567", 1.2345678901234567890.ToString ("R", _nfi));\r
AssertEquals ("#02", "1.2345678901234567", 1.2345678901234567890.ToString ("r", _nfi));\r
AssertEquals ("#03", "1.2345678901234567", 1.2345678901234567890.ToString ("R0", _nfi));\r
// Test17000 - Double and X\r
[Test]\r
[ExpectedException (typeof (FormatException))]\r
- public void Test17000 () {\r
+ public void Test17000 ()\r
+ {\r
AssertEquals ("#01", "", 0.0.ToString ("X99", _nfi)); \r
}\r
}\r
using System.Threading;
using System.Globalization;
-namespace MonoTests.System {
-
+namespace MonoTests.System
+{
[TestFixture]
public class SingleFormatterTest
{
+ CultureInfo old_culture;
+
[SetUp]
- public void GetReady()
+ public void SetUp ()
{
- CultureInfo EnUs = new CultureInfo ("en-us", false);
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ CultureInfo EnUs = new CultureInfo ("en-US", false);
EnUs.NumberFormat.CurrencyNegativePattern = 0; // -1 = (1)
EnUs.NumberFormat.CurrencyDecimalSeparator = ".";
EnUs.NumberFormat.NumberGroupSeparator = ",";
EnUs.NumberFormat.NumberNegativePattern = 1; // -1 = -1
EnUs.NumberFormat.NumberDecimalDigits = 2;
-
//Set this culture for the current thread.
Thread.CurrentThread.CurrentCulture = EnUs;
}
[TearDown]
- public void Clean() {}
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
[Test]
[ExpectedException(typeof(FormatException))]
private void FormatStringTest(int TestNumber, float Number, string Format, string ExpectedResult)
{
- Assertion.AssertEquals ("SngF #" + TestNumber, ExpectedResult, Number.ToString(Format));
+ Assertion.AssertEquals ("SngF #" + TestNumber, ExpectedResult, Number.ToString(Format));
}
string GetPercent (string s)
using System;
using System.Globalization;
-using NUnit.Framework;
+using System.Threading;
-namespace MonoTests.System {
+using NUnit.Framework;
+namespace MonoTests.System
+{
[TestFixture]
- public class SingleTest : Assertion {
+ public class SingleTest : Assertion
+ {
+ CultureInfo old_culture;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+ }
+
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
[Test]
- public void Equals ()
+ public void Equals ()
{
Single s1 = 1f;
Single s2 = 1f;
{
Assert ("PositiveInfinity", Single.IsInfinity (Single.PositiveInfinity));
Assert ("NegativeInfinity", Single.IsInfinity (Single.NegativeInfinity));
- Assert ("12", !Single.IsInfinity(12));
- Assert ("NaN", !Single.IsInfinity (Single.NaN));
+ Assert ("12", !Single.IsInfinity(12));
+ Assert ("NaN", !Single.IsInfinity (Single.NaN));
}
[Test]
public void IsNegativeInfinity ()
{
Assert ("IsNegativeInfinity", Single.IsNegativeInfinity (Single.NegativeInfinity));
- Assert ("12", !Single.IsNegativeInfinity (12));
- Assert ("NaN", !Single.IsNegativeInfinity (Single.NaN));
+ Assert ("12", !Single.IsNegativeInfinity (12));
+ Assert ("NaN", !Single.IsNegativeInfinity (Single.NaN));
}
[Test]
public void IsPositiveInfinity ()
{
Assert ("PositiveInfinity", Single.IsPositiveInfinity (Single.PositiveInfinity));
- Assert ("12", !Single.IsPositiveInfinity (12));
- Assert ("NaN", !Single.IsPositiveInfinity (Single.NaN));
+ Assert ("12", !Single.IsPositiveInfinity (12));
+ Assert ("NaN", !Single.IsPositiveInfinity (Single.NaN));
}
[Test]
AssertEquals ("ToString(empty)", def, i.ToString (String.Empty));
AssertEquals ("ToString(null,null)", def, i.ToString (null, null));
AssertEquals ("ToString(empty,null)", def, i.ToString (String.Empty, null));
-
AssertEquals ("ToString(G)", "254.9", def);
}
#if NET_2_0
- [Test]
+ [Test] // bug #72221
[ExpectedException (typeof (ArgumentException))]
public void HexNumber_WithHexToParse ()
{
- // from bug #72221
float f;
Single.TryParse ("0dead", NumberStyles.HexNumber, null, out f);
}
[TestFixture]
public class StringComparerTest
{
+ private CultureInfo old_culture;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+ }
+
+ [TearDown]
+ public void TearDown ()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
[Test]
public void Serialize_CurrentCulture ()
{