Пример #1
0
        public void DefaultCtorReturnsEmptyMap()
        {
            PersistentTreeMap m = new PersistentTreeMap();

            Expect(m.count(), EqualTo(0));
            Expect(m.meta(), Null);
        }
Пример #2
0
        public void DoBigTest(int numEntries)
        {
            System.Console.WriteLine("Testing {0} items.", numEntries);

            Random rnd = new Random();
            Dictionary <int, int> dict = new Dictionary <int, int>(numEntries);

            for (int i = 0; i < numEntries; i++)
            {
                int r = rnd.Next();
                dict[r] = r;
            }
            PersistentTreeMap m = (PersistentTreeMap)PersistentTreeMap.create(dict);

            Expect(m.count(), EqualTo(dict.Count));

            foreach (int key in dict.Keys)
            {
                Expect(m.containsKey(key));
                Expect(m.valAt(key), EqualTo(key));
            }

            for (ISeq s = m.seq(); s != null; s = s.next())
            {
                Expect(dict.ContainsKey((int)((IMapEntry)s.first()).key()));
            }
        }
Пример #3
0
        public void DefaultCtorReturnsEmptyMap()
        {
            PersistentTreeMap m = new PersistentTreeMap();

            Expect(m.count()).To.Equal(0);
            Expect(m.meta()).To.Be.Null();
        }