diff options
| author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-16 22:41:46 +0000 | 
|---|---|---|
| committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-16 22:41:46 +0000 | 
| commit | ef7a850a8f2f81ccaa07f25d9b7ad602e84d88c9 (patch) | |
| tree | 9f9c6206a140bdfad4bb1b44354e6c7314d8b605 /src/jcgp/tests/NodeTests.java | |
| parent | e9290a500b228e2561a8537adbc13e86f1356747 (diff) | |
Light refactoring, a good amount of testing done, added some new functions.
Diffstat (limited to 'src/jcgp/tests/NodeTests.java')
| -rw-r--r-- | src/jcgp/tests/NodeTests.java | 37 | 
1 files changed, 33 insertions, 4 deletions
| diff --git a/src/jcgp/tests/NodeTests.java b/src/jcgp/tests/NodeTests.java index 9ea6769..ee26d38 100644 --- a/src/jcgp/tests/NodeTests.java +++ b/src/jcgp/tests/NodeTests.java @@ -6,9 +6,8 @@ import java.util.Random;  import jcgp.Parameters;  import jcgp.Utilities; -import jcgp.function.Addition; +import jcgp.function.Arithmetic;  import jcgp.function.Function; -import jcgp.function.Subtraction;  import jcgp.population.Chromosome;  import jcgp.population.Connection;  import jcgp.population.Node; @@ -63,7 +62,7 @@ public class NodeTests {  	public void setUp() throws Exception {  		node = new Node(chromosome, 0, 0);  		// make node with anonymous addition function and hard-coded value connections -		node.initialise(new Addition(), +		node.initialise(new Arithmetic.Addition(),  				new Connection[]{new Connection() {  					@Override @@ -72,6 +71,12 @@ public class NodeTests {  						return arg1;  					} +					@Override +					public String getDescription() { +						// blank +						return null; +					} +  				},  				new Connection() { @@ -81,6 +86,12 @@ public class NodeTests {  						return arg2;  					} +					@Override +					public String getDescription() { +						// blank +						return null; +					} +  				}});  	} @@ -123,7 +134,7 @@ public class NodeTests {  				((int) node.getValue()) == arg1 + arg2);  		// put in a different function, check the output has changed appropriately -		node.setFunction(new Subtraction()); +		node.setFunction(new Arithmetic.Subtraction());  		assertTrue("Node did not return expected value (difference of arguments).", ((Integer) node.getValue()) == arg1 - arg2); @@ -141,6 +152,12 @@ public class NodeTests {  				return 0;  			} +			@Override +			public String getDescription() { +				// blank +				return null; +			} +  		};  		conn1 = new Connection() { @@ -150,6 +167,12 @@ public class NodeTests {  				return 0;  			} +			@Override +			public String getDescription() { +				// blank +				return null; +			} +  		};  		node.initialise(null, conn0, conn1); @@ -164,6 +187,12 @@ public class NodeTests {  				// blank  				return 0;  			} + +			@Override +			public String getDescription() { +				// blank +				return null; +			}  		};  		node.setConnection(conn2); | 
