Exemple #1
0
        public void PopBack()
        {
            var vector = new Vector <string>(Globals.Strings);
            var system = new S.List <string>(Globals.Strings);

            Comparer <string> .Compare(vector, system);

            for (int i = 0; i < Globals.Strings.Length; i++)
            {
                vector.PopBack();
                system.RemoveAt(Globals.Strings.Length - i - 1);

                Comparer <string> .Compare(vector, system);
            }

            Comparer <string> .Compare(vector, system);

            try
            {
                vector.PopBack();
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException) { }

            Comparer <string> .Compare(vector, system);
        }
Exemple #2
0
        public void RemoveAt()
        {
            var list   = new List <int>(Globals.Ints);
            var system = new S.List <int>(Globals.Ints);

            Comparer <int> .Compare(list, system);

            try
            {
                list.RemoveAt(Globals.Ints.Length);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException) { }

            try
            {
                list.RemoveAt(-1);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException) { }

            Comparer <int> .Compare(list, system);

            Random random = new Random();

            while (system.Count != 0)
            {
                int index = random.Next(0, system.Count);

                list.RemoveAt(index);
                system.RemoveAt(index);

                Comparer <int> .Compare(list, system);
            }

            Comparer <int> .Compare(list, system);
        }