public void WeissTest()
        {
            dictionary = new SplayDictionary <int, string>();
            const int NUMS = 40000;
            const int GAP  = 307;

            for (int i = GAP; i != 0; i = (i + GAP) % NUMS)
            {
                dictionary.Add(i, i.ToString());
            }

            for (int i = 1; i < NUMS; i += 2)
            {
                dictionary.Remove(i);
            }

            Assert.AreEqual(new KeyValuePair <int, string>(2, "2"), dictionary.Minimum);
            Assert.AreEqual(new KeyValuePair <int, string>(NUMS - 2, (NUMS - 2).ToString()), dictionary.Maximum);

            for (int i = 2; i < NUMS; i += 2)
            {
                Assert.IsTrue(dictionary.ContainsKey(i));
            }

            for (int i = 1; i < NUMS; i += 2)
            {
                Assert.IsFalse(dictionary.ContainsKey(i));
            }
        }
 public void CountTest()
 {
     dictionary = new SplayDictionary <int, string>();
     dictionary.Add(5, "five");
     Assert.AreEqual(1, dictionary.Count);
     dictionary.Add(3, "three");
     Assert.AreEqual(2, dictionary.Count);
     dictionary.Remove(5);
     Assert.AreEqual(1, dictionary.Count);
     dictionary.Add(7, "seven");
     Assert.AreEqual(2, dictionary.Count);
     dictionary.Add(9, "nine");
     Assert.AreEqual(3, dictionary.Count);
     dictionary.Add(5, "five");
     Assert.AreEqual(4, dictionary.Count);
     dictionary.Remove(7);
     Assert.AreEqual(3, dictionary.Count);
 }
        public void RemoveFailTest()
        {
            var array = new[] { new KeyValuePair <int, string>(77, "seventy-seven"),
                                new KeyValuePair <int, string>(85, "eighty-five"),
                                new KeyValuePair <int, string>(66, "sixty-six"),
                                new KeyValuePair <int, string>(56, "fifty-six"),
                                new KeyValuePair <int, string>(74, "seventy-four"),
                                new KeyValuePair <int, string>(94, "ninety-four"),
                                new KeyValuePair <int, string>(27, "twenty-seven"),
                                new KeyValuePair <int, string>(61, "sixty-one"),
                                new KeyValuePair <int, string>(48, "forty-eight"),
                                new KeyValuePair <int, string>(27, "fifty-seven") };

            dictionary = new SplayDictionary <int, string>(array);
            Assert.IsFalse(dictionary.Remove(34));
        }