public virtual void TestFastIterator() { BlockList <int> list = new BlockList <int>(4); int cnt = BlockList <int> .BLOCK_SIZE * 3; for (int i = 0; i < cnt; i++) { list.AddItem(Sharpen.Extensions.ValueOf(42 + i)); } NUnit.Framework.Assert.AreEqual(cnt, list.Count); Iterator <int> itr = list.Iterator(); for (int i_1 = 0; i_1 < cnt; i_1++) { NUnit.Framework.Assert.IsTrue(itr.HasNext()); NUnit.Framework.Assert.AreEqual(Sharpen.Extensions.ValueOf(42 + i_1), itr.Next()); } NUnit.Framework.Assert.IsFalse(itr.HasNext()); }
public virtual void TestEmptyList() { BlockList <string> empty; empty = new BlockList <string>(); NUnit.Framework.Assert.AreEqual(0, empty.Count); NUnit.Framework.Assert.IsTrue(empty.IsEmpty()); NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext()); empty = new BlockList <string>(0); NUnit.Framework.Assert.AreEqual(0, empty.Count); NUnit.Framework.Assert.IsTrue(empty.IsEmpty()); NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext()); empty = new BlockList <string>(1); NUnit.Framework.Assert.AreEqual(0, empty.Count); NUnit.Framework.Assert.IsTrue(empty.IsEmpty()); NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext()); empty = new BlockList <string>(64); NUnit.Framework.Assert.AreEqual(0, empty.Count); NUnit.Framework.Assert.IsTrue(empty.IsEmpty()); NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext()); }