Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldStoreLongs()
        internal virtual void ShouldStoreLongs()
        {
            // GIVEN
            PrimitiveLongStack stack = new PrimitiveLongStack(5);
            long value1 = 10L * int.MaxValue;
            long value2 = 101L * int.MaxValue;

            stack.Push(value1);
            stack.Push(value2);

            // WHEN
            long firstPolledValue  = stack.Poll();
            long secondPolledValue = stack.Poll();

            // THEN
            assertEquals(value2, firstPolledValue);
            assertEquals(value1, secondPolledValue);
            assertTrue(stack.Empty);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldGrowArray()
        internal virtual void ShouldGrowArray()
        {
            // GIVEN
            PrimitiveLongStack stack = new PrimitiveLongStack(5);

            // WHEN
            for (int i = 0; i <= 7; i++)
            {
                stack.Push(i);
            }

            // THEN
            for (int i = 7; i >= 0; i--)
            {
                assertFalse(stack.Empty);
                assertEquals(i, stack.Poll());
            }
            assertTrue(stack.Empty);
            assertEquals(-1, stack.Poll());
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldIterate()
        internal virtual void ShouldIterate()
        {
            // GIVEN
            PrimitiveLongStack stack = new PrimitiveLongStack();

            // WHEN
            for (int i = 0; i < 7; i++)
            {
                stack.Push(i);
            }

            // THEN
            PrimitiveLongIterator iterator = stack.GetEnumerator();
            long i = 0;

            while (iterator.HasNext())
            {
                assertEquals(i++, iterator.Next());
            }
            assertEquals(7L, i);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldPushAndPollSomeEntities()
        internal virtual void ShouldPushAndPollSomeEntities()
        {
            // GIVEN
            PrimitiveLongStack stack = new PrimitiveLongStack(6);

            // WHEN/THEN
            assertTrue(stack.Empty);
            assertEquals(-1, stack.Poll());

            stack.Push(123);
            assertFalse(stack.Empty);

            stack.Push(456);
            assertFalse(stack.Empty);
            assertEquals(456, stack.Poll());

            assertFalse(stack.Empty);
            assertEquals(123, stack.Poll());

            assertTrue(stack.Empty);
            assertEquals(-1, stack.Poll());
        }