Exemple #1
0
        public void TestEnumerateFrom()
        {
            BTreeDictionary <int, string> data = new BTreeDictionary <int, string>(Comparer);

            for (int i = 0; i < 100; i++)
            {
                Assert.IsTrue(data.TryAdd(i, i.ToString()));
            }

            Assert.AreEqual(50, new List <KeyValuePair <int, string> >(data.EnumerateFrom(50)).Count);
            Assert.AreEqual(25, new List <KeyValuePair <int, string> >(data.EnumerateFrom(75)).Count);

            for (int i = 0; i < 100; i++)
            {
                int first = -1;
                foreach (KeyValuePair <int, string> kv in data.EnumerateFrom(i))
                {
                    first = kv.Key;
                    break;
                }
                Assert.AreEqual(i, first);
            }
        }