public void TestLiveEdgeDynamicGraphArguments() { using (var graph = new MemoryMappedGraph <LiveEdge>(1000, 1024)) { uint vertex1 = graph.AddVertex(0, 0); uint vertex2 = graph.AddVertex(0, 0); uint vertex3 = 3; Assert.Catch <ArgumentOutOfRangeException>(() => { graph.AddEdge(vertex3, vertex1, new LiveEdge(), null); }); Assert.Catch <ArgumentOutOfRangeException>(() => { graph.AddEdge(vertex1, vertex3, new LiveEdge(), null); }); Assert.Catch <ArgumentException>(() => { graph.AddEdge(vertex1, vertex1, new LiveEdge(), null); }); Assert.Catch <ArgumentException>(() => { graph.AddEdge(vertex1, vertex1, new LiveEdge(), null); }); Assert.Catch <ArgumentOutOfRangeException>(() => { graph.ContainsEdges(vertex3, vertex1); }); Assert.Catch <ArgumentOutOfRangeException>(() => { graph.ContainsEdges(vertex1, vertex3); }); LiveEdge edge; Assert.Catch <ArgumentOutOfRangeException>(() => { graph.GetEdge(vertex3, vertex1, out edge); }); Assert.Catch <ArgumentOutOfRangeException>(() => { graph.GetEdge(vertex1, vertex3, out edge); }); Assert.Catch <ArgumentOutOfRangeException>(() => { graph.GetEdges(vertex3); }); Assert.Catch <ArgumentOutOfRangeException>(() => { graph.SetVertex(vertex3, 10, 10); }); } }
public void TestLiveEdgeDynamicGraphVertex() { using (var graph = new MemoryMappedGraph <LiveEdge>(1000, 1024)) { var vertex = graph.AddVertex(51, 4); float latitude, longitude; graph.GetVertex(vertex, out latitude, out longitude); Assert.AreEqual(51, latitude); Assert.AreEqual(4, longitude); graph.SetVertex(vertex, 52, 5); graph.GetVertex(vertex, out latitude, out longitude); Assert.AreEqual(52, latitude); Assert.AreEqual(5, longitude); var arcs = graph.GetEdges(vertex).ToKeyValuePairs(); Assert.AreEqual(0, arcs.Length); Assert.IsFalse(graph.GetVertex(100, out latitude, out longitude)); } }
public void TestLiveEdgeDynamicGraphVertex() { using (var graph = new MemoryMappedGraph<LiveEdge>(1000, 1024)) { var vertex = graph.AddVertex(51, 4); float latitude, longitude; graph.GetVertex(vertex, out latitude, out longitude); Assert.AreEqual(51, latitude); Assert.AreEqual(4, longitude); graph.SetVertex(vertex, 52, 5); graph.GetVertex(vertex, out latitude, out longitude); Assert.AreEqual(52, latitude); Assert.AreEqual(5, longitude); var arcs = graph.GetEdges(vertex).ToKeyValuePairs(); Assert.AreEqual(0, arcs.Length); Assert.IsFalse(graph.GetVertex(100, out latitude, out longitude)); } }
public void TestLiveEdgeDynamicGraphArguments() { using (var graph = new MemoryMappedGraph<LiveEdge>(1000, 1024)) { uint vertex1 = graph.AddVertex(0, 0); uint vertex2 = graph.AddVertex(0, 0); uint vertex3 = 3; Assert.Catch<ArgumentOutOfRangeException>(() => { graph.AddEdge(vertex3, vertex1, new LiveEdge(), null); }); Assert.Catch<ArgumentOutOfRangeException>(() => { graph.AddEdge(vertex1, vertex3, new LiveEdge(), null); }); Assert.Catch<ArgumentException>(() => { graph.AddEdge(vertex1, vertex1, new LiveEdge(), null); }); Assert.Catch<ArgumentException>(() => { graph.AddEdge(vertex1, vertex1, new LiveEdge(), null); }); Assert.Catch<ArgumentOutOfRangeException>(() => { graph.ContainsEdge(vertex3, vertex1); }); Assert.Catch<ArgumentOutOfRangeException>(() => { graph.ContainsEdge(vertex1, vertex3); }); LiveEdge edge; Assert.Catch<ArgumentOutOfRangeException>(() => { graph.GetEdge(vertex3, vertex1, out edge); }); Assert.Catch<ArgumentOutOfRangeException>(() => { graph.GetEdge(vertex1, vertex3, out edge); }); Assert.Catch<ArgumentOutOfRangeException>(() => { graph.GetEdges(vertex3); }); Assert.Catch<ArgumentOutOfRangeException>(() => { graph.SetVertex(vertex3, 10, 10); }); } }