Exemple #1
0
        public void Simple()
        {
            var pascalSet = new PascalSet(0, 500);
            Assert.IsTrue(pascalSet.IsEmpty);

            pascalSet.Add(50);
            Assert.IsFalse(pascalSet.IsEmpty);

            pascalSet.Add(100);
            Assert.IsFalse(pascalSet.IsEmpty);

            pascalSet.Clear();
            Assert.IsTrue(pascalSet.IsEmpty);
        }
Exemple #2
0
        public void Simple()
        {
            var pascalSet = new PascalSet(0, 500);

            Assert.IsTrue(pascalSet.IsEmpty);

            pascalSet.Add(50);
            Assert.IsFalse(pascalSet.IsEmpty);

            pascalSet.Add(100);
            Assert.IsFalse(pascalSet.IsEmpty);

            pascalSet.Clear();
            Assert.IsTrue(pascalSet.IsEmpty);
        }
Exemple #3
0
        public void TestIsEmpty()
        {
            PascalSet s = new PascalSet(0, 500);

            Assert.AreEqual(s.IsEmpty, true);

            s.Add(50);
            Assert.AreEqual(s.IsEmpty, false);

            s.Add(100);
            Assert.AreEqual(s.IsEmpty, false);

            s.Clear();
            Assert.AreEqual(s.IsEmpty, true);
        }
Exemple #4
0
        public void Simple()
        {
            var values    = new[] { 20, 30, 40 };
            var pascalSet = new PascalSet(0, 50, values);

            Assert.AreEqual(pascalSet.Count, 3);

            pascalSet.Clear();

            for (var i = 0; i <= 50; i++)
            {
                Assert.IsFalse(pascalSet[i]);
            }

            Assert.AreEqual(pascalSet.Count, 0);
        }
Exemple #5
0
        public void Simple()
        {
            var values = new[] { 20, 30, 40 };
            var pascalSet = new PascalSet(0, 50, values);

            Assert.AreEqual(pascalSet.Count, 3);

            pascalSet.Clear();

            for (var i = 0; i <= 50; i++)
            {
                Assert.IsFalse(pascalSet[i]);
            }

            Assert.AreEqual(pascalSet.Count, 0);
        }
Exemple #6
0
        public void TestClear()
        {
            int[]     values = new int[] { 20, 30, 40 };
            PascalSet s      = new PascalSet(0, 50, values);

            Assert.AreEqual(s.Count, 3);

            s.Clear();

            for (int i = 0; i <= 50; i++)
            {
                Assert.AreEqual(s[i], false);
            }

            Assert.AreEqual(s.Count, 0);
        }
        public void ClearExample()
        {
            // Create a sample PascalSet instance
            var pascalSet = new PascalSet(100)
            {
                10, 57
            };

            // There will be two items in the set
            Assert.AreEqual(2, pascalSet.Count);

            // Remove all items from the set
            pascalSet.Clear();

            // There will be no items left in the set
            Assert.AreEqual(0, pascalSet.Count);
        }
Exemple #8
0
        public void ClearExample()
        {
            // Create a sample PascalSet instance
            var pascalSet = new PascalSet(100);

            // Add the 10th item to the set
            pascalSet.Add(10);

            // Add the 57th item to the set
            pascalSet.Add(57);

            // There will be two items in the set
            Assert.AreEqual(pascalSet.Count, 2);

            // Remove all items from the set
            pascalSet.Clear();

            // There will be no items left in the set
            Assert.AreEqual(pascalSet.Count, 0);
        }
Exemple #9
0
        public void IsEmptyExample()
        {
            // Create a sample PascalSet
            var pascalSet = new PascalSet(100);

            // The PascalSet will initially be empty
            Assert.IsTrue(pascalSet.IsEmpty);

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

            // Not empty anymore...
            Assert.IsFalse(pascalSet.IsEmpty);

            // Clear the PascalSet, making it empty once more.
            pascalSet.Clear();
            Assert.IsTrue(pascalSet.IsEmpty);
        }
Exemple #10
0
        public void CountExample()
        {
            // Create a sample PascalSet instance
            var pascalSet = new PascalSet(100);

            // Add the 10th item to the set
            pascalSet.Add(10);

            // There will be one item in the set
            Assert.AreEqual(pascalSet.Count, 1);

            // Add the 57th item to the set
            pascalSet.Add(57);

            // There will be two items in the set
            Assert.AreEqual(pascalSet.Count, 2);

            // Clear the set, thereby removing all items
            pascalSet.Clear();

            // There will be no items left in the set
            Assert.AreEqual(pascalSet.Count, 0);
        }
Exemple #11
0
        public void Simple()
        {
            var pascalSet = new PascalSet(0, 100);
            Assert.IsFalse(pascalSet.IsFull);

            for (var i = 0; i <= 100; i++)
            {
                pascalSet.Add(i);

                if (i < 100)
                {
                    Assert.IsFalse(pascalSet.IsFull);
                }
                else
                {
                    Assert.IsTrue(pascalSet.IsFull);
                }
            }

            pascalSet.Clear();

            Assert.IsFalse(pascalSet.IsFull);
        }
Exemple #12
0
        public void Simple()
        {
            var pascalSet = new PascalSet(0, 100);

            Assert.IsFalse(pascalSet.IsFull);

            for (var i = 0; i <= 100; i++)
            {
                pascalSet.Add(i);

                if (i < 100)
                {
                    Assert.IsFalse(pascalSet.IsFull);
                }
                else
                {
                    Assert.IsTrue(pascalSet.IsFull);
                }
            }

            pascalSet.Clear();

            Assert.IsFalse(pascalSet.IsFull);
        }