public void Mega()
        {
            //arrange
            int i;
            int s   = 0;
            int len = 31;

            int[] mas = { 10, 29, 4, 11, 30, 12, 16, 12, 28, 5, 14, 13, 9, 24, 8, 25, 27, 15, 17, 18, 6, 23, 26, 1, 19, 3, 2, 21, 20, 7, 22 };
            int[] res = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 };
            int[] fin = new int[len];

            //act
            MySortConsole.Program j = new MySortConsole.Program();
            fin = j.Magic(mas, len);

            //assert
            for (i = 0; i < len; i++)           //checking the array for correctness
            {
                if (res[i] == fin[i])
                {
                    s++;
                }
            }
            Assert.AreEqual(len, s);
        }
Exemple #2
0
        public void Ultra()
        {
            //arrange
            int i;
            int s   = 0;
            int len = 9;

            int[] mas = { 4, 5, 9, 8, 6, 1, 3, 2, 7 };
            int[] res = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int[] fin = new int[len];

            //act
            MySortConsole.Program j = new  MySortConsole.Program();
            fin = j.Magic(mas, len);

            //assert
            for (i = 0; i < len; i++)           //checking the array for correctness
            {
                if (res[i] == fin[i])
                {
                    s++;
                }
            }
            Assert.AreEqual(len, s);
        }
Exemple #3
0
        public static void MagicTest()
        {
            //arrange
            int i;
            int s   = 0;
            int len = 9;

            int[] mas = { 4, 5, 9, 8, 6, 1, 3, 2, 7 };
            int[] res = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int[] fin = new int[len];

            //act
            MySortConsole.Program j = new  MySortConsole.Program();
            fin = j.Magic(mas, len);

            //assert
            for (i = 0; i < 10; i++)
            {
                if (res[i] == fin[i])
                {
                    s++;
                }
            }
            Assert.AreEqual(s, len);
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            int i;
            int len = 9;                                    //length of array

            int[] Mas = new int[len];
            Mas[0] = 3;                                     //array
            Mas[1] = 2;
            Mas[2] = 4;
            Mas[3] = 1;
            Mas[4] = 7;
            Mas[5] = 9;
            Mas[6] = 8;
            Mas[7] = 6;
            Mas[8] = 5;
            MySortConsole.Program j = new MySortConsole.Program();
            Mas = j.Magic(Mas, len);
            for (i = 0; i < len; i++)                       //output array to console
            {
                Console.Write(Mas[i]);
            }
            Console.WriteLine();
            Console.ReadKey();
        }