public void TestIsEmpty() { ShortList list1 = new ShortList(); ShortList list2 = new ShortList(1000); ShortList list3 = new ShortList(list1); Assert.IsTrue(list1.IsEmpty()); Assert.IsTrue(list2.IsEmpty()); Assert.IsTrue(list3.IsEmpty()); list1.Add((short)1); list2.Add((short)2); list3 = new ShortList(list2); Assert.IsTrue(!list1.IsEmpty()); Assert.IsTrue(!list2.IsEmpty()); Assert.IsTrue(!list3.IsEmpty()); list1.Clear(); list2.Remove(0); list3.RemoveValue((short)2); Assert.IsTrue(list1.IsEmpty()); Assert.IsTrue(list2.IsEmpty()); Assert.IsTrue(list3.IsEmpty()); }
public void TestClear() { ShortList list = new ShortList(); for (short j = 0; j < 500; j++) { list.Add(j); } Assert.AreEqual(500, list.Count); list.Clear(); Assert.AreEqual(0, list.Count); for (short j = 0; j < 500; j++) { list.Add((short)(j + 1)); } Assert.AreEqual(500, list.Count); for (short j = 0; j < 500; j++) { Assert.AreEqual(j + 1, list.Get(j)); } }