예제 #1
0
        public void FileRangeQueueTest1()
        {
            Q q = new Q();

            q.Add(new R(10, 40, 1));

            AssertEqual(new R(10, 40, 1), q.GetNext().Value);

            q.Add(new R(20, 30, 2));

            AssertEqual(new R(20, 30, 2), q.GetNext().Value);

            q.Remove(new R(20, 25));

            AssertEqual(new R(25, 30, 2), q.GetNext().Value);

            q.Remove(new R(20, 30));

            AssertEqual(new R(10, 20, 1), q.GetNext().Value);

            q.Remove(new R(long.MinValue, 30));
            q.Remove(new R(60, long.MaxValue));
            q.Add(new R(30, 60, 1));

            AssertEqual(new R(30, 60, 1), q.GetNext().Value);
            q.Remove(new R(30, 40));
            AssertEqual(new R(40, 60, 1), q.GetNext().Value);

            q.Remove(new R(40, 60));
            Assert.IsFalse(q.GetNext().HasValue);
        }
예제 #2
0
        public void QueueInvertTest()
        {
            Q q = new Q();

            q.Add(new R(10, 20, 1));

            Q q2 = Q.Invert(new R(long.MinValue, long.MaxValue, 2), q);

            AssertEqual(new R(long.MinValue, 10, 2), q2.GetNext().Value);

            q2.Remove(new R(long.MinValue, 10));

            AssertEqual(new R(20, long.MaxValue, 2), q2.GetNext().Value);

            q2.Remove(new R(20, long.MaxValue));

            Assert.IsFalse(q2.GetNext().HasValue);
        }