Fix Step function and add test for known optimum.
This commit is contained in:
24
test/eva2/problems/F3ProblemTest.java
Normal file
24
test/eva2/problems/F3ProblemTest.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package eva2.problems;
|
||||
|
||||
import eva2.tools.math.Mathematics;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class F3ProblemTest extends TestCase {
|
||||
|
||||
/**
|
||||
* The Step function has its minimum
|
||||
* at x_{i} = 0
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testEvaluate() throws Exception {
|
||||
F3Problem problem = new F3Problem();
|
||||
|
||||
for (int i = 1; i < 100; i++) {
|
||||
double[] x = Mathematics.zeroes(i);
|
||||
double[] res = problem.evaluate(x);
|
||||
assertEquals(1, res.length);
|
||||
assertEquals(0.0, res[0]);
|
||||
}
|
||||
}
|
||||
}
|
@@ -68,7 +68,6 @@ public class SerializerTest {
|
||||
*/
|
||||
@Test
|
||||
public void testStoreObject() {
|
||||
System.out.println("storeObject");
|
||||
OutputStream outStream = null;
|
||||
Serializable s = null;
|
||||
Serializer.storeObject(outStream, s);
|
||||
@@ -81,7 +80,6 @@ public class SerializerTest {
|
||||
*/
|
||||
@Test
|
||||
public void testLoadObject_InputStream() {
|
||||
System.out.println("loadObject");
|
||||
InputStream inputStream = null;
|
||||
Object expResult = null;
|
||||
Object result = Serializer.loadObject(inputStream);
|
||||
|
Reference in New Issue
Block a user