Пример #1
0
        public void TestInvalidSubsetOf()
        {
            PascalSet s1 = new PascalSet(0, 50, new int[] { 15, 20, 30 });
            PascalSet s2 = new PascalSet(10, 60, new int[] { 15, 20, 60 });

            s1.IsSubsetOf(s2);
        }
Пример #2
0
        public void Simple()
        {
            var s1 = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });
            var s2 = new PascalSet(0, 50, new[] { 15, 20, 30 });
            var s3 = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });

            Assert.IsFalse(s1.IsSubsetOf(s2));
            Assert.IsTrue(s2.IsSubsetOf(s1));
            Assert.IsTrue(s3.IsSubsetOf(s1));
            Assert.IsTrue(s1.IsSubsetOf(s3));

            Assert.IsFalse(s1 <= s2);
            Assert.IsTrue(s2 <= s1);
            Assert.IsTrue(s3 <= s1);
            Assert.IsTrue(s1 <= s3);
        }
Пример #3
0
        public void TestIsSubsetOf()
        {
            PascalSet s1 = new PascalSet(0, 50, new int[] { 15, 20, 30, 40, 34 });
            PascalSet s2 = new PascalSet(0, 50, new int[] { 15, 20, 30 });
            PascalSet s3 = new PascalSet(0, 50, new int[] { 15, 20, 30, 40, 34 });

            Assert.AreEqual(s1.IsSubsetOf(s2), false);
            Assert.AreEqual(s2.IsSubsetOf(s1), true);
            Assert.AreEqual(s3.IsSubsetOf(s1), true);
            Assert.AreEqual(s1.IsSubsetOf(s3), true);

            Assert.AreEqual(s1 <= s2, false);
            Assert.AreEqual(s2 <= s1, true);
            Assert.AreEqual(s3 <= s1, true);
            Assert.AreEqual(s1 <= s3, true);
        }
Пример #4
0
        public void IsSubsetOfExample()
        {
            // Create 3 pascal sets with various items
            var pascalSet1 = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });
            var pascalSet2 = new PascalSet(0, 50, new[] { 15, 20, 30 });
            var pascalSet3 = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });

            // s1 is not a subset of s2
            Assert.IsFalse(pascalSet1.IsSubsetOf(pascalSet2));

            // s2 is a subset of s1
            Assert.IsTrue(pascalSet2.IsSubsetOf(pascalSet1));

            // s3 is a subset of s1
            Assert.IsTrue(pascalSet3.IsSubsetOf(pascalSet1));

            // s1 is a subset of s3
            Assert.IsTrue(pascalSet1.IsSubsetOf(pascalSet3));
        }
Пример #5
0
        public void NullSet()
        {
            var pascalSet = new PascalSet(500);

            Assert.Throws <ArgumentNullException>(() => pascalSet.IsSubsetOf(null));
        }
Пример #6
0
        public void TestNullIsSubsetOf()
        {
            PascalSet set = new PascalSet(20);

            set.IsSubsetOf(null);
        }
Пример #7
0
        public void NullSet()
        {
            var pascalSet = new PascalSet(500);

            pascalSet.IsSubsetOf(null);
        }