Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void addingElementsChangeSize()
        internal virtual void AddingElementsChangeSize()
        {
            PrimitiveLongList longList = new PrimitiveLongList();

            longList.Add(1L);

            assertFalse(longList.Empty);
            assertEquals(1, longList.Size());

            longList.Add(2L);
            assertFalse(longList.Empty);
            assertEquals(2, longList.Size());

            longList.Add(3L);

            assertFalse(longList.Empty);
            assertEquals(3, longList.Size());
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void addAfterClear()
        internal virtual void AddAfterClear()
        {
            PrimitiveLongList longList = new PrimitiveLongList();

            longList.Clear();

            longList.Add(1);
            assertEquals(1, longList.Get(0));
            assertEquals(1, longList.Size());
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void accessAddedElements()
        internal virtual void AccessAddedElements()
        {
            PrimitiveLongList longList = new PrimitiveLongList();

            for (long i = 1; i < 6L; i++)
            {
                longList.Add(i);
            }

            assertEquals(5L, longList.Get(4));
            assertEquals(1L, longList.Get(0));
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void holdLotsOfElements()
        internal virtual void HoldLotsOfElements()
        {
            PrimitiveLongList longList = new PrimitiveLongList();
            long size = 13077L;

            for (long i = 0; i < size; i++)
            {
                longList.Add(i);
            }

            assertEquals(size, longList.Size());
            for (int i = 0; i < size; i++)
            {
                assertEquals(i, longList.Get(i));
            }
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void clearResetListSize()
        internal virtual void ClearResetListSize()
        {
            PrimitiveLongList longList = new PrimitiveLongList();
            long size = 10;

            for (long i = 0; i < 10L; i++)
            {
                longList.Add(i);
            }
            assertEquals(size, longList.Size());

            longList.Clear();

            assertEquals(0, longList.Size());
            assertTrue(longList.Empty);
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void transformListToArray()
        internal virtual void TransformListToArray()
        {
            PrimitiveLongList longList = new PrimitiveLongList();
            long size = 24L;

            for (long i = 0; i < size; i++)
            {
                longList.Add(i);
            }

            long[] longs = longList.ToArray();
            assertEquals(size, longs.Length);
            for (int i = 0; i < longs.Length; i++)
            {
                assertEquals(i, longs[i]);
            }
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void iterateOverListElements()
        internal virtual void IterateOverListElements()
        {
            PrimitiveLongList longList = new PrimitiveLongList();

            for (long i = 0; i < 10L; i++)
            {
                longList.Add(i);
            }

            int  iteratorElements          = 0;
            long value                     = 0;
            PrimitiveLongIterator iterator = longList.GetEnumerator();

            while (iterator.HasNext())
            {
                iteratorElements++;
                assertEquals(value++, iterator.Next());
            }

            assertEquals(iteratorElements, longList.Size());
        }