1 /* TestDirected.java */
2
3 package org.quilt.graph;
4
5 import junit.framework.*;
6 import org.quilt.cl.GraphTalker;
7
8 public class TestDirected extends TestCase {
9
10 Directed graph = null;
11 Entry entry = null;
12 Exit exit = null;
13
14 public TestDirected(String name) {
15 super(name);
16 }
17
18 public void setUp() {
19 graph = new Directed();
20 entry = graph.getEntry();
21 exit = graph.getExit();
22 }
23
24 public void testTwosome() {
25 assertEquals ("wrong index on entry", 0, entry.getIndex() );
26 assertEquals ("wrong index on exit", 1, exit.getIndex() );
27 assertEquals ("wrong number of vertices in new graph",
28 2, graph.size() );
29 }
30
31 public void testBasicSubgraph() {
32 Edge e = entry.getEdge();
33 Directed subgraph = graph.subgraph(e, 5);
34 Entry subEntry = subgraph.getEntry();
35
36 assertEquals("wrong number of vertices in subgraph",
37 2, subgraph.size() );
38
39 assertEquals("wrong number of vertices in nested graph",
40 4, graph.size() );
41
42 // should return the size of the Multi part of the connector
43 assertEquals("size of subgraph ComplexConnector wrong",
44 5, subEntry.getConnector().size() );
45 }
46
47 public void testThreesome() {
48 Edge e = entry.getEdge();
49 try {
50 graph.insertVertex(e) ;
51 } catch (Exception exc) {
52 fail ("error inserting third vertex");
53 }
54 assertEquals ("wrong number of vertices in new graph",
55 3, graph.size() );
56 }
57 public void testLotsInARow() {
58 Edge e = entry.getEdge();
59
60 Vertex A = graph.insertVertex(e);
61 Vertex B = graph.insertVertex(A.getEdge());
62 Vertex C = graph.insertVertex(B.getEdge());
63 Vertex D = graph.insertVertex(C.getEdge());
64 Vertex E = graph.insertVertex(D.getEdge());
65 assertEquals ("wrong number of vertices in graph",
66 7, graph.size() );
67 }
68 }
69
This page was automatically generated by Maven