public void TestOrderPushBackPopFront() { var d = new Deq <int>(); d.PushBack(1); d.PushBack(2); d.PushBack(3); d.PushBack(4); Assert.AreEqual(1, d.PopFront()); Assert.AreEqual(2, d.PopFront()); Assert.AreEqual(3, d.PopFront()); Assert.AreEqual(4, d.PopFront()); }
public void TestTwoItems() { const int val1 = 100500; const int val2 = 100600; var d = new Deq <int>(); d.PushBack(val1); d.PushBack(val2); d = Sorter.Sort2(d); Assert.IsFalse(d.Empty); Assert.AreEqual(2, d.Count); Assert.AreEqual(val1, d.PopFront()); Assert.AreEqual(val2, d.PopFront()); }
public void TestPushBackPopFrontOne() { const int val = 100503; var d = new Deq <int>(); d.PushBack(val); Assert.AreEqual(val, d.PopFront()); Assert.IsTrue(d.Empty); Assert.AreEqual(0, d.Count); }
public void TestSetDeqElementByPosition() { var d = new Deq <int>(); d.PushFront(1); d.SetDeqElementByPosition(0, 2); Assert.IsFalse(d.Empty); Assert.AreEqual(1, d.Count); Assert.AreEqual(2, d.GetDeqElementByPosition(0)); Assert.AreEqual(2, d.PopFront()); }
public void TestSortMoreItems() { int[] data = new[] {100500, 100600, 1, 1999, 200500, 1000, 100, 5}; var d = new Deq<int>(); foreach (var v in data) { d.PushBack(v); } d = Sorter.Sort2(d); Assert.IsFalse(d.Empty); Assert.AreEqual(data.Length, d.Count); Array.Sort(data); foreach (var v in data) { Assert.AreEqual(v, d.PopFront()); } }
public void TestSortSortedMoreItems() { int[] data = new[] { 100500, 100600, 1, 1999, 200500, 1000, 100, 5 }; Array.Sort(data); var d = new Deq <int>(); foreach (var v in data) { d.PushBack(v); } d = Sorter.Sort2(d); Assert.IsFalse(d.Empty); Assert.AreEqual(data.Length, d.Count); foreach (var v in data) { Assert.AreEqual(v, d.PopFront()); } }
public void TestThreeItems() { const int val1 = 100500; const int val2 = 100600; const int val3 = 100700; var d = new Deq<int>(); d.PushBack(val2); d.PushBack(val3); d.PushBack(val1); d = Sorter.Sort2(d); Assert.IsFalse(d.Empty); Assert.AreEqual(3, d.Count); Assert.AreEqual(val1, d.PopFront()); Assert.AreEqual(val2, d.PopFront()); Assert.AreEqual(val3, d.PopFront()); }
public void TestEmptyPopFront() { var d = new Deq <int>(); d.PopFront(); }
public void TestEmptyPopFront() { var d = new Deq<int>(); d.PopFront(); }
public void TestSetDeqElementByPosition() { var d = new Deq<int>(); d.PushFront(1); d.SetDeqElementByPosition(0, 2); Assert.IsFalse(d.Empty); Assert.AreEqual(1, d.Count); Assert.AreEqual(2, d.GetDeqElementByPosition(0)); Assert.AreEqual(2, d.PopFront()); }
public void TestPushBackPopFrontOne() { const int val = 100503; var d = new Deq<int>(); d.PushBack(val); Assert.AreEqual(val, d.PopFront()); Assert.IsTrue(d.Empty); Assert.AreEqual(0, d.Count); }
public void TestOrderPushFrontPopFront() { var d = new Deq<int>(); d.PushFront(1); d.PushFront(2); d.PushFront(3); d.PushFront(4); Assert.AreEqual(4, d.PopFront()); Assert.AreEqual(3, d.PopFront()); Assert.AreEqual(2, d.PopFront()); Assert.AreEqual(1, d.PopFront()); }