public virtual void TestCommonAncestor() { NUnit.Framework.Assert.AreEqual(1, graph.CommonAncestor(graph.GetNodeByIndex(43), graph.GetNodeByIndex(44))); NUnit.Framework.Assert.AreEqual(1, graph.CommonAncestor(graph.GetNodeByIndex(41), graph.GetNodeByIndex(39))); NUnit.Framework.Assert.AreEqual(1, graph.CommonAncestor(graph.GetNodeByIndex(39), graph.GetNodeByIndex(41))); NUnit.Framework.Assert.AreEqual(2, graph.CommonAncestor(graph.GetNodeByIndex(40), graph.GetNodeByIndex(42))); NUnit.Framework.Assert.AreEqual(2, graph.CommonAncestor(graph.GetNodeByIndex(42), graph.GetNodeByIndex(40))); // too far for this method NUnit.Framework.Assert.AreEqual(-1, graph.CommonAncestor(graph.GetNodeByIndex(10), graph.GetNodeByIndex(42))); // assertEquals(null, common); NUnit.Framework.Assert.AreEqual(0, graph.CommonAncestor(graph.GetNodeByIndex(10), graph.GetNodeByIndex(10))); NUnit.Framework.Assert.AreEqual(0, graph.CommonAncestor(graph.GetNodeByIndex(40), graph.GetNodeByIndex(40))); // assertEquals(40, common.index()); // a couple tests at the top of the graph NUnit.Framework.Assert.AreEqual(2, graph.CommonAncestor(graph.GetNodeByIndex(10), graph.GetNodeByIndex(1))); NUnit.Framework.Assert.AreEqual(2, graph.CommonAncestor(graph.GetNodeByIndex(1), graph.GetNodeByIndex(10))); }