public void OnelElement_BinaryGenericSearchTest() { var arr = new double[] { 10 }; var result = BinaryGenericSearch.Exec(arr.ToList(), 10); Assert.AreEqual(0, result); }
public void NormUseInt_BinaryGenericSearchTest() { var arr = new int[] { 5, 8, 13, 17, 336 }; var result = BinaryGenericSearch.Exec(arr.ToList(), 13); Assert.AreEqual(2, result); }
public void NormUseDouble_BinaryGenericSearchTest() { var arr = new double[] { -5, 6, 7, 9, 15 }; var result = BinaryGenericSearch.Exec(arr.ToList(), 9); Assert.AreEqual(3, result); }
public void RepeatElements_BinaryGenericSearchTest() { var arr = new double[] { 10, 55, 88, 99, 99, 115, 158 }; var result = BinaryGenericSearch.Exec(arr.ToList(), 99); Assert.AreEqual(3, result); }
public void NotExisting_BinaryGenericSearchTest() { var arr = new string[] { "a", "b", "c", "d" }; var result = BinaryGenericSearch.Exec(arr.ToList(), "e"); Assert.AreEqual(-1, result); }
public void StringValue_BinaryGenericSearchTest() { //arrange var arr = new string[] { "cat", "dog", "bird", "seal" }; //act var result = BinaryGenericSearch.Exec(arr.ToList(), "seal"); //assert Assert.AreEqual(3, result); }
public void Boundary_BinaryGenericSearchTest(int searchItem, int expectedResult) { //arrange var arr = new int[] { 2, 3, 7, 9 }; //act var result = BinaryGenericSearch.Exec(arr.ToList(), searchItem); //assert Assert.AreEqual(expectedResult, result); }
public void Empty_BinaryGenericSearchTest() { var arr = new int[] { }; Assert.ThrowsException <ArgumentOutOfRangeException>(() => BinaryGenericSearch.Exec(arr.ToList(), 1)); }
public void Null_BinaryGenericSearchTest() { int[] arr = null; Assert.ThrowsException <ArgumentNullException>(() => BinaryGenericSearch.Exec(arr.ToList(), 1)); }