public void RemovingElementInTheMiddleWhileSplitSecond() { var rb = new RingBuffer <int>(4) { 1, 2, 3, 4 }; rb.RemoveFront(); rb.RemoveFront(); rb.AddBack(5); rb.AddBack(6); rb.RemoveAt(2); Assert.Equal(3, rb.Count); Assert.Equal(3, rb[0]); Assert.Equal(4, rb[1]); Assert.Equal(6, rb[2]); }
public void AddingElementToBack() { var rb = new RingBuffer <int>(); rb.AddBack(1); Assert.Single(rb); Assert.Equal(0, rb.Head); Assert.Equal(1, rb.Tail); Assert.Equal(1, rb[0]); }
public void InsertingElementInTheMiddleWhileSplitSecond() { var rb = new RingBuffer <int>(5) { 1, 2, 3, 4 }; rb.RemoveFront(); rb.RemoveFront(); rb.AddBack(5); rb.AddBack(6); rb.Insert(3, 7); Assert.Equal(5, rb.Count); Assert.Equal(3, rb[0]); Assert.Equal(4, rb[1]); Assert.Equal(5, rb[2]); Assert.Equal(7, rb[3]); Assert.Equal(6, rb[4]); }
public void AddingElementToFrontAndBack() { var rb = new RingBuffer <int>(); rb.AddFront(2); rb.AddBack(1); Assert.Equal(2, rb.Count); Assert.Equal(rb.Capacity - 1, rb.Head); Assert.Equal(1, rb.Tail); Assert.Equal(2, rb[0]); Assert.Equal(1, rb[1]); }