Пример #1
0
        public static void BinarySearch_IComparerCount_ValueOdd()
        {
            Driver <ValX1_IC <int> > ValDriver = new Driver <ValX1_IC <int> >();

            ValX1_IC <int>[] vintArr1 = new ValX1_IC <int> [99];
            for (int i = 0; i < 99; i++)
            {
                vintArr1[i] = new ValX1_IC <int>(i);
            }

            //odd
            ValDriver.BinarySearch(vintArr1, 0, vintArr1.Length);
            ValDriver.BinarySearch(vintArr1, 1, vintArr1.Length - 1);
            ValDriver.BinarySearch(vintArr1, 25, vintArr1.Length - 25);
            ValDriver.BinarySearch(vintArr1, vintArr1.Length, 0);
            ValDriver.BinarySearch(vintArr1, vintArr1.Length - 1, 1);
            ValDriver.BinarySearch(vintArr1, vintArr1.Length - 2, 2);


            ValDriver.BinarySearchNegative(vintArr1, new ValX1_IC <int>[] { new ValX1_IC <int>(1) }, new int[] { -3 }, 2, vintArr1.Length - 2);
            ValDriver.BinarySearchNegative(vintArr1, new ValX1_IC <int>[] { new ValX1_IC <int>(99) }, new int[] { -98 }, 0, vintArr1.Length - 2);
            ValDriver.BinarySearchNegative(vintArr1, new ValX1_IC <int>[] { new ValX1_IC <int>(100) }, new int[] { -100 }, 0, vintArr1.Length);

            vintArr1[50] = new ValX1_IC <int>(49);
            ValDriver.BinarySearchNegative(vintArr1, new ValX1_IC <int>[] { new ValX1_IC <int>(50) }, new int[] { -52 }, 0, vintArr1.Length);
        }
Пример #2
0
        public static void BinarySearch_IComparerCount_ValueEven()
        {
            Driver <ValX1_IC <int> > ValDriver = new Driver <ValX1_IC <int> >();

            ValX1_IC <int>[] vintArr1 = new ValX1_IC <int> [100];
            for (int i = 0; i < 100; i++)
            {
                vintArr1[i] = new ValX1_IC <int>(i);
            }

            //even
            ValDriver.BinarySearch(vintArr1, 0, vintArr1.Length);
            ValDriver.BinarySearchNegative(vintArr1, new ValX1_IC <int>[] { new ValX1_IC <int>(100) }, new int[] { -101 }, 0, vintArr1.Length);

            vintArr1[50] = new ValX1_IC <int>(49);
            ValDriver.BinarySearchNegative(vintArr1, new ValX1_IC <int>[] { new ValX1_IC <int>(50) }, new int[] { -52 }, 0, vintArr1.Length);
        }
Пример #3
0
        public static void BinarySearch_IComparer_ValueOdd()
        {
            Driver <ValX1_IC <int> > ValDriver = new Driver <ValX1_IC <int> >();

            ValX1_IC <int>[] vintArr1 = new ValX1_IC <int> [99];
            for (int i = 0; i < 99; i++)
            {
                vintArr1[i] = new ValX1_IC <int>(i);
            }

            //odd
            ValDriver.BinarySearch(vintArr1);

            ValDriver.BinarySearch(new ValX1_IC <int>[] { });
            ValDriver.BinarySearch(new ValX1_IC <int>[] { new ValX1_IC <int>(1) });
            ValDriver.BinarySearch(new ValX1_IC <int>[] { new ValX1_IC <int>(1), new ValX1_IC <int>(2) });
            ValDriver.BinarySearch(new ValX1_IC <int>[] { new ValX1_IC <int>(1), new ValX1_IC <int>(2), new ValX1_IC <int>(3) });
        }
Пример #4
0
        public static void BinarySearch_IComparer_ValueEven()
        {
            Driver <ValX1_IC <int> > ValDriver = new Driver <ValX1_IC <int> >();

            ValX1_IC <int>[] vintArr1 = new ValX1_IC <int> [100];
            for (int i = 0; i < 100; i++)
            {
                vintArr1[i] = new ValX1_IC <int>(i);
            }
            ValX1_IC <int>[] vintArr2 = new ValX1_IC <int> [10];
            for (int i = 0; i < 10; i++)
            {
                vintArr2[i] = new ValX1_IC <int>(i + 100);
            }

            ValDriver.BinarySearchNegative(vintArr1, vintArr2);
            ValDriver.BinarySearchNegative(new ValX1_IC <int> [0], vintArr2);
        }
Пример #5
0
        public static void BinarySearch_IComparer_Negative()
        {
            Driver <ValX1_IC <int> > ValDriver = new Driver <ValX1_IC <int> >();

            ValX1_IC <int>[] vintArr1 = new ValX1_IC <int> [100];
            for (int i = 0; i < 100; i++)
            {
                vintArr1[i] = new ValX1_IC <int>(i);
            }
            ValDriver.BinarySearchValidations(vintArr1);

            Driver <RefX1_IC <int> > RefDriver = new Driver <RefX1_IC <int> >();

            RefX1_IC <int>[] intArr1 = new RefX1_IC <int> [100];
            for (int i = 0; i < 100; i++)
            {
                intArr1[i] = new RefX1_IC <int>(i);
            }
            RefDriver.BinarySearchValidations(intArr1);
        }