Assert.AreEqual (-2.1M, Math.Round (-2.08M, 1, m), "#15");
Assert.AreEqual (-3.1M, Math.Round (-3.05M, 1, m), "#16");
}
+
+ [Test] // bug #4814
+ [SetCulture("")]
+ public void Parse_NumberGroupSeparatorIsEmpty_DoNotThrowIndexOutOfRangeException ()
+ {
+ NumberFormatInfo nf = new NumberFormatInfo ();
+ nf.NumberGroupSeparator = "";
+ Decimal.Parse ("1.5", nf);
+ }
+
+ [Test] // bug #4814
+ [SetCulture("")]
+ public void Parse_CurrencyGroupSeparatorIsEmpty_DoNotThrowIndexOutOfRangeException ()
+ {
+ NumberFormatInfo nf = new NumberFormatInfo ();
+ nf.CurrencyGroupSeparator = "";
+ Decimal.Parse ("\u00A41.5", NumberStyles.Currency, nf);
+ }
+
+ [Test] // bug #4814
+ [SetCulture("")]
+ public void Parse_LeadingSign_PositiveSignIsEmpty_DoNotThrowIndexOutOfRangeException ()
+ {
+ NumberFormatInfo nf = new NumberFormatInfo ();
+ nf.PositiveSign = "";
+ try {
+ Decimal.Parse ("+15", nf);
+ } catch (FormatException) {
+ // ok
+ }
+ }
+
+ [Test] // bug #4814
+ [SetCulture("")]
+ public void Parse_LeadingSign_NegativeSignIsEmpty_DoNotThrowIndexOutOfRangeException ()
+ {
+ NumberFormatInfo nf = new NumberFormatInfo ();
+ nf.NegativeSign = "";
+ try {
+ Decimal.Parse ("-15", nf);
+ } catch (FormatException) {
+ // ok
+ }
+ }
+
+ [Test] // bug #4814
+ [SetCulture("")]
+ public void Parse_TrailingSign_PositiveSignIsEmpty_DoNotThrowIndexOutOfRangeException ()
+ {
+ NumberFormatInfo nf = new NumberFormatInfo ();
+ nf.PositiveSign = "";
+ try {
+ Decimal.Parse ("15+", nf);
+ } catch (FormatException) {
+ // ok
+ }
+ }
+
+ [Test] // bug #4814
+ [SetCulture("")]
+ public void Parse_TrailingSign_NegativeSignIsEmpty_DoNotThrowIndexOutOfRangeException ()
+ {
+ NumberFormatInfo nf = new NumberFormatInfo ();
+ nf.NegativeSign = "";
+ try {
+ Decimal.Parse ("15-", nf);
+ } catch (FormatException) {
+ // ok
+ }
+ }
}
}