Beispiel #1
0
        public void HeadTest()
        {
            const string data  = "One Two Three One Three";
            var          queue = data.Split().Aggregate(BatchedQueue <string> .Empty, BatchedQueue <string> .Snoc);
            var          head  = BatchedQueue <string> .Head(queue);

            Assert.AreEqual("One", head);
        }
Beispiel #2
0
        public void PushPopTest()
        {
            const string data  = "One Two Three One Three";
            var          queue = data.Split().Aggregate(BatchedQueue <string> .Empty, BatchedQueue <string> .Snoc);

            foreach (var expected in data.Split())
            {
                var actual = BatchedQueue <string> .Head(queue);

                Assert.AreEqual(expected, actual);
                queue = BatchedQueue <string> .Tail(queue);
            }

            Assert.IsTrue(BatchedQueue <string> .IsEmpty(queue));
        }
Beispiel #3
0
        public void EmptyHeadTest()
        {
            var queue = BatchedQueue <string> .Empty;

            AssertThrows <ArgumentNullException>(() => BatchedQueue <string> .Head(queue));
        }