public void GaloopingSearch_Array_Contains_2_Elemnts_and_Target_is_NOT_in_on_the_left() { int[] array = new int[] { 0, 8 }; BinarySearch bSObj = new BinarySearch(array); int target = -2; bool expectedResult = false; bool result = SortLevel.GallopingSearch(array, target); Assert.AreEqual(expectedResult, result); }
public void GaloopingSearch_Array_Contains_1_Elemnts_and_Target_is_The_Same() { int[] array = new int[] { 19 }; BinarySearch bSObj = new BinarySearch(array); int target = 19; bool expectedResult = true; bool result = SortLevel.GallopingSearch(array, target); Assert.AreEqual(expectedResult, result); }
public void GaloopingSearch_Array_Contains_3_Elemnts_and_Target_is_on_the_right() { int[] array = new int[] { 0, 4, 8 }; BinarySearch bSObj = new BinarySearch(array); int target = 8; bool expectedResult = true; bool result = SortLevel.GallopingSearch(array, target); Assert.AreEqual(expectedResult, result); }
public void GaloopingSearch_Array_Contains_10_Elemnts_and_Target_is_NOT_in_array_on_the_rigth() { int[] array = new int[] { 0, 2, 4, 8, 10, 12, 14, 16, 18, 20 }; BinarySearch bSObj = new BinarySearch(array); int target = 25; bool expectedResult = false; bool result = SortLevel.GallopingSearch(array, target); Assert.AreEqual(expectedResult, result); }
public void GaloopingSearch_Array_is_Null() { int[] array = null; BinarySearch bSObj = new BinarySearch(array); Assert.Fail("Должно быть брошено исключение ArgumentException"); int target = 0; bool expectedResult = false; bool result = SortLevel.GallopingSearch(array, target); Assert.AreEqual(expectedResult, result); }
public void TestGallopingSearch_17() { int[] array = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; Assert.IsTrue(SortLevel.GallopingSearch(array, 1)); Assert.IsTrue(SortLevel.GallopingSearch(array, 2)); Assert.IsTrue(SortLevel.GallopingSearch(array, 3)); Assert.IsTrue(SortLevel.GallopingSearch(array, 4)); Assert.IsTrue(SortLevel.GallopingSearch(array, 5)); Assert.IsTrue(SortLevel.GallopingSearch(array, 6)); Assert.IsTrue(SortLevel.GallopingSearch(array, 7)); Assert.IsTrue(SortLevel.GallopingSearch(array, 8)); Assert.IsTrue(!SortLevel.GallopingSearch(array, 0)); Assert.IsTrue(!SortLevel.GallopingSearch(array, 9)); }
public void TestGallopingSearch_8() { int[] array = new int[] { 1, 2, 3, 4, 5 }; Assert.IsTrue(SortLevel.GallopingSearch(array, 1)); }
public void TestGallopingSearch_14() { int[] array = new int[] { 1, 2, 3, 4 }; Assert.IsTrue(!SortLevel.GallopingSearch(array, 5)); }