blob: 51d58d24cd0fc4c78dcb86c3bdd6b89611feddf4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package jcgp.tests;
import static org.junit.Assert.assertTrue;
import jcgp.population.Input;
import org.junit.Before;
import org.junit.Test;
/**
*
* Tests which cover the behaviour specified for an input.
*
* - An input contains a single set value. This value can be freely set for
* fitness evaluation purposes. TODO this value should be generically typed.
* - It must be addressable by an index set upon construction only.
*
*
* @author Eduardo Pedroni
*
*/
public class InputTests {
private Input input;
// these are the test values
private final int inputValue = 19;
private final int inputIndex = 12;
@Before
public void setUp() throws Exception {
input = new Input(inputIndex);
}
@Test
public void valueTest() {
// assign a value to input, check that the returned value is correct
input.setValue(inputValue);
assertTrue("Incorrect value returned.", ((Integer) input.getValue()) == inputValue);
}
@Test
public void indexTest() {
// check that the index returned is the one passed to the constructor
assertTrue("Incorrect index returned.", input.getIndex() == inputIndex);
}
}
|