Beispiel #1
0
        public void Test_PeekFirst()
        {
            MyDeque <int> deq = new MyDeque <int>();

            deq.EnqueueLast(1);
            deq.EnqueueLast(2);
            deq.EnqueueLast(3);
            deq.EnqueueLast(4);
            Assert.AreEqual(deq.PeekFirst(), 1);
        }
Beispiel #2
0
        public void Test_EndqueueFirst()
        {
            MyDeque <string> deq = new MyDeque <string>();

            deq.EnqueueFirst("Первый");
            deq.EnqueueFirst("Второй");
            deq.EnqueueFirst("Третий");
            Assert.AreEqual(deq.Count, 3);
            Assert.AreNotEqual(deq.PeekFirst(), deq.PeekLast());
        }
Beispiel #3
0
        public void Test_EnqueueLast()
        {
            MyDeque <int> deq = new MyDeque <int>();

            deq.EnqueueLast(1);
            deq.EnqueueLast(2);
            deq.EnqueueLast(3);
            deq.EnqueueLast(4);
            Assert.AreEqual(deq.Count, 4);
            Assert.AreNotEqual(deq.PeekFirst(), deq.PeekLast());
        }
Beispiel #4
0
        public void Test_DequeueFirst()
        {
            MyDeque <int> deq = new MyDeque <int>();

            deq.EnqueueLast(1);
            deq.EnqueueLast(2);
            deq.EnqueueLast(3);
            deq.EnqueueLast(4);
            int expected = deq.PeekFirst();
            int count1   = deq.Count;
            int actual   = deq.DequeueFirst();
            int count2   = deq.Count;

            Assert.AreEqual(actual, expected);
            Assert.AreNotEqual(count1, count2);
        }