public ActionResult Index() { TestConnectionData test = new TestConnectionData(); test.Connecting(); return(View()); }
public void TestFastGraph() { var graph = new FastGraph <int, TestNode, TestConnectionData>(100, 100); var graph2 = new FastGraph <int, TestNode, TestConnectionData>(3, 1); TestGraph <int, TestNode, TestConnectionData, FastGraph <int, TestNode, TestConnectionData> >(graph, (idx) => new TestNode(idx, UnityEngine.Random.Range(0, 100000)), (idx) => idx, () => new TestConnectionData() { cost = UnityEngine.Random.value }, (node) => node.index); // Test memory management TestNode node1 = new TestNode(0, 1); TestNode node2 = new TestNode(1, 2); TestNode node3 = new TestNode(2, 3); TestConnectionData cData1 = new TestConnectionData() { cost = 0.5f }; TestConnectionData cData2 = new TestConnectionData() { cost = 1f }; graph2.Add(0, node1); graph2.Add(1, node2); graph2.Add(2, node3); graph2.Connect(node1, node2, cData1); bool exceptionThrown = false; try { graph2.Connect(node1, node3, cData2); } catch (OutOfMemoryException ex) { exceptionThrown = true; } Assert.IsTrue(exceptionThrown); exceptionThrown = false; try { graph2.Add(3, node1); } catch (OutOfMemoryException ex) { exceptionThrown = true; } Assert.IsTrue(exceptionThrown); }