-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestNode.java
More file actions
37 lines (30 loc) · 751 Bytes
/
TestNode.java
File metadata and controls
37 lines (30 loc) · 751 Bytes
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
package gp_project;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class TestNode {
@Before
public void setUp() throws Exception {
}
@Test
public void testConstructor() {
Node n = new Node("0", NodeType.OPERAND);
assertEquals(n.getData(), "0");
}
@Test
public void testCopyConstructor() {
Node n1 = new Node("0", NodeType.OPERAND);
Node n2 = new Node(n1);
assertEquals(n2.getData(), "0");
assertEquals(n2.getNodeType(), NodeType.OPERAND);
}
@Test
public void testGettersAndSetters()
{
Node n1 = new Node("+", NodeType.OPERATOR);
n1.setData("2");
assertEquals(n1.getData(), "2");
n1.setNodeType(NodeType.OPERAND);
assertEquals(n1.getNodeType(), NodeType.OPERAND);
}
}