commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r574169 - /commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java
Date Mon, 10 Sep 2007 08:23:21 GMT
Author: luc
Date: Mon Sep 10 01:23:21 2007
New Revision: 574169

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

Modified:
    commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java?rev=574169&r1=574168&r2=574169&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java
Mon Sep 10 01:23:21 2007
@@ -106,18 +106,27 @@
         nm.minimizes(rosenbrock, 100, new ValueChecker(1.0e-3),
                      new double[][] {
                        { -1.2, 1.0 }, { 0.9, 1.2 }, { 3.5, -2.3 }
-                     }, 3, 1642738l);
+                     }, 10, 1642738l);
 
-    assertTrue(count < 200);
+    assertTrue(count > 700);
+    assertTrue(count < 800);
     assertEquals(0.0, optimum.cost, 5.0e-5);
     assertEquals(1.0, optimum.point[0], 0.01);
     assertEquals(1.0, optimum.point[1], 0.01);
 
     PointCostPair[] minima = nm.getMinima();
-    assertEquals(3, minima.length);
-    for (int i = 1; i < minima.length; ++i) {
-        if (minima[i] != null) {
-            assertTrue(minima[i-1].cost <= minima[i].cost);
+    assertEquals(10, minima.length);
+    assertNotNull(minima[0]);
+    assertNull(minima[minima.length - 1]);
+    for (int i = 0; i < minima.length; ++i) {
+        if (minima[i] == null) {
+            if ((i + 1) < minima.length) {
+                assertTrue(minima[i+1] == null);
+            }
+        } else {
+            if (i > 0) {
+                assertTrue(minima[i-1].cost <= minima[i].cost);
+            }
         }
     }
 



Mime
View raw message