예제 #1
0
        public void OuterMapCachesInnerMaps(SortedChunkedMap <int, int> scm)
        {
            scm.RemoveMany(int.MinValue, Lookup.GE);
            for (int i = 0; i < 10000; i++)
            {
                scm.Add(i, i);
            }
            var outer = scm.outerMap;
            var oc    = outer.GetCursor();

            var first = outer.First;

            scm.Add(10001, 10001);
            Assert.True(oc.MoveFirst());
            Assert.ReferenceEquals(first.Value, oc.CurrentValue);


            var last = outer.Last;

            Assert.True(oc.MoveLast());
            Assert.ReferenceEquals(last.Value, oc.CurrentValue);

            // TODO other cases

            scm.RemoveMany(int.MinValue, Lookup.GE);
        }
예제 #2
0
        public void CouldRemoeAllFromBothEndsOnEmpty()
        {
            var map = new SortedChunkedMap <long, long>();

            map.Add(1, 1);
            Assert.True(map.RemoveMany(map.First.Key, Lookup.GE));
            Assert.AreEqual(0, map.Count);
            Assert.True(map.IsEmpty);
            map.Add(1, 1);
            Assert.True(map.RemoveMany(map.Last.Key, Lookup.LE));
            Assert.AreEqual(0, map.Count);
            Assert.True(map.IsEmpty);
        }
예제 #3
0
        public void CouldRemoveMany()
        {
            var scm = new SortedChunkedMap <int, int>();

            scm.Add(1, 1);
            var removed = scm.RemoveMany(0, Lookup.GE);

            Assert.IsTrue(removed);
            Assert.IsTrue(scm.IsEmpty);
            Assert.IsTrue(scm.Count == 0);
        }
예제 #4
0
        public void CouldRemoveMany() {

            var scm = new SortedChunkedMap<int, int>();
            scm.Add(1, 1);
            var removed = scm.RemoveMany(0, Lookup.GE);
            Assert.IsTrue(removed);
            Assert.IsTrue(scm.IsEmpty);
            Assert.IsTrue(scm.Count == 0);
        }