Ejemplo n.º 1
0
            public void EnqueueAndDequeue()
            {
                var         q = FingerTree.Empty <int>();
                Maybe <int> m;

                q = q.EnqueuePrefix(1);
                q = q.EnqueuePrefix(2);
                q = q.EnqueuePrefix(3);
                Expect.IsSome(3, q.CurrentPrefix);
                Expect.IsSome(1, q.CurrentSuffix);
                (q, m) = q.DequeueSuffix();
                Expect.IsSome(1, m);
                Expect.IsSome(2, q.CurrentSuffix);
                (q, m) = q.DequeueSuffix();
                Expect.IsSome(2, m);
                Expect.IsSome(3, q.CurrentSuffix);
                (q, m) = q.DequeueSuffix();
                Expect.IsSome(3, m);
                Expect.IsNone(q.CurrentSuffix);
                q = q.EnqueuePrefix(4);
                q = q.EnqueuePrefix(5);
                Expect.IsSome(4, q.CurrentSuffix);
                (q, m) = q.DequeueSuffix();
                Expect.IsSome(4, m);
                Expect.IsSome(5, q.CurrentSuffix);
                (q, m) = q.DequeueSuffix();
                Expect.IsSome(5, m);
                Expect.IsNone(q.CurrentSuffix);
            }