예제 #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);
 }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
 public void TestMergeSortEmptyList()
 {
     originalList = new List <int>();
     originalList = SortAlgorithms.InsertionSort(originalList);
     CollectionAssert.AreEqual(new List <int>(), originalList);
 }
예제 #5
0
 public void TestInsertionSort()
 {
     originalList = new List <int>(new int[] { 5, 4, 3, 1, 2 });
     originalList = SortAlgorithms.InsertionSort(originalList);
     CollectionAssert.AreEqual(sortedList, originalList);
 }