+2002-06-11 Nick Drochak <ndrochak@gol.com>
+
+ * Int64Test.cs: Set the culture to en-US for testing.
+ * MathTest.cs: mono is more precise in Log2, so change test to compare
+ values within a slightly larger margin of error.
+
2002/06/10 Nick Drochak <ndrochak@gol.com>
* DecimalTest.cs: More culture indepenence. Fixes the problems we were
using NUnit.Framework;
using System;
using System.Globalization;
+using System.Threading;
/// <summary>
/// Tests for System.Int64
get { return new TestSuite(typeof(Int64Test)); }
}
+ private CultureInfo old_culture;
+
protected override void SetUp()
{
+ 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);
+
int cdd = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits;
string csym = NumberFormatInfo.CurrentInfo.CurrencySymbol;
string csuffix = (cdd > 0 ? "." : "").PadRight(cdd + (cdd > 0 ? 1 : 0), '0');
NfiUser.PercentSymbol = "%%%";
}
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
public void TestMinMax()
{
double a = Math.Log(x, y);
double b = -0.83251695325303621;
- Assert(a + " != " + b + " because diff is " + Math.Abs(a - b), (Math.Abs(a - b) <= double.Epsilon));
+ Assert(a + " != " + b + " because diff is " + Math.Abs(a - b), (Math.Abs(a - b) <= 1e-14));
Assert(double.IsNaN(Math.Log(-1, y)));
Assert(double.IsNaN(Math.Log(double.NaN, y)));
Assert(double.IsNaN(Math.Log(x, double.NaN)));