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()); }
public void RemoveTest_LastItem() { DynamicIntArray array = CreateArray(10); array.Remove(9); string result = " 0 1 2 3 4 5 6 7 8"; Assert.AreEqual(result, array.ToString()); }
public void RemoveTest() { DynamicIntArray array = CreateArray(11); array.Remove(5); array.Remove(0); string result = " 1 2 3 4 6 7 8 9 10"; Assert.AreEqual(result, array.ToString()); }
public void AddTest() { DynamicIntArray array = CreateArray(11); array.Add(32); array.Add(42); string result = " 0 1 2 3 4 5 6 7 8 9 10 32 42"; Assert.AreEqual(result, array.ToString()); }
public void InsertTest() { DynamicIntArray array = CreateArray(11); array.Insert(8, 223); array.Insert(100, 654); string result = " 0 1 2 3 4 5 6 7 223 8 9 10 654"; Assert.AreEqual(result, array.ToString()); }