Esempio n. 1
0
 @Test
 public void testVectorAddElements() {
   LNGVector<String> v1 = new LNGVector<>();
   Assert.assertTrue(v1.empty());
   for (int i = 0; i < 1000; i++) {
     v1.push("s" + i);
     Assert.assertEquals(i + 1, v1.size());
     Assert.assertEquals("s" + i, v1.back());
     Assert.assertEquals("s" + i, v1.get(i));
   }
   Assert.assertFalse(v1.empty());
   v1.clear();
   Assert.assertTrue(v1.empty());
 }
Esempio n. 2
0
 @Test
 public void legalUnsafePush() {
   LNGVector<String> v1 = new LNGVector<>(1000);
   Assert.assertTrue(v1.empty());
   for (int i = 0; i < 1000; i++) {
     v1.unsafePush("s" + i);
     Assert.assertEquals(i + 1, v1.size());
     Assert.assertEquals("s" + i, v1.back());
     Assert.assertEquals("s" + i, v1.get(i));
   }
   Assert.assertFalse(v1.empty());
   v1.clear();
   Assert.assertTrue(v1.empty());
 }