public void StupidSearchTest() { SearchAlgorithm algorithm = new SearchAlgorithm(); int[] numbers = new SimpleData().GetOrderedArray(1000); int number = 333; int index = algorithm.BinarySearch(numbers, number); Assert.AreEqual(333, index); }
public int BinarySearch_Test(int[] arr, int x) { var res = SearchAlgorithm.BinarySearch(arr, 0, arr.Length - 1, x, new IntComparer()); return(res); }
public void BinarySearchArgumentExceptionTests(int start, int end) => Assert.Throws <ArgumentException>(() => SearchAlgorithm.BinarySearch(new[] { 10, 15, 20 }, start, end, 1));
public void BinarySearchArgumentNullExceptionTests() => Assert.Throws <ArgumentNullException>(() => SearchAlgorithm.BinarySearch(null, 1));
public int BinarySearchTestsWithComparer(CustomClass[] array, CustomClass value) => SearchAlgorithm.BinarySearch(array, value, new CustomClassComparer());
public int BinarySearchTests(CustomStructure[] array, CustomStructure value) => SearchAlgorithm.BinarySearch(array, value);
public int BinarySearchTests(CustomClass[] array, CustomClass value) => SearchAlgorithm.BinarySearch(array, value);
public int BinarySearchTests(string[] array, string value) => SearchAlgorithm.BinarySearch(array, value);
public int BinarySearchTests(char[] array, char value) => SearchAlgorithm.BinarySearch(array, value);
public int BinarySearchTests(double[] array, double value) => SearchAlgorithm.BinarySearch(array, value);
public int BinarySearchTests(int[] array, int value) => SearchAlgorithm.BinarySearch(array, value);