Пример #1
0
        public void SuperSortUp()
        {
            SuperList <int> superlist = new SuperList <int>()
            {
                9, 1, 8, 2, 7, 3, 6, 4, 5
            };

            superlist.SortUP();
            for (int i = 0; i < superlist.Count; i++)
            {
                int num = i + 1;
                Assert.AreEqual(num, superlist[i]);
            }
        }
Пример #2
0
        public void SuperAlphabeticalStrings()
        {
            SuperList <string> superlist = new SuperList <string>()
            {
                "amanda", "aardvark", "kazam", "blueberry", "apple", "sorting is getting old"
            };

            superlist.SortUP();
            SuperList <string> superExpected = new SuperList <string>()
            {
                "aardvark", "amanda", "apple", "blueberry", "kazam", "sorting is getting old"
            };

            for (int i = 0; i < superlist.Count; i++)
            {
                Assert.AreEqual(superlist[i], superExpected[i]);
            }
        }
Пример #3
0
        public void SuperAlphabetical()
        {
            SuperList <char> superlist = new SuperList <char>()
            {
                'e', 'i', 'a', 'm', 'l'
            };

            superlist.SortUP();
            SuperList <char> superExpected = new SuperList <char>()
            {
                'a', 'e', 'i', 'l', 'm'
            };

            for (int i = 0; i < superlist.Count; i++)
            {
                Assert.AreEqual(superlist[i], superExpected[i]);
            }
        }
Пример #4
0
        public void BigSort()
        {
            int             num       = 0;
            Random          random    = new Random();
            SuperList <int> superlist = new SuperList <int>();

            for (int i = 0; i < 100000; i++)
            {
                num = random.Next(1000);
                superlist.Add(num);
            }
            superlist.SortUP();
            num = -1;
            for (int i = 0; i < superlist.Count; i++)
            {
                Assert.IsTrue(num <= superlist[i]);
                num = superlist[i];
            }
        }
Пример #5
0
        public void SuperSortUpTest2()
        {
            SuperList <int> superlist = new SuperList <int>()
            {
                9, 1, 2, 2, 7, 3, 2, 2, 4, 5
            };

            superlist.SortUP();
            SuperList <int> superExpected = new SuperList <int>()
            {
                1, 2, 2, 2, 2, 3, 4, 5, 7, 9
            };

            superExpected.CleanArray();
            for (int i = 0; i < superlist.Count; i++)
            {
                Assert.AreEqual(superlist[i], superExpected[i]);
            }
        }