db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1629284 - in /db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting: functionTests/tests/lang/MathTrigFunctionsTest.java junit/BaseTestCase.java
Date Fri, 03 Oct 2014 18:45:32 GMT
Author: rhillegas
Date: Fri Oct  3 18:45:32 2014
New Revision: 1629284

URL: http://svn.apache.org/r1629284
Log:
DERBY-6755: Port 1629251 (derby-6755-01-aa-java9diff.diff) from trunk to 10.10 branch.

Modified:
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java?rev=1629284&r1=1629283&r2=1629284&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java
Fri Oct  3 18:45:32 2014
@@ -569,15 +569,15 @@ public class MathTrigFunctionsTest exten
 
         // Numbers below verified by using lava.lang.StrictMath.toRadians
         // outside Derby context. First number: argument to ps and psFN, second
-        // number: expected result.
+        // number: expected result. Actual results vary by JVM level. See DERBY-6755.
         double[][] inOut = new double[][] {
             {180.0d, java.lang.StrictMath.PI},
             {PRE_DERBY_3398_SMALLEST_NEG_DERBY_DOUBLE, -3.1375609430176863E306},
             {DOUBLE_MIN_NORMAL, 3.8834864931005E-310},
             {Double.MIN_VALUE, 0.0d},
             {Double.MAX_VALUE, 3.1375664143845866E306},
-            {PRE_DERBY_3398_SMALLEST_POS_DERBY_DOUBLE, 3.88335758568738E-309},
-            {PRE_DERBY_3398_LARGEST_NEG_DERBY_DOUBLE, -3.88335758568738E-309},
+            {PRE_DERBY_3398_SMALLEST_POS_DERBY_DOUBLE, vmAtLeast( 1, 9 ) ? 3.883357585687384E-309
: 3.88335758568738E-309},
+            {PRE_DERBY_3398_LARGEST_NEG_DERBY_DOUBLE, vmAtLeast( 1, 9 ) ? -3.883357585687384E-309
: -3.88335758568738E-309},
         };
 
         for (int i=0; i < inOut.length; i++) {

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1629284&r1=1629283&r2=1629284&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
Fri Oct  3 18:45:32 2014
@@ -19,6 +19,7 @@
  */
 package org.apache.derbyTesting.junit;
 
+import org.apache.derbyTesting.functionTests.harness.JavaVersionHolder;
 import org.apache.derbyTesting.functionTests.util.PrivilegedFileOpsForTests;
 import junit.framework.Assert;
 import junit.framework.TestCase;
@@ -1158,6 +1159,24 @@ public abstract class BaseTestCase
         }
     }
 
+    /** Return true if the JVM is at least at the indicated rev level */
+    public static boolean vmAtLeast( int major, int minor )
+    {
+        String version = (String) AccessController.doPrivileged
+            (new PrivilegedAction()
+                {
+                    public Object run()
+                    {
+                        return System.getProperty( "java.version" );
+                    }
+                }
+            );
+                   
+        JavaVersionHolder jvh =  new JavaVersionHolder( version );
+
+        return jvh.atLeast( major, minor );
+    }
+
     /** Makes the current thread sleep up to {@code ms} milliseconds. */
     public static void sleep(long ms) {
         try {



Mime
View raw message