public void MixedAddDelete() { var tree = new DelayedIntervalTree <object>(); int i = 0; tree.Add(1, 2, ++i); Debug.Assert(tree.Contains(1)); tree.Remove(1, 2); Debug.Assert(!tree.Contains(1)); Debug.Assert(!tree.Contains(2)); tree.Add(1, 2, ++i); Debug.Assert(tree.Contains(1)); tree.Remove(1, 2); Debug.Assert(!tree.Contains(1)); tree.Add(1, 2, ++i); Debug.Assert(tree.Contains(1)); tree.Add(3, 4, ++i); Debug.Assert(tree.Contains(3)); tree.Remove(1, 2); Debug.Assert(!tree.Contains(1)); Debug.Assert(!tree.Contains(2)); tree.Remove(3, 4); Debug.Assert(!tree.Contains(3)); }
public void Delete() { var tree = new DelayedIntervalTree <object>(); for (int i = 0; i < 100; i++) { tree.Add(i * 2, i * 2 + 1, i); } for (int i = 0; i < 100; i += 2) { tree.Remove(i * 2, i * 2 + 1); Debug.Assert(!tree.Contains(i * 2)); } }