コード例 #1
0
        public void testIntArray()
        {
            DynamicIntArray dia = new DynamicIntArray(10);

            for (int i = 0; i < 10000; ++i)
            {
                dia.add(2 * i);
            }
            Assert.Equal(10000, dia.size());
            for (int i = 0; i < 10000; ++i)
            {
                Assert.Equal(2 * i, dia.get(i));
            }
            dia.clear();
            Assert.Equal(0, dia.size());
            dia.add(3);
            dia.add(12);
            dia.add(65);
            Assert.Equal("{3,12,65}", dia.ToString());
            for (int i = 0; i < 5; ++i)
            {
                dia.increment(i, 3);
            }
            Assert.Equal("{6,15,68,3,3}", dia.ToString());
        }
コード例 #2
0
 /**
  * Reset the table to empty.
  */
 public virtual void clear()
 {
     root = NULL;
     size = 0;
     data.clear();
 }