aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/tests/NodeTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/backend/tests/NodeTests.java')
-rw-r--r--src/jcgp/backend/tests/NodeTests.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/jcgp/backend/tests/NodeTests.java b/src/jcgp/backend/tests/NodeTests.java
index c63b41e..ee940a0 100644
--- a/src/jcgp/backend/tests/NodeTests.java
+++ b/src/jcgp/backend/tests/NodeTests.java
@@ -1,8 +1,6 @@
package jcgp.backend.tests;
import static org.junit.Assert.assertTrue;
-import jcgp.backend.exceptions.InvalidArgumentsException;
-import jcgp.backend.function.SymbolicRegressionFunctions;
import jcgp.backend.function.Function;
import jcgp.backend.population.Chromosome;
import jcgp.backend.population.Connection;
@@ -41,15 +39,15 @@ public class NodeTests {
public static void setUpBeforeClass() {
resources = new ModifiableResources();
- resources.setFunctionSet(new SymbolicRegressionFunctions());
+ resources.setFunctionSet(new TestFunctionSet());
chromosome = new Chromosome(resources);
}
@Before
public void setUp() throws Exception {
node = new Node(chromosome, 0, 0, resources.arity());
- // make node with anonymous addition function and hard-coded value connections
- node.initialise(new SymbolicRegressionFunctions.Addition(),
+ // make node with addition function and hard-coded value connections
+ node.initialise(resources.getFunction(0),
new Connection[]{new Connection() {
@Override
@@ -107,7 +105,7 @@ public class NodeTests {
((int) node.getValue()) == arg1 + arg2);
// put in a different function, check the output has changed appropriately
- node.setFunction(new SymbolicRegressionFunctions.Subtraction());
+ node.setFunction(resources.getFunction(1));
assertTrue("Node did not return expected value (difference of arguments).", ((Integer) node.getValue()) == arg1 - arg2);
@@ -136,8 +134,7 @@ public class NodeTests {
Function function = new Function() {
@Override
- public Object run(Object... connections)
- throws InvalidArgumentsException {
+ public Object run(Object... connections) {
// blank
return null;
}