[Mono-devel-list] More Unittest (System.DoubleFormatter)
yoros at wanadoo.es
yoros at wanadoo.es
Sat May 17 13:30:16 EDT 2003
On Sat, May 17, 2003 at 08:35:41AM +0200, yoros at wanadoo.es wrote:
> On Sat, May 17, 2003 at 08:11:11AM +0200, Patrick Kalkman wrote:
> > Hello,
> >
> > I made 2 unit testclasses to test System.SingleFormatter and
> > System.DoubleFormatter. Could someone check them in CVS ?
> >
> > They don't run clean on Mono :( but that's where the tests are for.
> >
> > On to the next one,
> >
> > Patrick Kalkman
> >
> > ps. Sorry for the 2 posts but the list don't allow posts bigger than 80kb.
>
> Ok, I took the two tests, I'm trying to fix the bugs found in the
> formatter and I must talk about the inclussion of "DoubleFormatterTest"
> and "SingleFormatterTest", include only "FloatingPointFormatterTest" or
> include all inside "DoubleTest" and "SingleTest" because
> DoubleFormatter, SingleFormatter and FloatingPointFormatter are
> "internal" classes, not public, not standard...
I've fixed a few mistakes in the formatting. Now, I encourage you to
change your TestCase file and add more specific NumberFormat options
because they can differ from one system to another. Here I send you one
example that sets all NumberFormatInfo options and generates a lot of
test messages. You can use this file to generate more tests and add them
to your test file. Thank you.
Regards,
Pedro
--
Pedro Martínez Juliá
\ yoros at terra.es
)| yoros at wanadoo.es
/ http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information: pub 1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E 534F 588B E285 74F1 D3AC
-------------- next part --------------
using System;
using System.Globalization;
public class EntryPoint {
public static void Main (string[] args) {
NumberFormatInfo formato = new NumberFormatInfo();
formato.NaNSymbol = "NaN";
formato.PositiveSign = "+";
formato.NegativeSign = "-";
formato.PerMilleSymbol = "x";
formato.PositiveInfinitySymbol = "Infinity";
formato.NegativeInfinitySymbol = "-Infinity";
formato.NumberDecimalDigits = 5;
formato.NumberDecimalSeparator = ",";
formato.NumberGroupSeparator = ".";
formato.NumberGroupSizes = new int[] {3};
formato.NumberNegativePattern = 2;
formato.CurrencyDecimalDigits = 2;
formato.CurrencyDecimalSeparator = ",";
formato.CurrencyGroupSeparator = ".";
formato.CurrencyGroupSizes = new int[] {3};
formato.CurrencyNegativePattern = 8;
formato.CurrencyPositivePattern = 3;
formato.CurrencySymbol = "EUR";
formato.PercentDecimalDigits = 5;
formato.PercentDecimalSeparator = ",";
formato.PercentGroupSeparator = ".";
formato.PercentGroupSizes = new int[] {3};
formato.PercentNegativePattern = 0;
formato.PercentPositivePattern = 0;
formato.PercentSymbol = "%";
double[] dobles = { 0.0, 0.1, 1.0, 1.1, 1.4, 1.5, 1.6, -0.1, -1.0,
-1.1, -1.4, -1.5, -1.6, Double.Epsilon, Double.MaxValue,
Double.MinValue, Double.NaN, Double.NegativeInfinity,
Double.PositiveInfinity, 0.001, -0.001, 1000, -1000,
1000.1, -1000.1, 1000.001, -1000.001 };
string[] formatos = { "N", "C", "P", "F", "G", "P", "E", "R" };
foreach(string form in formatos) {
Console.WriteLine("FORMATO -> " + form);
foreach(double d in dobles) {
Console.WriteLine(d.ToString(form, formato));
}
Console.WriteLine();
}
}
}
More information about the Mono-devel-list
mailing list