aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/tests/OutputTests.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-01 23:00:53 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-01 23:00:53 +0100
commit02fd2bc7059da416937beb1abe67e5ca60379030 (patch)
tree609341fe10aaa0f2dc45a1e72eba20bd24fb1281 /src/jcgp/tests/OutputTests.java
parenta757deacded0d7357a9f68462d3f2051e16004ee (diff)
Settings pane now actually controls the parameters, not much left to do.
Diffstat (limited to 'src/jcgp/tests/OutputTests.java')
-rw-r--r--src/jcgp/tests/OutputTests.java94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/jcgp/tests/OutputTests.java b/src/jcgp/tests/OutputTests.java
deleted file mode 100644
index 8658fa4..0000000
--- a/src/jcgp/tests/OutputTests.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package jcgp.tests;
-
-import static org.junit.Assert.assertTrue;
-
-import jcgp.JCGP.Resources;
-import jcgp.population.Chromosome;
-import jcgp.population.Connection;
-import jcgp.population.Output;
-
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- * Tests which cover the behaviour specified for an output.
- *
- * - An output contains a single source Connection, which can be set and got.
- * - It should return the value of its source connection.
- * - It must be addressable by an index set upon construction only.
- *
- *
- * @author Eduardo Pedroni
- *
- */
-public class OutputTests {
-
- private Output output;
- private static Chromosome chromosome;
- private static Resources resources;
- // these are the test values
- private final int outputValue = 10;
- private final int outputIndex = 2;
-
- @BeforeClass
- public static void setUpBeforeClass() {
- resources = new Resources();
- chromosome = new Chromosome(resources);
- }
-
- @Before
- public void setUp() throws Exception {
- output = new Output(chromosome, outputIndex);
- }
-
- @Test
- public void evaluationsTest() {
- // set source connection, check that the appropriate value is returned
- output.setConnection(0, new Connection() {
-
- @Override
- public Object getValue() {
- // test value
- return outputValue;
- }
-
- @Override
- public String getDescription() {
- // blank
- return null;
- }
- });
-
- assertTrue("Incorrect evaluation.", ((Integer) output.calculate()) == outputValue);
- }
-
- @Test
- public void connectionTest() {
- // set a new connection, check that it is correctly returned
- Connection newConn = new Connection() {
-
- @Override
- public Object getValue() {
- // blank
- return 0;
- }
-
- @Override
- public String getDescription() {
- // blank
- return null;
- }
- };
- output.setConnection(0, newConn);
-
- assertTrue("Incorrect connection returned.", output.getSource() == newConn);
- }
-
- @Test
- public void indexTest() {
- // check that the index returned is the one passed to the constructor
- assertTrue("Incorrect index returned.", output.getIndex() == outputIndex);
- }
-}