aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/tests/PopulationTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/backend/tests/PopulationTests.java')
-rw-r--r--src/jcgp/backend/tests/PopulationTests.java29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/jcgp/backend/tests/PopulationTests.java b/src/jcgp/backend/tests/PopulationTests.java
index 31df8b9..fb8ced4 100644
--- a/src/jcgp/backend/tests/PopulationTests.java
+++ b/src/jcgp/backend/tests/PopulationTests.java
@@ -1,9 +1,10 @@
package jcgp.backend.tests;
import static org.junit.Assert.assertTrue;
+import jcgp.backend.function.IntegerArithmetic;
import jcgp.backend.population.Chromosome;
import jcgp.backend.population.Population;
-import jcgp.backend.resources.Resources;
+import jcgp.backend.resources.ModifiableResources;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -26,30 +27,12 @@ import org.junit.Test;
public class PopulationTests {
private Population population;
- private static Resources resources;
+ private static ModifiableResources resources;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- resources = new Resources();
-
-
-// // initialise function set
-// FunctionSet functionSet = new FunctionSet(new Arithmetic.Addition(), new Arithmetic.Subtraction());
-//
-// // initialise utilities
-// Utilities.setResources(new Random(1234), functionSet);
-//
-// // initialise parameters
-// Resources.setColumns(20);
-// Resources.setRows(20);
-// Resources.setInputs(2);
-// Resources.setOutputs(4);
-// Resources.setLevelsBack(1);
-// Resources.setMutationRate(10);
-// Resources.setTotalGenerations(100);
-// Resources.setTotalRuns(5);
-// Resources.setPopulationSize(1, 4);
-// Resources.setMaxArity(functionSet.getMaxArity());
+ resources = new ModifiableResources();
+ resources.setFunctionSet(new IntegerArithmetic());
}
@Before
@@ -70,7 +53,7 @@ public class PopulationTests {
chromosomes++;
}
- assertTrue("Incorrect number of chromosomes generated.", chromosomes == resources.getInt("popSize"));
+ assertTrue("Incorrect number of chromosomes generated.", chromosomes == resources.populationSize());
}
@Test