public void SplayTreeCopyToNotEnoughSpace() { var tree = new SplayTree <int, int> { { 1, 2 }, { 2, 3 } }; tree.CopyTo(new KeyValuePair <int, int> [1], 0); }
public void SplayTreeCopyTo() { var values = new string[] { "a", "b", "c", "d" }; var tree = new SplayTree <int, string>(); for (int i = 0; i < values.Length; i++) { tree.Add(i + 1, values[i]); } var array = new KeyValuePair <int, string> [5]; tree.CopyTo(array, 1); for (int i = 0; i < values.Length; i++) { Assert.AreEqual(array[i + 1].Key, i + 1); Assert.AreEqual(array[i + 1].Value, values[i]); } }