2002-06-11 Nick Drochak <ndrochak@gol.com>
authorNick Drochak <nickd@mono-cvs.ximian.com>
Mon, 10 Jun 2002 11:34:07 +0000 (11:34 -0000)
committerNick Drochak <nickd@mono-cvs.ximian.com>
Mon, 10 Jun 2002 11:34:07 +0000 (11:34 -0000)
* 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.

svn path=/trunk/mcs/; revision=5202

mcs/class/corlib/Test/System/ChangeLog
mcs/class/corlib/Test/System/Int64Test.cs
mcs/class/corlib/Test/System/MathTest.cs

index 57c2ae70967436fb60490dba17a2608f48516164..692cade9841bbdf382ae13e6d2d815fe9be7343a 100644 (file)
@@ -1,3 +1,9 @@
+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
index 28a502dfa34ec4bbaaa713438f21482f2c56ecae..2cb4473cc6fbb7637fb14c1b7517282f6d0a3341 100644 (file)
@@ -10,6 +10,7 @@
 using NUnit.Framework;
 using System;
 using System.Globalization;
+using System.Threading;
 
     /// <summary>
     /// Tests for System.Int64
@@ -72,8 +73,15 @@ public class Int64Test : TestCase
                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');
@@ -96,6 +104,11 @@ public class Int64Test : TestCase
                NfiUser.PercentSymbol = "%%%";
        }
 
+       protected override void TearDown()
+       {
+               Thread.CurrentThread.CurrentCulture = old_culture;
+       }
+
        public void TestMinMax()
        {
                
index 83b069e7ede701a9931bf14876affd7ec7e775db..a6b8feb799a3992a2882026fa63a7607431b0737 100755 (executable)
@@ -277,7 +277,7 @@ public class MathTest : TestCase {
                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)));