public void ShouldGetMaxElement() { var array = new HighArray(2); array.Insert(1); array.Insert(2); var max = array.GetMax(); Assert.AreEqual(max, 2); }
public void ShouldInsertAndFindElement() { var array = new HighArray(5); array.Insert(1); var index = array.Find(1); Assert.AreEqual(index, 0); array.Insert(2); index = array.Find(2); Assert.AreEqual(index, 1); var elem = array.Get(index); Assert.AreEqual(elem, 2); }
public void ShouldMakeSortedArray() { var fArray = new HighArray(3); fArray.Insert(2); fArray.Insert(3); fArray.Insert(1); var sArray = new HighArray(3); for (var i = 0; i < fArray.Length; i++) { sArray.Insert(fArray.RemoveMax()); } var sArrayFirstElem = sArray.Get(0); Assert.AreEqual(sArrayFirstElem, 3); }
public void ShouldDeleteElement() { var array = new HighArray(1); array.Insert(1); var index = array.Find(1); Assert.AreEqual(index, 0); array.Delete(1); Assert.Catch(() => array.Find(1), "Element not found"); }