Ejemplo n.º 1
0
        public static void BinarySearch_IComparerCount_RefOdd()
        {
            Driver <RefX1_IC <int> > RefDriver = new Driver <RefX1_IC <int> >();

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

            //odd
            RefDriver.BinarySearch(intArr1, 0, intArr1.Length);
            RefDriver.BinarySearch(intArr1, 1, intArr1.Length - 1);
            RefDriver.BinarySearch(intArr1, 25, intArr1.Length - 25);
            RefDriver.BinarySearch(intArr1, intArr1.Length, 0);
            RefDriver.BinarySearch(intArr1, intArr1.Length - 1, 1);
            RefDriver.BinarySearch(intArr1, intArr1.Length - 2, 2);


            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { null }, new int[] { -1 }, 0, intArr1.Length);
            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { new RefX1_IC <int>(1) }, new int[] { -3 }, 2, intArr1.Length - 2);
            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { new RefX1_IC <int>(99) }, new int[] { -98 }, 0, intArr1.Length - 2);
            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { new RefX1_IC <int>(100) }, new int[] { -100 }, 0, intArr1.Length);

            intArr1[50] = new RefX1_IC <int>(49);
            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { new RefX1_IC <int>(50) }, new int[] { -52 }, 0, intArr1.Length);
        }
Ejemplo n.º 2
0
        public static void BinarySearch_IComparerCount_Negative()
        {
            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.BinarySearchValidations2(intArr1);
        }
Ejemplo n.º 3
0
        public static void BinarySearch_IComparer_RefOdd()
        {
            Driver <RefX1_IC <int> > RefDriver = new Driver <RefX1_IC <int> >();

            RefX1_IC <int>[] intArr1 = new RefX1_IC <int> [99];
            for (int i = 0; i < 99; i++)
            {
                intArr1[i] = new RefX1_IC <int>(i);
            }
            //odd

            RefDriver.BinarySearch(intArr1);

            RefDriver.BinarySearch(new RefX1_IC <int>[] { });
            RefDriver.BinarySearch(new RefX1_IC <int>[] { new RefX1_IC <int>(1) });
            RefDriver.BinarySearch(new RefX1_IC <int>[] { new RefX1_IC <int>(1), new RefX1_IC <int>(2) });
            RefDriver.BinarySearch(new RefX1_IC <int>[] { new RefX1_IC <int>(1), new RefX1_IC <int>(2), new RefX1_IC <int>(3) });
        }
Ejemplo n.º 4
0
        public static void BinarySearch_IComparerCount_RefEven()
        {
            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);
            }

            //even
            RefDriver.BinarySearch(intArr1, 0, intArr1.Length);

            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { null }, new int[] { -1 }, 0, intArr1.Length);
            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { new RefX1_IC <int>(100) }, new int[] { -101 }, 0, intArr1.Length);

            intArr1[50] = new RefX1_IC <int>(49);
            RefDriver.BinarySearchNegative(intArr1, new RefX1_IC <int>[] { new RefX1_IC <int>(50) }, new int[] { -52 }, 0, intArr1.Length);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
        public static void BinarySearch_IComparer_RefEven()
        {
            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);
            }

            RefX1_IC <int>[] intArr2 = new RefX1_IC <int> [10];
            for (int i = 0; i < 10; i++)
            {
                intArr2[i] = new RefX1_IC <int>(i + 100);
            }

            //even
            RefDriver.BinarySearch(intArr1);

            RefDriver.BinarySearchNegative(intArr1, intArr2);
            RefDriver.BinarySearchNegative(new RefX1_IC <int> [0], intArr2);
        }