public void TestEmptyListOperations() { FVList <int> a = new FVList <int>(); FVList <int> b = new FVList <int>(); a.AddRange(b); a.InsertRange(0, b); a.RemoveRange(0, 0); Assert.That(!a.Remove(0)); Assert.That(a.IsEmpty); Assert.That(a.WithoutFirst(0).IsEmpty); a.Add(1); Assert.That(a.WithoutFirst(1).IsEmpty); b.AddRange(a); ExpectList(b, 1); b.RemoveAt(0); Assert.That(b.IsEmpty); b.InsertRange(0, a); ExpectList(b, 1); b.RemoveRange(0, 1); Assert.That(b.IsEmpty); b.Insert(0, a[0]); ExpectList(b, 1); b.Remove(a.First); Assert.That(b.IsEmpty); AssertThrows <InvalidOperationException>(delegate() { a.PreviousIn(b); }); }
public void TestInsertRemoveRange() { FVList <int> oneTwo = new FVList <int>(1, 2); FVList <int> threeFour = new FVList <int>(3, 4); FVList <int> list = oneTwo; FVList <int> list2 = threeFour; ExpectList(list, 1, 2); list.InsertRange(1, threeFour); ExpectList(list, 1, 3, 4, 2); list2.InsertRange(2, oneTwo); ExpectList(list2, 3, 4, 1, 2); list.RemoveRange(1, 2); ExpectList(list, 1, 2); list2.RemoveRange(2, 2); ExpectList(list2, 3, 4); list.RemoveRange(0, 2); ExpectList(list); list2.RemoveRange(1, 1); ExpectList(list2, 3); list = threeFour; list.AddRange(oneTwo); ExpectList(list, 1, 2, 3, 4); list.InsertRange(1, list); ExpectList(list, 1, 1, 2, 3, 4, 2, 3, 4); list.RemoveRange(1, 1); list.RemoveRange(4, 3); ExpectList(list, 1, 2, 3, 4); list.RemoveRange(0, 4); ExpectList(list); list2.InsertRange(0, list); list2.InsertRange(1, list); ExpectList(list2, 3); }