public void EmptyTest() { var queue = BatchedQueue <string> .Empty; Assert.IsTrue(BatchedQueue <string> .IsEmpty(queue)); queue = BatchedQueue <string> .Snoc(queue, "Item"); Assert.IsFalse(BatchedQueue <string> .IsEmpty(queue)); queue = BatchedQueue <string> .Tail(queue); Assert.IsTrue(BatchedQueue <string> .IsEmpty(queue)); }
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)); }