Author: luc
Date: Sun Aug 9 09:58:34 2009
New Revision: 802503
URL: http://svn.apache.org/viewvc?rev=802503&view=rev
Log:
converted tests to Junit 4 style
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
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AbstractMathTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AutomaticDifferentiatorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/analysis/ErrorReporterTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DAddGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DDivGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DMulGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DNegGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DRemGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DSubGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcosGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcoshGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinhGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Atan2GeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanhGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CbrtGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CosGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CoshGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/ExpGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Expm1GeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/HypotGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log10GeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log1pGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/LogGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/PowGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinhGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SqrtGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanhGeneratorTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/core/DifferentialPairTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/AbstractFiniteDifferencesTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/EightPointsSchemeTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/FourPointsSchemeTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/SixPointsSchemeTest.java
commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/TwoPointsSchemeTest.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=802503&r1=802502&r2=802503&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 09:58:34 2009
@@ -16,8 +16,11 @@
*/
package org.apache.commons.nabla;
+import org.junit.Test;
+
public abstract class AbstractNablaTest extends AbstractStaticFunctionsTest {
+ @Test
public void testExponential() {
defaultMonadicTest("exp");
defaultMonadicTest("expm1");
@@ -26,6 +29,7 @@
defaultMonadicTest("log10");
}
+ @Test
public void testCircular() {
defaultMonadicTest("cos");
defaultMonadicTest("sin");
@@ -39,6 +43,7 @@
-0.1, 0.3, 3, -0.7, 0.7, 15, 1.0e-15, 1.0e-12);
}
+ @Test
public void testHyperbolic() {
defaultMonadicTest("cosh");
@@ -54,6 +59,7 @@
}
+ @Test
public void testPower() {
defaultMonadicTest("sqrt");
defaultMonadicTest("cbrt");
@@ -63,12 +69,14 @@
0.1, 0.3, 3, 0.7, 1.5, 15, 1.0e-15, 1.0e-11);
}
+ @Test
public void testSign() {
defaultMonadicTest("abs");
defaultMonadicTest("signum");
defaultDiadicTest("copySign");
}
+ @Test
public void testNeighborhood() {
defaultMonadicTest("floor");
defaultMonadicTest("rint");
@@ -77,6 +85,7 @@
defaultDiadicTest("nextAfter");
}
+ @Test
public void testEncoding() {
defaultMonadicTest("ulp");
checkFunction(getNablaClass(), getJavaClass(),
@@ -90,11 +99,13 @@
0.1, 0.3, 3, 12, 17, 3, 1.0e-15, 1.0e-8);
}
+ @Test
public void testConversion() {
defaultMonadicTest("toDegrees");
defaultMonadicTest("toRadians");
}
+ @Test
public void testComparison() {
checkDiadicFunction(getNablaClass(), getJavaClass(), "max",
0.1, 0.3, 3, 0.15, 0.35, 3, 1.0e-20, 1.0e-15);
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=802503&r1=802502&r2=802503&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 09:58:34 2009
@@ -22,18 +22,10 @@
import org.apache.commons.nabla.core.DifferentialPair;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
import org.apache.commons.nabla.differences.EightPointsScheme;
+import org.junit.Assert;
-import junit.framework.TestCase;
-public abstract class AbstractStaticFunctionsTest extends TestCase {
-
- public AbstractStaticFunctionsTest() {
- super();
- }
-
- public AbstractStaticFunctionsTest(String name) {
- super(name);
- }
+public abstract class AbstractStaticFunctionsTest {
/** Get the nabla class to test (either NablaMath or NablaStrictMath).
* @return nabla class
@@ -156,7 +148,7 @@
}
} catch (NoSuchMethodException nsme) {
- fail(nsme.getMessage());
+ Assert.fail(nsme.getMessage());
}
}
@@ -180,12 +172,12 @@
double d = ((Double) javaMethod.invoke(null, javaArgs)).doubleValue();
// check the nabla and java classes compute the same function
- assertEquals(d, dp.getValue(), valueTolerance);
+ Assert.assertEquals(d, dp.getValue(), valueTolerance);
} catch (InvocationTargetException ite) {
- fail(ite.getMessage());
+ Assert.fail(ite.getMessage());
} catch (IllegalAccessException iae) {
- fail(iae.getMessage());
+ Assert.fail(iae.getMessage());
}
}
@@ -226,13 +218,13 @@
}).f(DifferentialPair.newVariable(0.0));
// check the nabla and java classes compute the same differential
- assertEquals(differencesDP.getFirstDerivative(), nablaDP.getFirstDerivative(),
- differentialTolerance);
+ Assert.assertEquals(differencesDP.getFirstDerivative(), nablaDP.getFirstDerivative(),
+ differentialTolerance);
} catch (InvocationTargetException ite) {
- fail(ite.getMessage());
+ Assert.fail(ite.getMessage());
} catch (IllegalAccessException iae) {
- fail(iae.getMessage());
+ Assert.fail(iae.getMessage());
}
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AbstractMathTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AbstractMathTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AbstractMathTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AbstractMathTest.java Sun Aug 9 09:58:34 2009
@@ -20,10 +20,10 @@
import org.apache.commons.nabla.core.DifferentialPair;
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
+import org.junit.Assert;
-import junit.framework.TestCase;
-public abstract class AbstractMathTest extends TestCase {
+public abstract class AbstractMathTest {
protected void checkReference(ReferenceFunction reference,
double t0, double t1, int n,
@@ -35,10 +35,10 @@
for (int i = 0; i < n; ++i) {
double t = ((n - 1 - i) * t0 + i * t1) / (n - 1);
DifferentialPair dpT = DifferentialPair.newVariable(t);
- assertEquals(reference.fPrime(t), derivative.f(dpT).getFirstDerivative(), threshold);
+ Assert.assertEquals(reference.fPrime(t), derivative.f(dpT).getFirstDerivative(), threshold);
}
} catch (DifferentiationException de) {
- fail(de.getMessage());
+ Assert.fail(de.getMessage());
}
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AutomaticDifferentiatorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AutomaticDifferentiatorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AutomaticDifferentiatorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/AutomaticDifferentiatorTest.java Sun Aug 9 09:58:34 2009
@@ -17,9 +17,11 @@
package org.apache.commons.nabla.automatic;
import org.apache.commons.nabla.ReferenceFunction;
+import org.junit.Test;
public class AutomaticDifferentiatorTest extends AbstractMathTest {
+ @Test
public void testSingleCall() {
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.cos(t); }
@@ -27,6 +29,7 @@
}, 0, 2 * Math.PI, 20, 0.0);
}
+ @Test
public void testEmbeddedCalls() {
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.exp(Math.sin(t)); }
@@ -34,6 +37,7 @@
}, 0.1, 10, 20, 0);
}
+ @Test
public void testParameterIndependent() {
checkReference(new ReferenceFunction() {
public double f(double t) { return 1; }
@@ -41,6 +45,7 @@
}, 0.1, 5, 20, 2.0e-12);
}
+ @Test
public void testSimpleExpression() {
checkReference(new ReferenceFunction() {
public double f(double t) { return 1.0 / t; }
@@ -48,6 +53,7 @@
}, 0.1, 5, 20, 2.0e-12);
}
+ @Test
public void testMul() {
checkReference(new ReferenceFunction() {
public double f(double t) { return t * t; }
@@ -55,6 +61,7 @@
}, 0.1, 5, 20, 2.0e-12);
}
+ @Test
public void testPolynomialExpression() {
checkReference(new ReferenceFunction() {
public double f(double t) { return (((4 * t + 2) * t + 1) * t - 2) * t + 5; }
@@ -62,6 +69,7 @@
}, 0.1, 5, 20, 2.0e-12);
}
+ @Test
public void testNarrowing() {
checkReference(new ReferenceFunction() {
public double f(double t) { return t - (int) t; }
@@ -69,6 +77,7 @@
}, 0.1, 5, 20, 0);
}
+ @Test
public void testLocalVariables() {
checkReference(new ReferenceFunction() {
public double f(double t) { double threeT = 3 * t; return threeT * threeT; }
@@ -76,6 +85,7 @@
}, -5, 5, 20, 2.0e-14);
}
+ @Test
public void testLoopLdc() {
checkReference(new ReferenceFunction() {
public double f(double t) {
@@ -89,6 +99,7 @@
}, -5, 5, 20, 4.0e-14);
}
+ @Test
public void testLoopDcons() {
checkReference(new ReferenceFunction() {
public double f(double t) {
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/analysis/ErrorReporterTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/analysis/ErrorReporterTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/analysis/ErrorReporterTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/analysis/ErrorReporterTest.java Sun Aug 9 09:58:34 2009
@@ -16,28 +16,31 @@
*/
package org.apache.commons.nabla.automatic.analysis;
+import org.junit.Assert;
+
import org.apache.commons.nabla.automatic.analysis.ErrorReporter;
import org.apache.commons.nabla.core.DifferentiationException;
+import org.junit.Test;
-import junit.framework.TestCase;
-public class ErrorReporterTest extends TestCase {
+public class ErrorReporterTest {
+ @Test
public void testReport() {
ErrorReporter reporter = new ErrorReporter();
- assertFalse(reporter.hasError());
+ Assert.assertFalse(reporter.hasError());
wrappingFunction(false, reporter);
- assertFalse(reporter.hasError());
+ Assert.assertFalse(reporter.hasError());
try {
reporter.reportErrors();
} catch (DifferentiationException de) {
- fail("unexpected exception caught");
+ Assert.fail("unexpected exception caught");
}
wrappingFunction(true, reporter);
- assertTrue(reporter.hasError());
+ Assert.assertTrue(reporter.hasError());
try {
reporter.reportErrors();
- fail("an exception should have been thrown");
+ Assert.fail("an exception should have been thrown");
} catch (DifferentiationException de) {
// expected behavior
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DAddGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DAddGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DAddGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DAddGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class DAddGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t + 5; }
@@ -28,6 +30,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return 5 + t; }
@@ -35,6 +38,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testReference12(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t + t; }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DDivGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DDivGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DDivGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DDivGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class DDivGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t / 5; }
@@ -28,6 +30,7 @@
}, 0.1, 10, 30, 0.0);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return 5 / t; }
@@ -35,6 +38,7 @@
}, 0.5, 10, 30, 1e-15);
}
+ @Test
public void testReference12(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t / t; }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DMulGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DMulGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DMulGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DMulGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class DMulGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t * 5; }
@@ -28,6 +30,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return 5 * t; }
@@ -35,6 +38,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testReference12(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t * t; }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DNegGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DNegGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DNegGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DNegGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class DNegGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return -t; }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DRemGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DRemGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DRemGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DRemGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class DRemGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t % 5; }
@@ -28,6 +30,7 @@
}, 0.1, 10, 30, 0.0);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return 5 % t; }
@@ -35,6 +38,7 @@
}, 0.5, 10, 30, 1e-15);
}
+ @Test
public void testReference12(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t % t; }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DSubGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DSubGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DSubGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/arithmetic/DSubGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class DSubGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t - 5; }
@@ -28,6 +30,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return 5 - t; }
@@ -35,6 +38,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testReference12(){
checkReference(new ReferenceFunction() {
public double f(double t) { return t - t; }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcosGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcosGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcosGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcosGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -23,9 +23,12 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
+import org.junit.Assert;
+import org.junit.Test;
public class AcosGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.acos(t); }
@@ -33,6 +36,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testSingularityPlus() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -40,15 +44,16 @@
});
double dPlus = derivative.f(new DifferentialPair(1, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus > 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus > 0);
double dMinus = derivative.f(new DifferentialPair(1, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus < 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus < 0);
}
+ @Test
public void testSingularityMinus() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -56,12 +61,12 @@
});
double dPlus = derivative.f(new DifferentialPair(-1, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus > 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus > 0);
double dMinus = derivative.f(new DifferentialPair(-1, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus < 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus < 0);
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcoshGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcoshGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcoshGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AcoshGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class AcoshGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return MathExtensions.acosh(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -23,9 +23,12 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
+import org.junit.Assert;
+import org.junit.Test;
public class AsinGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.asin(t); }
@@ -33,6 +36,7 @@
}, -0.99, 0.99, 30, 0.0);
}
+ @Test
public void testSingularityPlus() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -40,15 +44,16 @@
});
double dPlus = derivative.f(new DifferentialPair(1, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus < 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus < 0);
double dMinus = derivative.f(new DifferentialPair(1, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus > 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus > 0);
}
+ @Test
public void testSingularityMinus() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -56,12 +61,12 @@
});
double dPlus = derivative.f(new DifferentialPair(-1, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus < 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus < 0);
double dMinus = derivative.f(new DifferentialPair(-1, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus > 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus > 0);
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinhGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinhGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinhGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AsinhGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class AsinhGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return MathExtensions.asinh(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Atan2GeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Atan2GeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Atan2GeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Atan2GeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class Atan2GeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.atan2(t, 3.0); }
@@ -28,6 +30,7 @@
}, -2, 2, 50, 2e-15);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.atan2(3.0, t); }
@@ -35,6 +38,7 @@
}, -2, 2, 50, 0.0);
}
+ @Test
public void testReference12Aligned(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.atan2(t, t); }
@@ -42,6 +46,7 @@
}, 0.1, 10, 20, 0);
}
+ @Test
public void testReference12Shifted(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.atan2(t, t + 1); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -23,9 +23,12 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
+import org.junit.Assert;
+import org.junit.Test;
public class AtanGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.atan(t); }
@@ -33,6 +36,7 @@
}, -1.5, 1.5, 30, 0.0);
}
+ @Test
public void testSingularityPlus() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -40,13 +44,14 @@
});
double dPlus = derivative.f(new DifferentialPair(Double.POSITIVE_INFINITY, 1)).getFirstDerivative();
- assertEquals(0, dPlus, 0);
+ Assert.assertEquals(0, dPlus, 0);
double dMinus = derivative.f(new DifferentialPair(Double.POSITIVE_INFINITY, -1)).getFirstDerivative();
- assertEquals(0, dMinus, 0);
+ Assert.assertEquals(0, dMinus, 0);
}
+ @Test
public void testSingularityMinus() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -54,10 +59,10 @@
});
double dPlus = derivative.f(new DifferentialPair(Double.NEGATIVE_INFINITY, 1)).getFirstDerivative();
- assertEquals(0, dPlus, 0);
+ Assert.assertEquals(0, dPlus, 0);
double dMinus = derivative.f(new DifferentialPair(Double.NEGATIVE_INFINITY, -1)).getFirstDerivative();
- assertEquals(0, dMinus, 0);
+ Assert.assertEquals(0, dMinus, 0);
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanhGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanhGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanhGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/AtanhGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class AtanhGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return MathExtensions.atanh(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CbrtGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CbrtGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CbrtGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CbrtGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class CbrtGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.cbrt(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CosGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CosGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CosGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CosGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class CosGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.cos(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CoshGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CoshGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CoshGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/CoshGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class CoshGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.cosh(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/ExpGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/ExpGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/ExpGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/ExpGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class ExpGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.exp(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Expm1GeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Expm1GeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Expm1GeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Expm1GeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class Expm1GeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.expm1(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/HypotGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/HypotGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/HypotGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/HypotGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class HypotGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.hypot(t, 3.0); }
@@ -28,6 +30,7 @@
}, -2, 2, 50, 2e-15);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.hypot(3.0, t); }
@@ -35,6 +38,7 @@
}, -2, 2, 50, 0.0);
}
+ @Test
public void testReference12Aligned(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.hypot(t, t); }
@@ -42,6 +46,7 @@
}, 0.1, 10, 20, 3.0e-16);
}
+ @Test
public void testReference12Shifted(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.hypot(t, t + 1); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log10GeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log10GeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log10GeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log10GeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -23,9 +23,12 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
+import org.junit.Assert;
+import org.junit.Test;
public class Log10GeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.log10(t); }
@@ -33,6 +36,7 @@
}, 0.1, 10, 50, 0.0);
}
+ @Test
public void testSingularity() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -40,12 +44,12 @@
});
double dPlus = derivative.f(new DifferentialPair(0, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus > 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus > 0);
double dMinus = derivative.f(new DifferentialPair(0, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus < 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus < 0);
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log1pGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log1pGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log1pGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/Log1pGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -23,9 +23,12 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
+import org.junit.Assert;
+import org.junit.Test;
public class Log1pGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.log1p(t); }
@@ -33,6 +36,7 @@
}, -0.2, 0.2, 50, 0.0);
}
+ @Test
public void testSingularity() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -40,12 +44,12 @@
});
double dPlus = derivative.f(new DifferentialPair(-1, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus > 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus > 0);
double dMinus = derivative.f(new DifferentialPair(-1, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus < 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus < 0);
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/LogGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/LogGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/LogGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/LogGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -23,9 +23,12 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
+import org.junit.Assert;
+import org.junit.Test;
public class LogGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.log(t); }
@@ -33,6 +36,7 @@
}, 0.1, 10, 50, 0.0);
}
+ @Test
public void testSingularity() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -40,12 +44,12 @@
});
double dPlus = derivative.f(new DifferentialPair(0, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus > 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus > 0);
double dMinus = derivative.f(new DifferentialPair(0, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus < 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus < 0);
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/PowGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/PowGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/PowGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/PowGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class PowGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference1(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.pow(t, 3.0); }
@@ -28,6 +30,7 @@
}, -2, 2, 50, 2e-15);
}
+ @Test
public void testReference2(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.pow(3.0, t); }
@@ -35,6 +38,7 @@
}, -2, 2, 50, 0.0);
}
+ @Test
public void testReference12(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.pow(t, t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class SinGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.sin(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinhGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinhGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinhGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SinhGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class SinhGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.sinh(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SqrtGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SqrtGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SqrtGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/SqrtGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -23,9 +23,12 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.core.UnivariateDifferentiable;
+import org.junit.Assert;
+import org.junit.Test;
public class SqrtGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.sqrt(t); }
@@ -33,6 +36,7 @@
}, 0.001, 10, 50, 0.0);
}
+ @Test
public void testSingularity() throws DifferentiationException {
UnivariateDerivative derivative =
new AutomaticDifferentiator().differentiate(new UnivariateDifferentiable() {
@@ -40,12 +44,12 @@
});
double dPlus = derivative.f(new DifferentialPair(0, 1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dPlus));
- assertTrue(dPlus > 0);
+ Assert.assertTrue(Double.isInfinite(dPlus));
+ Assert.assertTrue(dPlus > 0);
double dMinus = derivative.f(new DifferentialPair(0, -1)).getFirstDerivative();
- assertTrue(Double.isInfinite(dMinus));
- assertTrue(dMinus < 0);
+ Assert.assertTrue(Double.isInfinite(dMinus));
+ Assert.assertTrue(dMinus < 0);
}
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class TanGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.tan(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanhGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanhGeneratorTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanhGeneratorTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/automatic/functions/TanhGeneratorTest.java Sun Aug 9 09:58:34 2009
@@ -18,9 +18,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.automatic.AbstractMathTest;
+import org.junit.Test;
public class TanhGeneratorTest extends AbstractMathTest {
+ @Test
public void testReference(){
checkReference(new ReferenceFunction() {
public double f(double t) { return Math.tanh(t); }
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/core/DifferentialPairTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/core/DifferentialPairTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/core/DifferentialPairTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/core/DifferentialPairTest.java Sun Aug 9 09:58:34 2009
@@ -18,33 +18,40 @@
import org.apache.commons.nabla.AbstractStaticFunctionsTest;
import org.apache.commons.nabla.core.DifferentialPair;
+import org.junit.Assert;
+import org.junit.Test;
public class DifferentialPairTest extends AbstractStaticFunctionsTest {
+ @Test
public void testConstant() {
DifferentialPair p = DifferentialPair.newConstant(1.5);
- assertEquals(1.5, p.getValue(), 1.0e-15);
- assertEquals(0.0, p.getFirstDerivative(), 1.0e-15);
+ Assert.assertEquals(1.5, p.getValue(), 1.0e-15);
+ Assert.assertEquals(0.0, p.getFirstDerivative(), 1.0e-15);
}
+ @Test
public void testVariable() {
DifferentialPair p = DifferentialPair.newVariable(1.5);
- assertEquals(1.5, p.getValue(), 1.0e-15);
- assertEquals(1.0, p.getFirstDerivative(), 1.0e-15);
+ Assert.assertEquals(1.5, p.getValue(), 1.0e-15);
+ Assert.assertEquals(1.0, p.getFirstDerivative(), 1.0e-15);
}
+ @Test
public void testConstructor() {
DifferentialPair p = new DifferentialPair(1.5, -1.3);
- assertEquals(1.5, p.getValue(), 1.0e-15);
- assertEquals(-1.3, p.getFirstDerivative(), 1.0e-15);
+ Assert.assertEquals(1.5, p.getValue(), 1.0e-15);
+ Assert.assertEquals(-1.3, p.getFirstDerivative(), 1.0e-15);
}
+ @Test
public void testMonadicOperations() {
defaultMonadicTest("negate");
defaultMonadicTest("square");
defaultMonadicTest("cube");
}
+ @Test
public void testDiadicOperations() {
defaultDiadicTest("add");
defaultDiadicTest("subtract");
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/AbstractFiniteDifferencesTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/AbstractFiniteDifferencesTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/AbstractFiniteDifferencesTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/AbstractFiniteDifferencesTest.java Sun Aug 9 09:58:34 2009
@@ -16,6 +16,8 @@
*/
package org.apache.commons.nabla.differences;
+import org.junit.Assert;
+
import java.util.Random;
import org.apache.commons.nabla.Polynomial;
@@ -24,51 +26,56 @@
import org.apache.commons.nabla.core.DifferentiationException;
import org.apache.commons.nabla.core.UnivariateDerivative;
import org.apache.commons.nabla.differences.FiniteDifferencesDifferentiator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-import junit.framework.TestCase;
-public abstract class AbstractFiniteDifferencesTest extends TestCase {
+public abstract class AbstractFiniteDifferencesTest {
protected abstract FiniteDifferencesDifferentiator buildDifferentiator(double h);
protected abstract int getOrder();
/** Check the reference implementation for polynomials. */
+ @Test
public void testReference() {
Polynomial legendre5 = new Polynomial(new double[] { 63, 0, -70, 0, 15, 0 });
- assertEquals(17155.92466365559104, legendre5.f(Math.PI), 1.0e-9);
- assertEquals(28626.24675148200242, legendre5.fPrime(Math.PI), 1.0e-8);
+ Assert.assertEquals(17155.92466365559104, legendre5.f(Math.PI), 1.0e-9);
+ Assert.assertEquals(28626.24675148200242, legendre5.fPrime(Math.PI), 1.0e-8);
Polynomial legendre4 = new Polynomial(new double[] { 35, 0, -30, 0, 3 });
- assertEquals(3116.230054157404545, legendre4.f(Math.PI), 1.0e-10);
- assertEquals(4152.383176026587230, legendre4.fPrime(Math.PI), 1.0e-9);
+ Assert.assertEquals(3116.230054157404545, legendre4.f(Math.PI), 1.0e-10);
+ Assert.assertEquals(4152.383176026587230, legendre4.fPrime(Math.PI), 1.0e-9);
Polynomial chebyshev7 = new Polynomial(new double[] { 64, 0, -112, 0, 56, 0, -7, 0 });
- assertEquals(160738.9222272848309, chebyshev7.f(Math.PI), 1.0e-8);
- assertEquals(377804.3612820780352, chebyshev7.fPrime(Math.PI), 1.0e-7);
+ Assert.assertEquals(160738.9222272848309, chebyshev7.f(Math.PI), 1.0e-8);
+ Assert.assertEquals(377804.3612820780352, chebyshev7.fPrime(Math.PI), 1.0e-7);
Polynomial laguerre3 = new Polynomial(new double[] { -1, 9, -18, 6 });
- assertEquals(7.271495164888129102, laguerre3.f(Math.PI), 1.0e-13);
- assertEquals(8.939854561348202436, laguerre3.fPrime(Math.PI), 1.0e-12);
+ Assert.assertEquals(7.271495164888129102, laguerre3.f(Math.PI), 1.0e-13);
+ Assert.assertEquals(8.939854561348202436, laguerre3.fPrime(Math.PI), 1.0e-12);
}
/** The differentiation schemes of order p should compute exact differentials
* for polynomials up to degree p.
*/
+ @Test
public void testExactPolynomialDifferentiation() throws DifferentiationException {
for (int k = 0; k <= getOrder(); ++k) {
ReferenceFunction reference = Polynomial.randomPolynomial(random, k);
UnivariateDerivative derivative = buildDifferentiator(0.1).differentiate(reference);
for (DifferentialPair t : transcendentals) {
double error = derivative.f(t).getFirstDerivative() - reference.fPrime(t.getValue());
- assertEquals(0, error, 1.0e-13 * Math.abs(reference.fPrime(t.getValue())));
+ Assert.assertEquals(0, error, 1.0e-13 * Math.abs(reference.fPrime(t.getValue())));
}
}
}
/** The derivative instances are bound to their primitive
* and should follow their updates transparently. */
+ @Test
public void testPrimitiveBinding() throws DifferentiationException {
// compute the differential once only
@@ -84,7 +91,7 @@
for (int i = 0; i < transcendentals.length; ++i) {
DifferentialPair t = transcendentals[i];
beforeChange[i] = derivative.f(t);
- assertEquals(0, beforeChange[i].getFirstDerivative() - reference.fPrime(t.getValue()), 100 * Math.abs(errorScaleFactor));
+ Assert.assertEquals(0, beforeChange[i].getFirstDerivative() - reference.fPrime(t.getValue()), 100 * Math.abs(errorScaleFactor));
}
// change the primitive WITHOUT recomputing the differential
@@ -96,15 +103,15 @@
for (int i = 0; i < transcendentals.length; ++i) {
DifferentialPair t = transcendentals[i];
afterChange[i] = derivative.f(t);
- assertEquals(0, afterChange[i].getFirstDerivative() - reference.fPrime(t.getValue()), 100 * Math.abs(errorScaleFactor));
+ Assert.assertEquals(0, afterChange[i].getFirstDerivative() - reference.fPrime(t.getValue()), 100 * Math.abs(errorScaleFactor));
}
// check the change was important
for (int i = 0; i < transcendentals.length; ++i) {
DifferentialPair change =
DifferentialPair.subtract(beforeChange[i], afterChange[i]);
- assertTrue(Math.abs(change.getValue()) > 10000.0 * Math.abs(errorScaleFactor));
- assertTrue(Math.abs(change.getFirstDerivative()) > 10000.0 * Math.abs(errorScaleFactor));
+ Assert.assertTrue(Math.abs(change.getValue()) > 10000.0 * Math.abs(errorScaleFactor));
+ Assert.assertTrue(Math.abs(change.getFirstDerivative()) > 10000.0 * Math.abs(errorScaleFactor));
}
}
@@ -125,12 +132,12 @@
int n1 = n - 1;
for (int i = 0; i < n; ++i) {
double t = ((n1 - i) * lower + i * upper) / n1;
- assertEquals(reference.fPrime(t),
- derivative.f(DifferentialPair.newVariable(t)).getFirstDerivative(),
- epsilon);
+ Assert.assertEquals(reference.fPrime(t),
+ derivative.f(DifferentialPair.newVariable(t)).getFirstDerivative(),
+ epsilon);
}
} catch (DifferentiationException de) {
- fail(de.getMessage());
+ Assert.fail(de.getMessage());
}
}
@@ -155,10 +162,10 @@
double rawError =
derivative.f(DifferentialPair.newVariable(t)).getFirstDerivative() - reference.fPrime(t);
double orderNormalizedError = Math.abs(rawError / fds.getSignedErrorScaleFactor());
- assertEquals(error, orderNormalizedError, epsilon);
+ Assert.assertEquals(error, orderNormalizedError, epsilon);
}
} catch (DifferentiationException de) {
- fail(de.getMessage());
+ Assert.fail(de.getMessage());
}
}
@@ -176,6 +183,7 @@
};
}
+ @Before
public void setUp() {
random = new Random(0x6c05e9f92868d664l);
transcendentals = new DifferentialPair[] {
@@ -186,6 +194,7 @@
}
+ @After
public void tearDown() {
random = null;
transcendentals = null;
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/EightPointsSchemeTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/EightPointsSchemeTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/EightPointsSchemeTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/EightPointsSchemeTest.java Sun Aug 9 09:58:34 2009
@@ -20,9 +20,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.differences.EightPointsScheme;
import org.apache.commons.nabla.differences.FiniteDifferencesDifferentiator;
+import org.junit.Test;
public class EightPointsSchemeTest extends AbstractFiniteDifferencesTest {
+ @Test
public void testApproximatePolynomialDifferentiation() {
ReferenceFunction reference = Polynomial.randomPolynomial(random, 9);
@@ -35,6 +37,7 @@
}
+ @Test
public void testHugeDifferentialsFunction() {
ReferenceFunction reference = hugeDifferentialsFunction();
checkValues(reference, 0.05, 0.3, 0.7, 100, 0.005);
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/FourPointsSchemeTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/FourPointsSchemeTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/FourPointsSchemeTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/FourPointsSchemeTest.java Sun Aug 9 09:58:34 2009
@@ -20,9 +20,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.differences.FiniteDifferencesDifferentiator;
import org.apache.commons.nabla.differences.FourPointsScheme;
+import org.junit.Test;
public class FourPointsSchemeTest extends AbstractFiniteDifferencesTest {
+ @Test
public void testApproximatePolynomialDifferentiation() {
ReferenceFunction reference = Polynomial.randomPolynomial(random, 5);
@@ -35,6 +37,7 @@
}
+ @Test
public void testHugeDifferentialsFunction() {
ReferenceFunction reference = hugeDifferentialsFunction();
checkValues(reference, 0.05, 0.3, 0.7, 100, 0.005);
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/SixPointsSchemeTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/SixPointsSchemeTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/SixPointsSchemeTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/SixPointsSchemeTest.java Sun Aug 9 09:58:34 2009
@@ -20,9 +20,11 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.differences.FiniteDifferencesDifferentiator;
import org.apache.commons.nabla.differences.SixPointsScheme;
+import org.junit.Test;
public class SixPointsSchemeTest extends AbstractFiniteDifferencesTest {
+ @Test
public void testApproximatePolynomialDifferentiation() {
ReferenceFunction reference = Polynomial.randomPolynomial(random, 7);
@@ -35,6 +37,7 @@
}
+ @Test
public void testHugeDifferentialsFunction() {
ReferenceFunction reference = hugeDifferentialsFunction();
checkValues(reference, 0.05, 0.3, 0.7, 100, 0.005);
Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/TwoPointsSchemeTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/TwoPointsSchemeTest.java?rev=802503&r1=802502&r2=802503&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/TwoPointsSchemeTest.java (original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/differences/TwoPointsSchemeTest.java Sun Aug 9 09:58:34 2009
@@ -20,10 +20,12 @@
import org.apache.commons.nabla.ReferenceFunction;
import org.apache.commons.nabla.differences.FiniteDifferencesDifferentiator;
import org.apache.commons.nabla.differences.TwoPointsScheme;
+import org.junit.Test;
public class TwoPointsSchemeTest extends AbstractFiniteDifferencesTest {
+ @Test
public void testApproximatePolynomialDifferentiation() {
ReferenceFunction reference = Polynomial.randomPolynomial(random, 3);
@@ -36,6 +38,7 @@
}
+ @Test
public void testHugeDifferentialsFunction() {
ReferenceFunction reference = hugeDifferentialsFunction();
checkValues(reference, 0.05, 0.3, 0.7, 100, 0.09);
|