Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        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());
            }
        }
Ejemplo n.º 3
0
        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());
            }
        }
Ejemplo n.º 4
0
        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());
            }
        }
Ejemplo n.º 5
0
        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());
            }
        }
Ejemplo n.º 6
0
        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());
            }
        }