public void DisjointSetAreEquivalentGuardCase4Test() { DisjointSet <int> disjointSet = new DisjointSet <int>(); disjointSet.MakeSet(1); disjointSet.MakeSet(2); bool result = disjointSet.AreEquivalent(2, 5); }
public void DisjointSetAreEquivalentGuardCase2Test() { DisjointSet <object> disjointSet = new DisjointSet <object>(); disjointSet.MakeSet("item1"); disjointSet.MakeSet("item2"); bool result = disjointSet.AreEquivalent("item1", null); }
public void DisjointSetAreEquivalentTest() { DisjointSet <int> disjointSet = new DisjointSet <int>(); disjointSet.MakeSet(1); disjointSet.MakeSet(2); disjointSet.MakeSet(3); Assert.IsFalse(disjointSet.AreEquivalent(1, 2)); Assert.IsFalse(disjointSet.AreEquivalent(2, 3)); Assert.IsFalse(disjointSet.AreEquivalent(1, 3)); disjointSet.Union(2, 3); Assert.IsFalse(disjointSet.AreEquivalent(1, 2)); Assert.IsTrue(disjointSet.AreEquivalent(2, 3)); Assert.IsFalse(disjointSet.AreEquivalent(1, 3)); }