Beispiel #1
0
 public void InsertionSort_Test_1()
 {
     int[] nums     = { 7, 6, 5, 4, 3, 2, 1 };
     int[] expected = { 1, 2, 3, 4, 5, 6, 7 };
     int[] actual   = sortAlgos.InsertionSort(nums);
     CollectionAssert.AreEqual(expected, actual);
 }
Beispiel #2
0
        public void TestHighRepInsertion()
        {
            SetUp3(true);
            SortAlgorithms.InsertionSort(arrayTest);

            bool same = true;

            for (int i = 0; i < arrayTest.Length && same && (i + 1 < arrayTest.Length); i++)
            {
                if (arrayTest[i] > arrayTest[i + 1])
                {
                    same = false;
                }
            }

            Assert.IsTrue(same);
        }
Beispiel #3
0
        public void TestHighInsertion()
        {
            SetUp1(true);
            SortAlgorithms.InsertionSort(arrayTest);

            bool same = true;

            for (int i = 0; i < arrayTest.Length && same; i++)
            {
                if (arrayTest[i] != solutionHigh[i])
                {
                    same = false;
                }
            }

            Assert.IsTrue(same);
        }
 public void TestMergeSortEmptyList()
 {
     originalList = new List <int>();
     originalList = SortAlgorithms.InsertionSort(originalList);
     CollectionAssert.AreEqual(new List <int>(), originalList);
 }
 public void TestInsertionSort()
 {
     originalList = new List <int>(new int[] { 5, 4, 3, 1, 2 });
     originalList = SortAlgorithms.InsertionSort(originalList);
     CollectionAssert.AreEqual(sortedList, originalList);
 }