public void LargeArrayFound() { Assert.AreEqual(SearchInSortedRotatedArray.Search( GenerateRotatedSortedArray(length: 100, rotation: 13), val: 99), (99 + 13) % 100); Assert.AreEqual(SearchInSortedRotatedArray.Search( GenerateRotatedSortedArray(length: 100, rotation: 13), val: 54), (54 + 13) % 100); Assert.AreEqual(SearchInSortedRotatedArray.Search( GenerateRotatedSortedArray(length: 101, rotation: 13), val: 99), (99 + 13) % 101); Assert.AreEqual(SearchInSortedRotatedArray.Search( GenerateRotatedSortedArray(length: 100, rotation: 13), val: 54), (54 + 13) % 101); }
public void LargeArrayNotFound() { Assert.AreEqual( SearchInSortedRotatedArray.Search(GenerateRotatedSortedArray(length: 100, rotation: 13), val: 107), -1); }
public void TwoItemArrayFound() { Assert.AreEqual(SearchInSortedRotatedArray.Search(GenerateRotatedSortedArray(length: 2, rotation: 1), val: 0), 1); Assert.AreEqual(SearchInSortedRotatedArray.Search(GenerateRotatedSortedArray(length: 2, rotation: 1), val: 1), 0); }
public void SingletonArrayFound() { Assert.AreEqual(SearchInSortedRotatedArray.Search(GenerateRotatedSortedArray(length: 1, rotation: 2), val: 0), 0); }
public void SingletonArrayNotFound() { Assert.AreEqual(SearchInSortedRotatedArray.Search(GenerateRotatedSortedArray(length: 1, rotation: 1), val: 99), -1); }
public void EmptyArray() { Assert.AreEqual(SearchInSortedRotatedArray.Search( GenerateRotatedSortedArray(length: 0, rotation: 0), val: 1), -1); }
public void NullArray() { Assert.AreEqual(SearchInSortedRotatedArray.Search(null, 1), -1); }