improved test coverage
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@592695 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
48d35f0b78
commit
a2e16279da
|
@ -417,8 +417,11 @@ public class GaussNewtonEstimatorTest
|
|||
GaussNewtonEstimator estimator = new GaussNewtonEstimator(100, 1.0e-6, 1.0e-6);
|
||||
estimator.estimate(problem);
|
||||
assertEquals(0, estimator.getRMS(problem), 1.0e-10);
|
||||
assertEquals(2.0, p[0].getEstimate(), 1.0e-10);
|
||||
assertEquals(1.0, p[1].getEstimate(), 1.0e-10);
|
||||
EstimatedParameter[] all = problem.getAllParameters();
|
||||
for (int i = 0; i < all.length; ++i) {
|
||||
assertEquals(all[i].getName().equals("p0") ? 2.0 : 1.0,
|
||||
all[i].getEstimate(), 1.0e-10);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -453,8 +453,11 @@ public class LevenbergMarquardtEstimatorTest
|
|||
circle.addPoint(110.0, -20.0);
|
||||
circle.addPoint( 35.0, 15.0);
|
||||
circle.addPoint( 45.0, 97.0);
|
||||
checkEstimate(circle, 100.0, 1000, 1.0e-10, 1.0e-10, 1.0e-10, false);
|
||||
checkEstimate(circle, 1.0e-12, 10, 1.0e-20, 1.0e-20, 1.0e-20, true);
|
||||
checkEstimate(circle, 0.1, 10, 1.0e-14, 1.0e-16, 1.0e-10, false);
|
||||
checkEstimate(circle, 0.1, 10, 1.0e-15, 1.0e-17, 1.0e-10, true);
|
||||
checkEstimate(circle, 0.1, 5, 1.0e-15, 1.0e-16, 1.0e-10, true);
|
||||
circle.addPoint(300, -300);
|
||||
checkEstimate(circle, 0.1, 20, 1.0e-18, 1.0e-16, 1.0e-10, true);
|
||||
}
|
||||
|
||||
private void checkEstimate(EstimationProblem problem,
|
||||
|
@ -471,7 +474,6 @@ public class LevenbergMarquardtEstimatorTest
|
|||
estimator.estimate(problem);
|
||||
assertTrue(! shouldFail);
|
||||
} catch (EstimationException ee) {
|
||||
System.out.println(ee.getClass().getName() + " " + ee.getMessage());
|
||||
assertTrue(shouldFail);
|
||||
} catch (Exception e) {
|
||||
fail("wrong exception type caught");
|
||||
|
|
Loading…
Reference in New Issue