예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void tailBeforeHeadCorrectIteration()
        internal virtual void TailBeforeHeadCorrectIteration()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            for (int i = 0; i < 14; i++)
            {
                queue.Enqueue(i);
            }
            for (int i = 0; i < 10; i++)
            {
                assertEquals(i, queue.Dequeue());
            }
            for (int i = 14; i < 24; i++)
            {
                queue.Enqueue(i);
            }

            assertEquals(14, queue.Size());
            PrimitiveLongIterator iterator = queue.GetEnumerator();

            for (int j = 10; j < 24; j++)
            {
                assertTrue(iterator.HasNext());
                assertEquals(j, iterator.Next());
            }
            assertFalse(iterator.HasNext());
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void offerLessThenQueueCapacityElements()
        internal virtual void OfferLessThenQueueCapacityElements()
        {
            PrimitiveLongArrayQueue arrayQueue = CreateQueue();

            for (int i = 1; i < 16; i++)
            {
                arrayQueue.Enqueue(i);
                assertEquals(i, arrayQueue.Size());
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void growQueueOnElementOffer()
        internal virtual void GrowQueueOnElementOffer()
        {
            PrimitiveLongArrayQueue longArrayQueue = CreateQueue();

            for (int i = 1; i < 1000; i++)
            {
                longArrayQueue.Enqueue(i);
                assertEquals(i, longArrayQueue.Size());
            }
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void emptyQueueAfterClear()
        internal virtual void EmptyQueueAfterClear()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            queue.Enqueue(2);
            queue.Enqueue(3);
            assertFalse(queue.Empty);
            assertEquals(2, queue.Size());

            queue.Clear();

            assertTrue(queue.Empty);
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void tailBeforeHeadCorrectSize()
        internal virtual void TailBeforeHeadCorrectSize()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            for (int i = 0; i < 14; i++)
            {
                queue.Enqueue(i);
            }
            for (int i = 0; i < 10; i++)
            {
                assertEquals(i, queue.Dequeue());
            }
            for (int i = 14; i < 24; i++)
            {
                queue.Enqueue(i);
            }

            assertEquals(14, queue.Size());
        }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void addAllElementsFromOtherQueue()
        internal virtual void AddAllElementsFromOtherQueue()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            queue.Enqueue(1);
            queue.Enqueue(2);
            PrimitiveLongArrayQueue otherQueue = CreateQueue();

            otherQueue.Enqueue(3);
            otherQueue.Enqueue(4);
            queue.AddAll(otherQueue);

            assertTrue(otherQueue.Empty);
            assertEquals(0, otherQueue.Size());
            assertEquals(4, queue.Size());
            for (int value = 1; value <= 4; value++)
            {
                assertEquals(value, queue.Dequeue());
            }
            assertTrue(queue.Empty);
        }