You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2014/10/03 18:33:36 UTC
svn commit: r1629251 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting:
functionTests/tests/lang/MathTrigFunctionsTest.java junit/BaseTestCase.java
Author: rhillegas
Date: Fri Oct 3 16:33:35 2014
New Revision: 1629251
URL: http://svn.apache.org/r1629251
Log:
DERBY-6755: Adjust MathTrigFunctionsTest to account for discrepancy introduced by Java 9; commit derby-6755-01-aa-java9diff.diff.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java?rev=1629251&r1=1629250&r2=1629251&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MathTrigFunctionsTest.java Fri Oct 3 16:33:35 2014
@@ -676,15 +676,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/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=1629251&r1=1629250&r2=1629251&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Fri Oct 3 16:33:35 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;
@@ -1220,6 +1221,22 @@ 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 = AccessController.doPrivileged
+ (new PrivilegedAction<String>(){
+ public String 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 {