commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r802546 - in /commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla: AbstractNablaTest.java AbstractStaticFunctionsTest.java
Date Sun, 09 Aug 2009 14:34:49 GMT
Author: luc
Date: Sun Aug  9 14:34:49 2009
New Revision: 802546

URL: http://svn.apache.org/viewvc?rev=802546&view=rev
Log:
improved test coverage

Modified:
    commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractNablaTest.java
    commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractStaticFunctionsTest.java

Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractNablaTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractNablaTest.java?rev=802546&r1=802545&r2=802546&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractNablaTest.java
(original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractNablaTest.java
Sun Aug  9 14:34:49 2009
@@ -71,7 +71,8 @@
 
     @Test
     public void testSign() {
-        defaultMonadicTest("abs");
+        checkMonadicFunction(getNablaClass(), getJavaClass(), "abs",
+                             -0.1, 0.3, 10, 1.0e-20, 2.0e-12);
         defaultMonadicTest("signum");
         defaultDiadicTest("copySign");
     }

Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractStaticFunctionsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractStaticFunctionsTest.java?rev=802546&r1=802545&r2=802546&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractStaticFunctionsTest.java
(original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/AbstractStaticFunctionsTest.java
Sun Aug  9 14:34:49 2009
@@ -44,7 +44,7 @@
 
     protected void defaultDiadicTest(String name) {
         checkDiadicFunction(getNablaClass(), getJavaClass(), name,
-                            1.0, 4.0, 4, 2.0, 7.0, 6, 1.0e-15, 1.0e-11);
+                            -3.0, 3.0, 4, -3.0, 7.0, 6, 1.0e-15, 1.0e-11);
     }
 
     /** Check a monadic static function in a range.
@@ -172,6 +172,13 @@
             double d = ((Double) javaMethod.invoke(null, javaArgs)).doubleValue();
 
             // check the nabla and java classes compute the same function
+            if (Math.abs(d - dp.getValue()) > valueTolerance) {
+                nablaArgs = convert(nablaMethod.getParameterTypes(), argsSet);
+                javaArgs = convert(javaMethod.getParameterTypes(), argsSet);
+                d = ((Double) javaMethod.invoke(null, javaArgs)).doubleValue();
+                dp = (DifferentialPair) nablaMethod.invoke(null, nablaArgs);
+                
+            }
             Assert.assertEquals(d, dp.getValue(), valueTolerance);
 
         } catch (InvocationTargetException ite) {



Mime
View raw message