Esempio n. 1
0
        public void IntersectionExample()
        {
            // Create a sample PascalSet
            var pascalSet1 = new PascalSet(100);

            // Set a couple of values in the PascalSet
            for (var i = 0; i < 100; i += 10)
            {
                pascalSet1.Add(i);
            }

            // Create another sample PascalSet
            var pascalSet2 = new PascalSet(100)
            {
                4, 6, 7, 10, 30
            };

            // Get the intersection of the two sets
            var intersection = pascalSet1.Intersection(pascalSet2);

            // The intersection will contain values that was
            // contained in both sets.
            Assert.IsTrue(intersection[10]);
            Assert.IsTrue(intersection[30]);
            Assert.AreEqual(intersection.Count, 2);
        }
Esempio n. 2
0
        public void Simple()
        {
            var s1 = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });
            var s2 = new PascalSet(0, 50, new[] { 20, 25, 30, 35, 40 });

            var intersection = s1.Intersection(s2);

            for (var i = 0; i <= 50; i++)
            {
                if ((i == 20) || (i == 30) || (i == 40))
                {
                    Assert.IsTrue(intersection[i]);
                }
                else
                {
                    Assert.IsFalse(intersection[i]);
                }
            }

            var intersection2 = s1 * s2;
            Assert.IsTrue(intersection.Equals(intersection2));
        }
Esempio n. 3
0
        public void Simple()
        {
            var s1 = new PascalSet(0, 50, new[] { 15, 20, 30, 40, 34 });
            var s2 = new PascalSet(0, 50, new[] { 20, 25, 30, 35, 40 });

            var intersection = s1.Intersection(s2);

            for (var i = 0; i <= 50; i++)
            {
                if ((i == 20) || (i == 30) || (i == 40))
                {
                    Assert.IsTrue(intersection[i]);
                }
                else
                {
                    Assert.IsFalse(intersection[i]);
                }
            }

            var intersection2 = s1 * s2;

            Assert.IsTrue(intersection.Equals(intersection2));
        }
Esempio n. 4
0
        public void TestIntersection()
        {
            PascalSet s1 = new PascalSet(0, 50, new int[] { 15, 20, 30, 40, 34 });
            PascalSet s2 = new PascalSet(0, 50, new int[] { 20, 25, 30, 35, 40 });

            PascalSet intersection = s1.Intersection(s2);

            for (int i = 0; i <= 50; i++)
            {
                if ((i == 20) || (i == 30) || (i == 40))
                {
                    Assert.AreEqual(intersection[i], true);
                }
                else
                {
                    Assert.AreEqual(intersection[i], false);
                }
            }

            PascalSet intersection2 = s1 * s2;

            Assert.AreEqual(intersection.IsEqual(intersection2), true);
        }
Esempio n. 5
0
 public void ExceptionNullSet()
 {
     var pascalSet = new PascalSet(500);
     pascalSet.Intersection(null);
 }
Esempio n. 6
0
        public void ExceptionNullSet()
        {
            var pascalSet = new PascalSet(500);

            pascalSet.Intersection(null);
        }
Esempio n. 7
0
        public void TestNullIntersection()
        {
            PascalSet set = new PascalSet(20);

            set.Intersection(null);
        }
Esempio n. 8
0
        public void ExceptionNullSet()
        {
            var pascalSet = new PascalSet(500);

            Assert.Throws <ArgumentNullException>(() => pascalSet.Intersection(null));
        }