diff options
Diffstat (limited to 'org.eclipse.viatra.coding/src/test/java/org/eclipse/viatra/coding/TestAdjacencyStateCode.java')
-rw-r--r-- | org.eclipse.viatra.coding/src/test/java/org/eclipse/viatra/coding/TestAdjacencyStateCode.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/org.eclipse.viatra.coding/src/test/java/org/eclipse/viatra/coding/TestAdjacencyStateCode.java b/org.eclipse.viatra.coding/src/test/java/org/eclipse/viatra/coding/TestAdjacencyStateCode.java new file mode 100644 index 00000000..5bd29984 --- /dev/null +++ b/org.eclipse.viatra.coding/src/test/java/org/eclipse/viatra/coding/TestAdjacencyStateCode.java | |||
@@ -0,0 +1,40 @@ | |||
1 | package org.eclipse.viatra.coding; | ||
2 | |||
3 | import org.junit.Before; | ||
4 | import org.junit.Test; | ||
5 | |||
6 | import java.util.ArrayList; | ||
7 | import java.util.Arrays; | ||
8 | import java.util.Collections; | ||
9 | import java.util.List; | ||
10 | |||
11 | public class TestAdjacencyStateCode { | ||
12 | Graph graph; | ||
13 | |||
14 | @Before | ||
15 | public void setup(){ | ||
16 | List<String> nodeLabels = Collections.singletonList("1"); | ||
17 | List<String> edgeLabels = Arrays.asList("a", "b"); | ||
18 | |||
19 | graph = new Graph(nodeLabels, edgeLabels); | ||
20 | List<Node> nodes = new ArrayList<>(); | ||
21 | for (int i = 0; i < 5; i++) { | ||
22 | nodes.add(new Node(Integer.toString(i))); | ||
23 | graph.addNode(nodes.get(i), "1"); | ||
24 | } | ||
25 | |||
26 | graph.addEdge(nodes.get(4), nodes.get(3), "a"); | ||
27 | graph.addEdge(nodes.get(3), nodes.get(1), "b"); | ||
28 | graph.addEdge(nodes.get(2), nodes.get(4), "b"); | ||
29 | graph.addEdge(nodes.get(1), nodes.get(2), "a"); | ||
30 | graph.addEdge(nodes.get(1), nodes.get(0), "a"); | ||
31 | graph.addEdge(nodes.get(0), nodes.get(4), "b"); | ||
32 | } | ||
33 | |||
34 | @Test | ||
35 | public void testAdjacencyStateCode () { | ||
36 | Encoder encoder = new Encoder(new AdjacencyStateCode(10)); | ||
37 | AdjacencyStateCode adj = (AdjacencyStateCode) encoder.encode(graph); | ||
38 | System.out.println(adj.toString()); | ||
39 | } | ||
40 | } | ||