package graph.examples; import graph.Graph; import graph.Vertex; import org.junit.Test; import static org.junit.Assert.*; public class UndirectedTest { public UndirectedTest() { Undirected example = new Undirected(); graph = example.getGraph(); v1 = example.getV1(); v2 = example.getV2(); v3 = example.getV3(); v4 = example.getV4(); v5 = example.getV5(); } @Test public void testRepresentation() { assertTrue(graph.isEdge(v1, v2)); assertTrue(graph.isEdge(v2, v1)); assertTrue(graph.isEdge(v1, v5)); assertTrue(graph.isEdge(v5, v1)); assertTrue(graph.isEdge(v5, v2)); assertTrue(graph.isEdge(v2, v5)); assertTrue(graph.isEdge(v5, v4)); assertTrue(graph.isEdge(v4, v5)); assertTrue(graph.isEdge(v2, v4)); assertTrue(graph.isEdge(v4, v2)); assertTrue(graph.isEdge(v2, v3)); assertTrue(graph.isEdge(v3, v2)); assertTrue(graph.isEdge(v3, v4)); assertTrue(graph.isEdge(v4, v3)); assertFalse(graph.isEdge(v1, v3)); assertFalse(graph.isEdge(v3, v1)); assertFalse(graph.isEdge(v1, v4)); assertFalse(graph.isEdge(v4, v1)); assertFalse(graph.isEdge(v5, v3)); assertFalse(graph.isEdge(v3, v5)); System.out.println("\n" + graph.toString() + "\n"); } private Graph graph; private Vertex v1, v2, v3, v4, v5; }