public void shellSortTest1()
        {
            /*Description:tests to check if shell function works
            * (Arguments)->return type: (void)->void
            *Precondition: actual main form and functions must exist
            * Postcondition:expected array and the actual returned array is checked to see if equal
            * Example(s): {9,8} passed, {8,9} is returned, the test passed*/

            // test with huge negatives

            frmMain_Accessor target = new frmMain_Accessor(); // TODO: Initialize to an appropriate value
            int[] arr = {-89000,-200000,-1000000,-50000}; // TODO: Initialize to an appropriate value
            int[] arrExpected = {-1000000,-200000,-89000,-50000}; // TODO: Initialize to an appropriate value
            const int SIZE = 4;
            int last = SIZE - 1; // TODO: Initialize to an appropriate value

            int[] actual = target.shellSort(arr, last);

            for (int i = 0; i < SIZE; i++)
            {
                Assert.AreEqual(arrExpected[i], actual[i]);
            }

            // Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void bubbleSortTest1()
        {
            /*Description:tests to check if bubble function works
            * (Arguments)->return type: (void)->void
            *Precondition: actual main form and functions must exist
            * Postcondition:expected array and the actual returned array is checked to see if equal
            * Example(s): {9,8} passed, {8,9} is returned, the test passed*/

            // test duplicates of negative and positive

            frmMain_Accessor target = new frmMain_Accessor(); // TODO: Initialize to an appropriate value
            int[] arr = { -89001,3,3,-89001,905,87,-89001,99,99,-3,89001,0}; // TODO: Initialize to an appropriate value
            int[] arrExpected = {-89001,-89001,-89001,-3,0,3,3,87,99,99,905,89001}; // TODO: Initialize to an appropriate value
            const int SIZE = 12;
            int last = SIZE - 1; // TODO: Initialize to an appropriate value

            int[] actual = target.insertionSort(arr, last);

            for (int i = 0; i < SIZE; i++)
            {
                Assert.AreEqual(arrExpected[i], actual[i]);
            }

            // Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #3
0
 public void insertionSortTest1()
 {
     frmMain_Accessor target = new frmMain_Accessor(); // TODO: Initialize to an appropriate value
     int[] arr = { 10, 2, 7, 70, 50 }; // TODO: Initialize to an appropriate value
     int[] arrExpected = { 2, 7, 10, 50, 70 }; // TODO: Initialize to an appropriate value
     int last = 4; // TODO: Initialize to an appropriate value
        // int[] expected = { 2, 7, 10, 50, 70 }; // TODO: Initialize to an appropriate value
     int[] actual = target.insertionSort(arr, last);
     Assert.AreEqual(arrExpected, actual);
     //Assert.AreEqual(expected, actual);
     //  Assert.Inconclusive("Verify the correctness of this test method.");
 }
Beispiel #4
0
 public void bubbleSortTest()
 {
     frmMain_Accessor target = new frmMain_Accessor(); // TODO: Initialize to an appropriate value
     int[] arr = null; // TODO: Initialize to an appropriate value
     int[] arrExpected = null; // TODO: Initialize to an appropriate value
     int last = 0; // TODO: Initialize to an appropriate value
     int[] expected = null; // TODO: Initialize to an appropriate value
     int[] actual;
     actual = target.bubbleSort(arr, last);
     Assert.AreEqual(arrExpected, arr);
     Assert.AreEqual(expected, actual);
        // Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public void bubbleSortTest3()
        {
            /*Description:tests to check if bubble function works
               * (Arguments)->return type: (void)->void
               *Precondition: actual main form and functions must exist
               * Postcondition:expected array and the actual returned array is checked to see if equal
               * Example(s): {9,8} passed, {8,9} is returned, the test passed*/

            // test with an already sorted array

            frmMain_Accessor target = new frmMain_Accessor(); // TODO: Initialize to an appropriate value
            int[] arr = {6,9,78,100,509,1089,4560,500000,600107}; // TODO: Initialize to an appropriate value
            int[] arrExpected = { 6, 9, 78, 100, 509, 1089, 4560, 500000, 600107 }; // TODO: Initialize to an appropriate value
            const int SIZE = 9;
            int last = SIZE - 1; // TODO: Initialize to an appropriate value

            int[] actual = target.insertionSort(arr, last);

            for (int i = 0; i < SIZE; i++)
            {
                Assert.AreEqual(arrExpected[i], actual[i]);
            }

            // Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #6
0
        public void insertionSortTest2()
        {
            /*Description:tests to check if insertion function works
            * (Arguments)->return type: (void)->void
            *Precondition: actual main form and functions must exist
            * Postcondition:expected array and the actual returned array is checked to see if equal
            * Example(s): {9,8} passed, {8,9} is returned, the test passed*/

            // test with huge values that are close

            frmMain_Accessor target = new frmMain_Accessor(); // TODO: Initialize to an appropriate value
            int[] arr = {1958322,78101,1000,2000567,11346,10000,5000000}; // TODO: Initialize to an appropriate value
            int[] arrExpected = { 1000,10000,11346,78101,1958322,2000567,5000000}; // TODO: Initialize to an appropriate value
            const int SIZE = 7;
            int last = SIZE - 1; // TODO: Initialize to an appropriate value

            int[] actual = target.insertionSort(arr, last);

            for (int i = 0; i < SIZE; i++)
            {
                Assert.AreEqual(arrExpected[i], actual[i]);
            }

            // Assert.Inconclusive("Verify the correctness of this test method.");
        }