Example #1
0
        public void IsDisjointFrom()
        {
            HashedSet <int> set1 = new HashedSet <int>(new int[] { 6, 7, 1, 11, 9, 3, 8 });
            HashedSet <int> set2 = new HashedSet <int>();
            HashedSet <int> set3 = new HashedSet <int>();
            HashedSet <int> set4 = new HashedSet <int>(new int[] { 9, 1, 8, 3, 7, 6, 11 });
            HashedSet <int> set5 = new HashedSet <int>(new int[] { 17, 3, 12, 10 });
            HashedSet <int> set6 = new HashedSet <int>(new int[] { 19, 14, 0, 2 });

            Assert.IsFalse(set1.IsDisjointFrom(set1));
            Assert.IsTrue(set2.IsDisjointFrom(set2));

            Assert.IsTrue(set1.IsDisjointFrom(set2));
            Assert.IsTrue(set2.IsDisjointFrom(set1));

            Assert.IsTrue(set2.IsDisjointFrom(set3));
            Assert.IsTrue(set3.IsDisjointFrom(set2));

            Assert.IsFalse(set1.IsDisjointFrom(set4));
            Assert.IsFalse(set4.IsDisjointFrom(set1));

            Assert.IsFalse(set1.IsDisjointFrom(set5));
            Assert.IsFalse(set5.IsDisjointFrom(set1));

            Assert.IsTrue(set1.IsDisjointFrom(set6));
            Assert.IsTrue(set6.IsDisjointFrom(set1));

            Assert.IsTrue(set5.IsDisjointFrom(set6));
            Assert.IsTrue(set6.IsDisjointFrom(set5));
        }
        public void IsDisjointFrom()
        {
            HashedSet<int> set1 = new HashedSet<int>(new int[] { 6, 7, 1, 11, 9, 3, 8 });
            HashedSet<int> set2 = new HashedSet<int>();
            HashedSet<int> set3 = new HashedSet<int>();
            HashedSet<int> set4 = new HashedSet<int>(new int[] { 9, 1, 8, 3, 7, 6, 11 });
            HashedSet<int> set5 = new HashedSet<int>(new int[] { 17, 3, 12, 10 });
            HashedSet<int> set6 = new HashedSet<int>(new int[] { 19, 14, 0, 2 });

            Assert.IsFalse(set1.IsDisjointFrom(set1));
            Assert.IsTrue(set2.IsDisjointFrom(set2));

            Assert.IsTrue(set1.IsDisjointFrom(set2));
            Assert.IsTrue(set2.IsDisjointFrom(set1));

            Assert.IsTrue(set2.IsDisjointFrom(set3));
            Assert.IsTrue(set3.IsDisjointFrom(set2));

            Assert.IsFalse(set1.IsDisjointFrom(set4));
            Assert.IsFalse(set4.IsDisjointFrom(set1));

            Assert.IsFalse(set1.IsDisjointFrom(set5));
            Assert.IsFalse(set5.IsDisjointFrom(set1));

            Assert.IsTrue(set1.IsDisjointFrom(set6));
            Assert.IsTrue(set6.IsDisjointFrom(set1));

            Assert.IsTrue(set5.IsDisjointFrom(set6));
            Assert.IsTrue(set6.IsDisjointFrom(set5));
        }