public void CouldRemoveFirstAddInTheMiddle() { var sd = new SortedDeque <int>(); sd.Add(1); sd.Add(3); sd.Add(5); sd.Add(7); Assert.AreEqual(sd.First, 1); Assert.AreEqual(sd.Last, 7); var fst = sd.RemoveFirst(); Assert.AreEqual(sd.First, 3); sd.Add(4); Assert.AreEqual(1, sd.ToList().IndexOf(4)); Assert.AreEqual(2, sd.ToList().IndexOf(5)); Assert.AreEqual(3, sd.ToList().IndexOf(7)); var last = sd.RemoveLast(); sd.Add(8); Assert.AreEqual(1, sd.ToList().IndexOf(4)); Assert.AreEqual(2, sd.ToList().IndexOf(5)); Assert.AreEqual(3, sd.ToList().IndexOf(8)); sd.Add(6); Assert.AreEqual(1, sd.ToList().IndexOf(4)); Assert.AreEqual(2, sd.ToList().IndexOf(5)); Assert.AreEqual(3, sd.ToList().IndexOf(6)); Assert.AreEqual(4, sd.ToList().IndexOf(8)); }
public void CouldAddBeyondInitialCapacity() { var sd = new SortedDeque <int>(); for (int i = 0; i < 4; i++) { sd.Add(i); } for (int i = 0; i < 4; i++) { Assert.AreEqual(i, sd.ToList().IndexOf(i)); } }