You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2012/09/02 16:21:02 UTC
svn commit: r1379975 [3/3] - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math3/ode/
main/java/org/apache/commons/math3/ode/events/
main/java/org/apache/commons/math3/ode/nonstiff/
main/java/org/apache/commons/math3/ode/sampling/ tes...
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerIntegratorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerIntegratorTest.java Sun Sep 2 14:21:00 2012
@@ -18,6 +18,8 @@
package org.apache.commons.math3.ode.nonstiff;
import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
@@ -38,7 +40,9 @@ import org.junit.Test;
public class GraggBulirschStoerIntegratorTest {
@Test(expected=DimensionMismatchException.class)
- public void testDimensionCheck() {
+ public void testDimensionCheck()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
AdaptiveStepsizeIntegrator integrator =
new GraggBulirschStoerIntegrator(0.0, 1.0, 1.0e-10, 1.0e-10);
@@ -48,7 +52,9 @@ public class GraggBulirschStoerIntegrato
}
@Test(expected=NumberIsTooSmallException.class)
- public void testNullIntervalCheck() {
+ public void testNullIntervalCheck()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
GraggBulirschStoerIntegrator integrator =
new GraggBulirschStoerIntegrator(0.0, 1.0, 1.0e-10, 1.0e-10);
@@ -58,7 +64,9 @@ public class GraggBulirschStoerIntegrato
}
@Test(expected=NumberIsTooSmallException.class)
- public void testMinStep() {
+ public void testMinStep()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem5 pb = new TestProblem5();
double minStep = 0.1 * FastMath.abs(pb.getFinalTime() - pb.getInitialTime());
@@ -79,7 +87,8 @@ public class GraggBulirschStoerIntegrato
@Test
public void testBackward()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem5 pb = new TestProblem5();
double minStep = 0;
@@ -103,7 +112,8 @@ public class GraggBulirschStoerIntegrato
@Test
public void testIncreasingTolerance()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
int previousCalls = Integer.MAX_VALUE;
for (int i = -12; i < -4; ++i) {
@@ -141,7 +151,8 @@ public class GraggBulirschStoerIntegrato
@Test
public void testIntegratorControls()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.999);
GraggBulirschStoerIntegrator integ =
@@ -170,7 +181,8 @@ public class GraggBulirschStoerIntegrato
}
private double getMaxError(FirstOrderIntegrator integrator, TestProblemAbstract pb)
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblemHandler handler = new TestProblemHandler(pb, integrator);
integrator.addStepHandler(handler);
integrator.integrate(pb,
@@ -181,7 +193,8 @@ public class GraggBulirschStoerIntegrato
@Test
public void testEvents()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem4 pb = new TestProblem4();
double minStep = 0;
@@ -214,7 +227,8 @@ public class GraggBulirschStoerIntegrato
@Test
public void testKepler()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
@@ -237,7 +251,8 @@ public class GraggBulirschStoerIntegrato
@Test
public void testVariableSteps()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
@@ -256,7 +271,9 @@ public class GraggBulirschStoerIntegrato
}
@Test
- public void testTooLargeFirstStep() {
+ public void testTooLargeFirstStep()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
AdaptiveStepsizeIntegrator integ =
new GraggBulirschStoerIntegrator(0, Double.POSITIVE_INFINITY, Double.NaN, Double.NaN);
@@ -282,7 +299,9 @@ public class GraggBulirschStoerIntegrato
}
@Test
- public void testUnstableDerivative() {
+ public void testUnstableDerivative()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final StepProblem stepProblem = new StepProblem(0.0, 1.0, 2.0);
FirstOrderIntegrator integ =
new GraggBulirschStoerIntegrator(0.1, 10, 1.0e-12, 0.0);
@@ -293,14 +312,17 @@ public class GraggBulirschStoerIntegrato
}
@Test
- public void testIssue596() {
+ public void testIssue596()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
FirstOrderIntegrator integ = new GraggBulirschStoerIntegrator(1e-10, 100.0, 1e-7, 1e-7);
integ.addStepHandler(new StepHandler() {
public void init(double t0, double[] y0, double t) {
}
- public void handleStep(StepInterpolator interpolator, boolean isLast) {
+ public void handleStep(StepInterpolator interpolator, boolean isLast)
+ throws MaxCountExceededException {
double t = interpolator.getCurrentTime();
interpolator.setInterpolatedTime(t);
double[] y = interpolator.getInterpolatedState();
@@ -332,7 +354,8 @@ public class GraggBulirschStoerIntegrato
nbSteps = 0;
maxError = 0;
}
- public void handleStep(StepInterpolator interpolator, boolean isLast) {
+ public void handleStep(StepInterpolator interpolator, boolean isLast)
+ throws MaxCountExceededException {
++nbSteps;
for (int a = 1; a < 100; ++a) {
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java Sun Sep 2 14:21:00 2012
@@ -25,6 +25,10 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.ContinuousOutputModel;
import org.apache.commons.math3.ode.TestProblem3;
import org.apache.commons.math3.ode.sampling.StepHandler;
@@ -38,7 +42,8 @@ public class GraggBulirschStoerStepInter
@Test
public void derivativesConsistency()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -53,7 +58,9 @@ public class GraggBulirschStoerStepInter
@Test
public void serialization()
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException,
+ DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
@@ -104,7 +111,8 @@ public class GraggBulirschStoerStepInter
@Test
public void checklone()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -114,7 +122,8 @@ public class GraggBulirschStoerStepInter
scalAbsoluteTolerance,
scalRelativeTolerance);
integ.addStepHandler(new StepHandler() {
- public void handleStep(StepInterpolator interpolator, boolean isLast) {
+ public void handleStep(StepInterpolator interpolator, boolean isLast)
+ throws MaxCountExceededException {
StepInterpolator cloned = interpolator.copy();
double tA = cloned.getPreviousTime();
double tB = cloned.getCurrentTime();
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54IntegratorTest.java Sun Sep 2 14:21:00 2012
@@ -19,10 +19,10 @@ package org.apache.commons.math3.ode.non
import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalNumberException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
import org.apache.commons.math3.ode.TestProblem1;
@@ -38,14 +38,16 @@ import org.junit.Test;
public class HighamHall54IntegratorTest {
@Test
- public void testWrongDerivative() {
+ public void testWrongDerivative()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
HighamHall54Integrator integrator =
new HighamHall54Integrator(0.0, 1.0, 1.0e-10, 1.0e-10);
FirstOrderDifferentialEquations equations =
new FirstOrderDifferentialEquations() {
public void computeDerivatives(double t, double[] y, double[] dot) {
if (t < -0.5) {
- throw new LocalException(t);
+ throw new LocalException();
} else {
throw new RuntimeException("oops");
}
@@ -72,7 +74,9 @@ public class HighamHall54IntegratorTest
}
@Test(expected=NumberIsTooSmallException.class)
- public void testMinStep() {
+ public void testMinStep()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
double minStep = 0.1 * (pb.getFinalTime() - pb.getInitialTime());
@@ -94,7 +98,8 @@ public class HighamHall54IntegratorTest
@Test
public void testIncreasingTolerance()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
int previousCalls = Integer.MAX_VALUE;
for (int i = -12; i < -2; ++i) {
@@ -130,7 +135,8 @@ public class HighamHall54IntegratorTest
@Test
public void testBackward()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem5 pb = new TestProblem5();
double minStep = 0;
@@ -154,7 +160,8 @@ public class HighamHall54IntegratorTest
@Test
public void testEvents()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem4 pb = new TestProblem4();
double minStep = 0;
@@ -187,7 +194,9 @@ public class HighamHall54IntegratorTest
}
@Test(expected=LocalException.class)
- public void testEventsErrors() {
+ public void testEventsErrors()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final TestProblem1 pb = new TestProblem1();
double minStep = 0;
@@ -211,7 +220,7 @@ public class HighamHall54IntegratorTest
double middle = (pb.getInitialTime() + pb.getFinalTime()) / 2;
double offset = t - middle;
if (offset > 0) {
- throw new LocalException(t);
+ throw new LocalException();
}
return offset;
}
@@ -225,15 +234,14 @@ public class HighamHall54IntegratorTest
}
- private static class LocalException extends MathIllegalNumberException {
+ private static class LocalException extends RuntimeException {
private static final long serialVersionUID = 3041292643919807960L;
- protected LocalException(Number wrong) {
- super(LocalizedFormats.SIMPLE_MESSAGE, wrong);
- }
}
@Test
- public void testEventsNoConvergence() {
+ public void testEventsNoConvergence()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final TestProblem1 pb = new TestProblem1();
double minStep = 0;
@@ -274,7 +282,9 @@ public class HighamHall54IntegratorTest
}
@Test
- public void testSanityChecks() {
+ public void testSanityChecks()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -333,7 +343,8 @@ public class HighamHall54IntegratorTest
@Test
public void testKepler()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54StepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54StepInterpolatorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54StepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/HighamHall54StepInterpolatorTest.java Sun Sep 2 14:21:00 2012
@@ -25,6 +25,10 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.ContinuousOutputModel;
import org.apache.commons.math3.ode.TestProblem3;
import org.apache.commons.math3.ode.sampling.StepHandler;
@@ -38,7 +42,8 @@ public class HighamHall54StepInterpolato
@Test
public void derivativesConsistency()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.1);
double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -52,7 +57,9 @@ public class HighamHall54StepInterpolato
@Test
public void serialization()
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException,
+ DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
@@ -102,7 +109,8 @@ public class HighamHall54StepInterpolato
@Test
public void checkClone()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.9);
double minStep = 0;
double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -112,7 +120,8 @@ public class HighamHall54StepInterpolato
scalAbsoluteTolerance,
scalRelativeTolerance);
integ.addStepHandler(new StepHandler() {
- public void handleStep(StepInterpolator interpolator, boolean isLast) {
+ public void handleStep(StepInterpolator interpolator, boolean isLast)
+ throws MaxCountExceededException {
StepInterpolator cloned = interpolator.copy();
double tA = cloned.getPreviousTime();
double tB = cloned.getCurrentTime();
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointIntegratorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointIntegratorTest.java Sun Sep 2 14:21:00 2012
@@ -19,6 +19,9 @@ package org.apache.commons.math3.ode.non
import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
import org.apache.commons.math3.ode.TestProblem1;
@@ -36,7 +39,9 @@ import org.junit.Test;
public class MidpointIntegratorTest {
@Test(expected=DimensionMismatchException.class)
- public void testDimensionCheck() {
+ public void testDimensionCheck()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
new MidpointIntegrator(0.01).integrate(pb,
0.0, new double[pb.getDimension()+10],
@@ -46,7 +51,8 @@ public class MidpointIntegratorTest {
@Test
public void testDecreasingSteps()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblemAbstract[] problems = TestProblemFactory.getProblems();
for (int k = 0; k < problems.length; ++k) {
@@ -92,7 +98,8 @@ public class MidpointIntegratorTest {
@Test
public void testSmallStep()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -113,7 +120,8 @@ public class MidpointIntegratorTest {
@Test
public void testBigStep()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.2;
@@ -133,7 +141,8 @@ public class MidpointIntegratorTest {
@Test
public void testBackward()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem5 pb = new TestProblem5();
double step = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -152,7 +161,8 @@ public class MidpointIntegratorTest {
@Test
public void testStepSize()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final double step = 1.23456;
FirstOrderIntegrator integ = new MidpointIntegrator(step);
integ.addStepHandler(new StepHandler() {
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointStepInterpolatorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/MidpointStepInterpolatorTest.java Sun Sep 2 14:21:00 2012
@@ -25,6 +25,10 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.ContinuousOutputModel;
import org.apache.commons.math3.ode.TestProblem1;
import org.apache.commons.math3.ode.TestProblem3;
@@ -37,7 +41,8 @@ public class MidpointStepInterpolatorTes
@Test
public void testDerivativesConsistency()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3();
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
MidpointIntegrator integ = new MidpointIntegrator(step);
@@ -46,7 +51,9 @@ public class MidpointStepInterpolatorTes
@Test
public void serialization()
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException,
+ DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesIntegratorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesIntegratorTest.java Sun Sep 2 14:21:00 2012
@@ -19,6 +19,9 @@ package org.apache.commons.math3.ode.non
import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
import org.apache.commons.math3.ode.TestProblem1;
@@ -37,7 +40,9 @@ import org.junit.Test;
public class ThreeEighthesIntegratorTest {
@Test(expected=DimensionMismatchException.class)
- public void testDimensionCheck() {
+ public void testDimensionCheck()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
new ThreeEighthesIntegrator(0.01).integrate(pb,
0.0, new double[pb.getDimension()+10],
@@ -47,7 +52,8 @@ public class ThreeEighthesIntegratorTest
@Test
public void testDecreasingSteps()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblemAbstract[] problems = TestProblemFactory.getProblems();
for (int k = 0; k < problems.length; ++k) {
@@ -93,7 +99,8 @@ public class ThreeEighthesIntegratorTest
@Test
public void testSmallStep()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -113,7 +120,8 @@ public class ThreeEighthesIntegratorTest
@Test
public void testBigStep()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.2;
@@ -132,7 +140,8 @@ public class ThreeEighthesIntegratorTest
@Test
public void testBackward()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem5 pb = new TestProblem5();
double step = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -151,7 +160,8 @@ public class ThreeEighthesIntegratorTest
@Test
public void testKepler()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final TestProblem3 pb = new TestProblem3(0.9);
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003;
@@ -174,7 +184,8 @@ public class ThreeEighthesIntegratorTest
maxError = 0;
}
- public void handleStep(StepInterpolator interpolator, boolean isLast) {
+ public void handleStep(StepInterpolator interpolator, boolean isLast)
+ throws MaxCountExceededException {
double[] interpolatedY = interpolator.getInterpolatedState();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
@@ -199,7 +210,8 @@ public class ThreeEighthesIntegratorTest
@Test
public void testStepSize()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final double step = 1.23456;
FirstOrderIntegrator integ = new ThreeEighthesIntegrator(step);
integ.addStepHandler(new StepHandler() {
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java Sun Sep 2 14:21:00 2012
@@ -25,6 +25,10 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.ContinuousOutputModel;
import org.apache.commons.math3.ode.TestProblem3;
import org.apache.commons.math3.ode.sampling.StepHandler;
@@ -36,7 +40,8 @@ public class ThreeEighthesStepInterpolat
@Test
public void derivativesConsistency()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3();
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
ThreeEighthesIntegrator integ = new ThreeEighthesIntegrator(step);
@@ -45,7 +50,9 @@ public class ThreeEighthesStepInterpolat
@Test
public void serialization()
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException,
+ DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3(0.9);
double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003;
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java Sun Sep 2 14:21:00 2012
@@ -24,8 +24,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math3.exception.MaxCountExceededException;
import org.apache.commons.math3.util.FastMath;
import org.junit.Assert;
import org.junit.Test;
@@ -33,7 +32,7 @@ import org.junit.Test;
public class DummyStepInterpolatorTest {
@Test
- public void testNoReset() {
+ public void testNoReset() throws MaxCountExceededException {
double[] y = { 0.0, 1.0, -2.0 };
DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true);
@@ -49,7 +48,7 @@ public class DummyStepInterpolatorTest {
}
@Test
- public void testFixedState() {
+ public void testFixedState() throws MaxCountExceededException {
double[] y = { 1.0, 3.0, -4.0 };
DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true);
@@ -73,7 +72,7 @@ public class DummyStepInterpolatorTest {
@Test
public void testSerialization()
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException, MaxCountExceededException {
double[] y = { 0.0, 1.0, -2.0 };
DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true);
@@ -115,9 +114,8 @@ public class DummyStepInterpolatorTest {
try {
oos.writeObject(interpolator);
Assert.fail("an exception should have been thrown");
- } catch (MathIllegalStateException mise) {
+ } catch (LocalException le) {
// expected behavior
- Assert.assertEquals(0, mise.getMessage().length());
}
}
@@ -130,7 +128,12 @@ public class DummyStepInterpolatorTest {
}
@Override
protected void doFinalize() {
- throw new MathIllegalStateException(LocalizedFormats.SIMPLE_MESSAGE, "");
+ throw new LocalException();
}
}
+
+ private static class LocalException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+ }
+
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/NordsieckStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/NordsieckStepInterpolatorTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/NordsieckStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/NordsieckStepInterpolatorTest.java Sun Sep 2 14:21:00 2012
@@ -25,6 +25,10 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.ContinuousOutputModel;
import org.apache.commons.math3.ode.TestProblem1;
import org.apache.commons.math3.ode.TestProblem3;
@@ -35,7 +39,9 @@ import org.junit.Test;
public class NordsieckStepInterpolatorTest {
@Test
- public void derivativesConsistency() {
+ public void derivativesConsistency()
+ throws NumberIsTooSmallException, DimensionMismatchException,
+ MaxCountExceededException, NoBracketingException {
TestProblem3 pb = new TestProblem3();
AdamsBashforthIntegrator integ = new AdamsBashforthIntegrator(4, 0.0, 1.0, 1.0e-10, 1.0e-10);
StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 5e-9);
@@ -43,7 +49,9 @@ public class NordsieckStepInterpolatorTe
@Test
public void serialization()
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException,
+ NumberIsTooSmallException, DimensionMismatchException,
+ MaxCountExceededException, NoBracketingException {
TestProblem1 pb = new TestProblem1();
AdamsBashforthIntegrator integ = new AdamsBashforthIntegrator(4, 0.0, 1.0, 1.0e-10, 1.0e-10);
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java Sun Sep 2 14:21:00 2012
@@ -17,6 +17,10 @@
package org.apache.commons.math3.ode.sampling;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
import org.apache.commons.math3.ode.TestProblemAbstract;
import org.apache.commons.math3.util.FastMath;
@@ -26,10 +30,13 @@ public class StepInterpolatorTestUtils {
public static void checkDerivativesConsistency(final FirstOrderIntegrator integrator,
final TestProblemAbstract problem,
- final double threshold) {
+ final double threshold)
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
integrator.addStepHandler(new StepHandler() {
- public void handleStep(StepInterpolator interpolator, boolean isLast) {
+ public void handleStep(StepInterpolator interpolator, boolean isLast)
+ throws MaxCountExceededException {
final double h = 0.001 * (interpolator.getCurrentTime() - interpolator.getPreviousTime());
final double t = interpolator.getCurrentTime() - 300 * h;
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerOutputTestBase.java Sun Sep 2 14:21:00 2012
@@ -22,6 +22,10 @@ import static org.junit.Assert.assertArr
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
import org.apache.commons.math3.ode.nonstiff.GraggBulirschStoerIntegrator;
@@ -96,97 +100,129 @@ public abstract class StepNormalizerOutp
}
@Test
- public void testIncNeither() {
+ public void testIncNeither()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpInc(), getO()[0][0], getO()[0][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.NEITHER, exp, false);
}
@Test
- public void testIncNeitherRev() {
+ public void testIncNeitherRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpIncRev(), getO()[1][0], getO()[1][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.NEITHER, exp, true);
}
@Test
- public void testIncFirst() {
+ public void testIncFirst()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpInc(), getO()[2][0], getO()[2][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.FIRST, exp, false);
}
@Test
- public void testIncFirstRev() {
+ public void testIncFirstRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpIncRev(), getO()[3][0], getO()[3][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.FIRST, exp, true);
}
@Test
- public void testIncLast() {
+ public void testIncLast()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpInc(), getO()[4][0], getO()[4][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.LAST, exp, false);
}
@Test
- public void testIncLastRev() {
+ public void testIncLastRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpIncRev(), getO()[5][0], getO()[5][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.LAST, exp, true);
}
@Test
- public void testIncBoth() {
+ public void testIncBoth()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpInc(), getO()[6][0], getO()[6][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.BOTH, exp, false);
}
@Test
- public void testIncBothRev() {
+ public void testIncBothRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpIncRev(), getO()[7][0], getO()[7][1]);
doTest(StepNormalizerMode.INCREMENT, StepNormalizerBounds.BOTH, exp, true);
}
@Test
- public void testMulNeither() {
+ public void testMulNeither()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMul(), getO()[8][0], getO()[8][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.NEITHER, exp, false);
}
@Test
- public void testMulNeitherRev() {
+ public void testMulNeitherRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMulRev(), getO()[9][0], getO()[9][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.NEITHER, exp, true);
}
@Test
- public void testMulFirst() {
+ public void testMulFirst()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMul(), getO()[10][0], getO()[10][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.FIRST, exp, false);
}
@Test
- public void testMulFirstRev() {
+ public void testMulFirstRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMulRev(), getO()[11][0], getO()[11][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.FIRST, exp, true);
}
@Test
- public void testMulLast() {
+ public void testMulLast()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMul(), getO()[12][0], getO()[12][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.LAST, exp, false);
}
@Test
- public void testMulLastRev() {
+ public void testMulLastRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMulRev(), getO()[13][0], getO()[13][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.LAST, exp, true);
}
@Test
- public void testMulBoth() {
+ public void testMulBoth()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMul(), getO()[14][0], getO()[14][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.BOTH, exp, false);
}
@Test
- public void testMulBothRev() {
+ public void testMulBothRev()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double[] exp = getArray(getExpMulRev(), getO()[15][0], getO()[15][1]);
doTest(StepNormalizerMode.MULTIPLES, StepNormalizerBounds.BOTH, exp, true);
}
@@ -199,9 +235,15 @@ public abstract class StepNormalizerOutp
* @param bounds the step normalizer bounds setting to use
* @param expected the expected output (normalized time points)
* @param reverse whether to reverse the integration direction
+ * @throws NoBracketingException
+ * @throws MaxCountExceededException
+ * @throws NumberIsTooSmallException
+ * @throws DimensionMismatchException
*/
private void doTest(StepNormalizerMode mode, StepNormalizerBounds bounds,
- double[] expected, boolean reverse) {
+ double[] expected, boolean reverse)
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
// Forward test.
FirstOrderIntegrator integ = new GraggBulirschStoerIntegrator(
1e-8, 1.0, 1e-5, 1e-5);
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerTest.java?rev=1379975&r1=1379974&r2=1379975&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/ode/sampling/StepNormalizerTest.java Sun Sep 2 14:21:00 2012
@@ -17,6 +17,10 @@
package org.apache.commons.math3.ode.sampling;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
import org.apache.commons.math3.ode.TestProblem3;
import org.apache.commons.math3.ode.nonstiff.DormandPrince54Integrator;
@@ -36,7 +40,8 @@ public class StepNormalizerTest {
@Test
public void testBoundaries()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
double range = pb.getFinalTime() - pb.getInitialTime();
setLastSeen(false);
integ.addStepHandler(new StepNormalizer(range / 10.0,
@@ -66,7 +71,8 @@ public class StepNormalizerTest {
@Test
public void testBeforeEnd()
- {
+ throws DimensionMismatchException, NumberIsTooSmallException,
+ MaxCountExceededException, NoBracketingException {
final double range = pb.getFinalTime() - pb.getInitialTime();
setLastSeen(false);
integ.addStepHandler(new StepNormalizer(range / 10.5,