public void equility_and_hash_works_according_to_the_content(IntSet x, IntSet y) { bool equals = x.Equals(y); bool setEquals = x.SetEquals(y); bool hsEquals = new HashSet <int>(x).SetEquals(new HashSet <int>(y)); Assert.AreEqual(hsEquals, equals); Assert.AreEqual(hsEquals, setEquals); if (equals) { Assert.AreEqual(x.GetHashCode(), y.GetHashCode()); } }
public void equility_and_hash_works_according_to_the_content(IntSet x, IntSet y) { bool equals = x.Equals(y); bool setEquals = x.SetEquals(y); bool hsEquals = new HashSet <int>(x).SetEquals(new HashSet <int>(y)); Assert.AreEqual(hsEquals, equals); Assert.AreEqual(hsEquals, setEquals); if (equals) { Assert.AreEqual(x.GetHashCode(), y.GetHashCode()); } else { // Uncomment for hashing failure statistics // Assert.AreNotEqual(x.GetHashCode(), y.GetHashCode()); } }
public void equility_and_hash_to_set_with_different_size_works_according_to_the_content(IntSet x, IntSet yOfSameType) { BitSetType otherSetType = new BitSetType(10); var y = yOfSameType.Intersect(otherSetType.All); bool equals = x.Equals(y); bool setEquals = x.SetEquals(y); bool hsEquals = new HashSet <int>(x).SetEquals(new HashSet <int>(y)); Assert.AreEqual(hsEquals, equals); Assert.AreEqual(hsEquals, setEquals); if (equals) { Assert.AreEqual(x.GetHashCode(), y.GetHashCode()); } else { // Uncomment for hashing failure statistics // Assert.AreNotEqual(x.GetHashCode(), y.GetHashCode()); } }
public void equility_and_hash_works_according_to_the_content(IntSet x, IntSet y) { bool equals = x.Equals(y); bool setEquals = x.SetEquals(y); bool hsEquals = new HashSet<int>(x).SetEquals(new HashSet<int>(y)); Assert.AreEqual(hsEquals, equals); Assert.AreEqual(hsEquals, setEquals); if (equals) { Assert.AreEqual(x.GetHashCode(), y.GetHashCode()); } else { // Uncomment for hashing failure statistics // Assert.AreNotEqual(x.GetHashCode(), y.GetHashCode()); } }
public void equility_and_hash_to_set_with_different_size_works_according_to_the_content(IntSet x, IntSet yOfSameType) { BitSetType otherSetType = new BitSetType(10); var y = yOfSameType.Intersect(otherSetType.All); bool equals = x.Equals(y); bool setEquals = x.SetEquals(y); bool hsEquals = new HashSet<int>(x).SetEquals(new HashSet<int>(y)); Assert.AreEqual(hsEquals, equals); Assert.AreEqual(hsEquals, setEquals); if (equals) { Assert.AreEqual(x.GetHashCode(), y.GetHashCode()); } else { // Uncomment for hashing failure statistics // Assert.AreNotEqual(x.GetHashCode(), y.GetHashCode()); } }
public void equility_and_hash_works_according_to_the_content(IntSet x, IntSet y) { bool equals = x.Equals(y); bool setEquals = x.SetEquals(y); bool hsEquals = new HashSet<int>(x).SetEquals(new HashSet<int>(y)); Assert.AreEqual(hsEquals, equals); Assert.AreEqual(hsEquals, setEquals); if (equals) { Assert.AreEqual(x.GetHashCode(), y.GetHashCode()); } }